Closed cheminux closed 8 years ago
Changing the NMRJCAMPWriter.java:
buildPeakTable(int block, NMRSpectrum nmr){ ... jcamp.append("##PEAKTABLE=(XY..XY)").append(CRLF); for (int i = 0; i < n; i++) { double x = peaks[i].getPosition()[0]; double y = peaks[i].getPosition()[1]; jcamp.append(x).append(',').append(y).append(CRLF); } jcamp.append("##END=").append(CRLF); ... }
to
buildPeakTable(int block, NMRSpectrum nmr){ ... jcamp.append("##PEAKTABLE=(XY..XY)").append(CRLF); for (int i = 0; i < n; i++) { double x = peaks[i].getPosition()[0]; double y = peaks[i].getHeight(); jcamp.append(x).append(',').append(y).append(CRLF); } jcamp.append("##END=").append(CRLF); ... }
fix my problem.
But I do not know how you would like to write a X-Range!?
I only use it for NIR, not NMR. Have you had a look at the specs? http://www.jcamp-dx.org/protocols.html
Thanks againt for the very fast answer!
I checked the specs... In JCAMP-DX for NMR there is a peaktable definition in chapter 5.4.3. Do I misinterpret the definition?
Here's how I understand it. The peaktable merely lists the coordinates where there is a peak. It doesn't actually store the peak height, as the height can be obtained from the spectral data (at the specified position). NMR data is two-dimensional, x
and height
. Other spectra might be three-dimensional, with x
, y
and height
. To cut a long story short, I think it is correct that for NMR data, the peak table stores x,x
in the file, as there is no X..X
format available.
But in the peak table definition from (5.4.3@JCAMP-DX for NMR;http://www.jcamp-dx.org/protocols.html) is written:
(5.4.3) ##PEAK TABLE= (STRING). Contains a table of peaks. For abscissa against intensity, the variable list (XY..XY) should be used. For peak position, intensity, and width, the variable list would be (XYW..XYW) ?
I tested the kerner100 sources and there the peak table is written as I expect?
Sorry, you're right about the definition. However, if you do a diff on the NMRJCAMPWriter
writers, then you'll see that there is no difference between kerner1000 and this one here.
OK thnaks for the definition confirmation.
And yes you are right there is now difference between the orignal code...I changed the kerner1000 code before I did the diff ;-)
Committed your proposed fix, using
double y = peaks[i].getHeight();
instead of
double y = peaks[i].getPosition()[1];
.
After reading jcamp file with nmr data. I add a peaktable manually by
Afterward NMRSpectrum object look ok in the debugger. But the JCAMPWriter produce a file with a peaktable containing only x,x pairs:
PEAKTABLE=(XY..XY)
x1,x1 x2,x2 .....
Regards Sven