JCAMP-DX spectral data interchange, checked ASDF decoding and offline validation for MoonBit
moon add zbhzs1/moonjcamp@0.1.0let spectra = @jcamp.read_spectra(text)
let selected = @jcamp.crop(spectra[0], 1001.0, 1002.0)
let output = @jcamp.write_spectrum(selected)git clone https://github.com/zbhzs1/moonjcamp.git
cd moonjcamp
moon build --target js --release
node bin/moonjcamp.mjs inspect examples/data/ir-compressed.jdx
node bin/moonjcamp.mjs to-json examples/data/ir-compressed.jdx --out spectrum.json
node bin/moonjcamp.mjs from-json spectrum.json --out normalized.jdx
node bin/moonjcamp.mjs verify examples/data/ir-compressed.jdx normalized.jdx
moon run examples/basic --target jsmoon check --target js --deny-warn
moon test --target js
moon test --target wasm-gc
moon build --target js --release
node scripts/cli-test.mjs
python -m pip install numpy==2.4.4
python scripts/interop.py
node scripts/source-count.mjspub(all) struct AuditReport {
valid : Bool
spectra : Int
errors : Int
warnings : Int
truncated : Bool
diagnostics : Array[Diagnostic]
} derive(ToJson, Debug)pub(all) struct Comparison {
equivalent : Bool
compared_points : Int
issue_count : Int
truncated : Bool
issues : Array[ComparisonIssue]
} derive(ToJson, Debug)pub(all) struct ParseOptions {
limits : Limits
numeric_mode : NumericMode
relative_tolerance : Double
absolute_tolerance : Double
} derive(ToJson, Debug)pub(all) struct Report {
valid : Bool
spectra : Int
points : Int
missing : Int
diagnostics : Array[Diagnostic]
} derive(ToJson, Debug)pub(all) struct Summary {
title : String
points : Int
missing : Int
x_min : Double
x_max : Double
y_min : Double?
y_max : Double?
y_mean : Double?
direction : Int
uniform : Bool
longest_missing_run : Int
diagnostics : Array[Diagnostic]
accepted : Bool
} derive(ToJson, Debug)pub(all) struct WriteOptions {
encoding : Encoding
table_style : TableStyle
points_per_line : Int
x_factor : Double
y_factor : Double
} derive(ToJson, Debug)fn audit_document(document : Document, policy? : AuditPolicy, options? : ParseOptions) -> AuditReport raise JcampErrorfn combine_documents(documents : Array[Document], title? : String, read_options? : ParseOptions) -> Document raise JcampErrorfn compare_documents(left : String, right : String, options? : ParseOptions, compare_records? : Bool, max_issues? : Int) -> Comparison raise JcampErrorfn compare_spectra(left : Array[Spectrum], right : Array[Spectrum], options? : ParseOptions, compare_records? : Bool, max_issues? : Int) -> Comparison raise JcampErrorfn decode_numbers(text : String, mode? : NumericMode, max_values? : Int) -> Array[Double?] raise JcampErrorfn inspect_batch(inputs : Array[BatchInput], policy? : QualityPolicy, options? : ParseOptions) -> BatchReport raise JcampErrorfn resample(spectrum : Spectrum, start : Double, end : Double, count : Int) -> Spectrum raise JcampErrorfn rewrite_document(document : Document, options? : WriteOptions, read_options? : ParseOptions) -> String raise JcampErrorfn spectra_from_document(document : Document, options? : ParseOptions) -> Array[Spectrum] raise JcampErrorfn split_document(document : Document, read_options? : ParseOptions) -> Array[Document] raise JcampErrorfn write_collection(spectra : Array[Spectrum], title? : String, options? : WriteOptions) -> String raise JcampErrorInstall
Download zipJCAMP-DX spectral data interchange, checked ASDF decoding and offline validation for MoonBit