The JCAMP-DX parser was a bit flawed what comes to the JCAMP "block" structuring i.e. separating data sections (of different ##DATATYPEs). The blocks should always start at ##TITLE tag (this was not respected), end to ##END tag and they may also be nested (also did not work). This PR fixes the block reading as it is specified.
Some additional notes:
The main parser function was split to two separate functions as suggested already in comments of #120
Since the files may have multiple spectra, and data is built for only the first one by default, the _getdataarray function was renamed to getdataarray as it is needed to be called from outside the parser as well.
There is a new test, please find the test data for it here:
dicstructure2.zip
The JCAMP-DX parser was a bit flawed what comes to the JCAMP "block" structuring i.e. separating data sections (of different ##DATATYPEs). The blocks should always start at ##TITLE tag (this was not respected), end to ##END tag and they may also be nested (also did not work). This PR fixes the block reading as it is specified.
Some additional notes:
_getdataarray
function was renamed togetdataarray
as it is needed to be called from outside the parser as well.