bryanhanson / readJDX

Import spectroscopic data in the JCAMP-DX format
https://bryanhanson.github.io/readJDX/
8 stars 2 forks source link

check if LINK-block exists #17

Open pstahlhofen opened 2 years ago

pstahlhofen commented 2 years ago

Is it possible to check in a multi-block JCAMP-file, if there is any block with DATA_TYPE=LINK and to adjust the behaviour of the splitMultiblockDX-function accordingly? I experienced that in cases where the LINK-block is missing, the function will now simply throw an error because it thinks that the number of START and END statements do not match. I viewed the code and found out that this is due to the implicit assumption that there must always be a LINK-block. In my example, however, there was no such block, so I added it manually.

bryanhanson commented 2 years ago

I'll look into this in January. JCAMP allows a lot of different configurations which creates a lot of possibilities. Adding what was missing manually was a good idea, I've had to do that a lot of times (not for the LINK, but for required parameters that vendors leave out).

pstahlhofen commented 2 years ago

Alright, thank you!

bryanhanson commented 2 years ago
##DATA TYPE= LINK
##BLOCKS=some_integer

The above is what the JCAMP standard requires, but the function only checks for ##BLOCKS= so I guess the file that is giving you trouble is missing ##BLOCKS=. But, is it also missing ##DATA TYPE= LINK line?

I think the fix is to issue a warning if ##BLOCKS= is missing, but then we'll still have to find an equal number of TITLE and END statements.