Closed bronsonp closed 4 years ago
Thanks for the many improvements! I've merged the changes into the master branch. I also modified the unit testing code to accommodate the new possibility of having "children" spectra. Along the way, I found a bug in the existing file parser (dealing with DUP codes) and fixed that as well.
This PR implements support for compound files, where multiple blocks are present in a single file. These are documented in Table XI in the specification.
The implementation works by extracting the lines that make up each block, then recursively calling jcamp_read on this sub-section of the file.
An example data file is included in
data/infrared_spectra/example_compound_file.jdx
that can be used to test this functionality.This PR also adjusts the parser to allow the semicolon to be a separator between numbers, which is necessary to read files generated by "The Unscrambler" software. I also expanded the whitespace separator to the regex
\s
(e.g. space, tab,\r
and\n
) since I found Windows linefeed characters were not being properly handled by the parser.