Public API

Only exported types and functions are considered part of the public API. Raw header fields not covered by the exposed struct fields are still available through s.metadata.

Index

Reading files

Types

JASCOFiles.JASCOSpectrum — Type
JASCOSpectrum <: AbstractJASCOSpectrum

Represents a single spectrum parsed from a JASCO file.

Fields

  • title::String: Title of the measurement.
  • date::Union{DateTime, Nothing}: Date and time of the measurement, or nothing when the file carries no parseable timestamp.
  • spectrometer::String: Name of the spectrometer instrument ("" if absent).
  • datatype::String: Type of spectrum (e.g. "INFRARED SPECTRUM", "RAMAN SPECTRUM").
  • xunits::String: Units for the x-axis (e.g. "1/CM").
  • yunits::String: Units for the y-axis (e.g. "ABSORBANCE", "TRANSMITTANCE").
  • x::Vector{Float64}: X-axis data points.
  • y::Vector{Float64}: Y-axis data points.
  • metadata::Dict{String, Any}: Raw metadata dictionary from the file header.

Constructors

JASCOSpectrum(path; encoding=enc"SHIFT-JIS", translate=true)
JASCOSpectrum(; x, y, title="Untitled", date=nothing, spectrometer="",
              datatype="", xunits="", yunits="", metadata=Dict{String,Any}())
JASCOSpectrum(s::JASCOSpectrum; fields...)

The path constructor parses a JASCO file (CSV/text export or native binary). The keyword constructor builds a spectrum directly; only x and y are required. The copy constructor returns a copy of s with any subset of fields replaced, sharing the rest:

a = JASCOSpectrum(s; title="Renamed", spectrometer="FT/IR-6600")

x and y must have equal length.

source

Type predicates

JASCOFiles.isftir — Method
isftir(s::AbstractJASCOSpectrum) -> Bool

Return true if the spectrum is an FTIR (infrared) spectrum.

source
JASCOFiles.israman — Method
israman(s::AbstractJASCOSpectrum) -> Bool

Return true if the spectrum is a Raman spectrum.

source
JASCOFiles.isuvvis — Method
isuvvis(s::AbstractJASCOSpectrum) -> Bool

Return true if the spectrum is a UV-Vis (or UV-Vis/NIR) spectrum.

Some JASCO instruments (e.g. the V-730) export files with a blank DATA TYPE field. In that case, the spectrum is classified as UV-Vis when xunits is "NANOMETERS" and the wavelength range falls within 100–3500 nm.

source

Plotting with Makie

When Makie is loaded, plot(s) is available via a package extension. Load a backend first (using CairoMakie or using GLMakie):

using JASCOFiles, CairoMakie

s = JASCOSpectrum("sample.csv")
fig, ax, ln = plot(s)
fig, ax, ln = plot(s; color = :tomato)
fig, ax, ln = plot(s; axis = (xreversed = false,))

Axis defaults are filled from the spectrum:

  • xlabel/ylabel derived from s.xunits/s.yunits
  • title from s.title
  • xreversed = isftir(s) (standard IR orientation: wavenumber decreases left-to-right)

Pass an axis NamedTuple to override any of these. Other keyword arguments are forwarded to Makie.lines.

The extension also hooks Makie.convert_arguments, so lines(s), scatter(s), and lines!(ax, s) work directly without going through s.x/s.y.

Tables.jl integration

A JASCOSpectrum implements the Tables.jl column-access interface with two columns, :x and :y. Any package that consumes a Tables-compatible source works directly:

using JASCOFiles, DataFrames

s = JASCOSpectrum("sample.csv")
df = DataFrame(s)        # columns :x and :y
using JASCOFiles, CSV

CSV.write("sample_xy.csv", JASCOSpectrum("sample.csv"))

The extension loads automatically when both JASCOFiles and a Tables.jl-compatible package (DataFrames, CSV, Arrow, …) are loaded in the same session — no explicit using Tables required. Column names are intentionally generic; if you want labelled output, rename after conversion (e.g. rename!(df, :x => :wavenumber, :y => :absorbance)).