Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JCAMPWriter (complex NMR Data) corrupts the ##XYDATA Block #3

Open
cheminux opened this issue Jun 27, 2016 · 8 comments
Open

JCAMPWriter (complex NMR Data) corrupts the ##XYDATA Block #3

cheminux opened this issue Jun 27, 2016 · 8 comments
Assignees
Labels

Comments

@cheminux
Copy link

Its me again, sorry for annoying you!

I read a jcamp file with complex nmr data (which works like a charm!) and write directly the produced data with the JCAMPWriter:

       Spectrum jcampSpectrum = null;
       nmrspectrum = (NMRSpectrum) jcampSpectrum;
       JCAMPWriter jwriter = JCAMPWriter.getInstance();
       FileWriter writer = new FileWriter(file);
       writer.write(jwriter.toJCAMP(nmrspectrum));

...
Reading again the new jcamp file lead to multiple messages like:

WARNUNG: x check failed in line1: expected x = 1325727.744000001 but got 7716.745205020741
SCHWERWIEGEND: bad x check value

and

WARNUNG: incorrect ##NPOINTS= or bad ##XYDATA=
found 154130, but ##NPOINTS= 131072, setting NPOINTS to 154130

In the end the spectrum is corrupt.

I get the same multiple messages from your test on compiling your source code.

What can I do to write correct nmr jcamp file?

Anyway I would like to thank you for the fantastic work with jcamp-dx.
I appreciate your project and would like to use it intensively.

Best regards,

Sven

@fracpete
Copy link
Owner

This project is just a fork of the orphaned project on sf.net (https://sourceforge.net/projects/jcamp-dx/). Never used NMR data before.
Have you tried this fork: https://github.com/kerner1000/jcamp-dx ?

@cheminux
Copy link
Author

Mayn thanks for the hint.

But my first try with the above mentioned fork failed, I could not even read my data and I do not have time to look in detail.

Anyway I will use your code for my purpos and save my calculated data in separat file.

@fracpete fracpete added the bug label Jun 28, 2016
@fracpete fracpete self-assigned this Jun 28, 2016
@fracpete
Copy link
Owner

Thanks for letting me know. Can you send through an example NMR file that exhibits this behavior?

@cheminux
Copy link
Author

cheminux commented Jun 30, 2016

Any example show this behavior. E.g. in your test data with jcamp60.jdx (you have to remove all lines with starting with %% because the parser does not like them)

@fracpete
Copy link
Owner

fracpete commented Jul 1, 2016

The library only supports version 5.01 (at least according to NMRJCAMPWriter), not version 6.0.
jcamp60.jdx is version 6.0, however.

@laeubi
Copy link
Contributor

laeubi commented Jul 30, 2019

I also get corrupt (FID) data, try to read it back results in

org.jcamp.parser.JCAMPException: parsing failed
expecting EOL, found '-7'
	at org.jcamp.parser.ASDFDecoder.decode(ASDFDecoder.java:60)
	at org.jcamp.parser.JCAMPNTuplePage.getXYData(JCAMPNTuplePage.java:224)
	at org.jcamp.parser.NMRJCAMPReader.createFID(NMRJCAMPReader.java:130)
	at org.jcamp.parser.NMRJCAMPReader.createSpectrum(NMRJCAMPReader.java:325)
	at org.jcamp.parser.JCAMPReader.createSpectrum(JCAMPReader.java:109)

@fracpete
Copy link
Owner

I only use the library for NIR data.

@laeubi
Copy link
Contributor

laeubi commented Aug 6, 2019

I have debugged a little bit and it seems that either the parser or the generator for the compressed data has some problem, I had to read the spec a little bit more to understand what happens.
It might also be good to have a uncompressed version of data available but currently all that stuff is hardcoded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants