Closed carlosbornes closed 2 years ago
I am assuming that the error is with the plotting function, where one of these two lines is failing:
ax['a'].plot(ppm_13C, f2proj)
ax['b'].plot(-f1proj, ppm_1H)
My best guess is that the udic
that is being generated is not consistent with the data shape. Are the shapes of ppm_13C
and f2_proj
(or f1proj and ppm_1H) the same? If not, then there is some inconsistency while reading in the parameters and generating the universal dictionary. one place this could occur is if you use non-zero STSR
and STSI
values for processing in Topspin. If so, you should indicate that when generating a universal dictionary.
udic_2d = ng.bruker.guess_udic(dic_2d, data_2d, strip_fake=True)
Also, as far as I can see, this should also work without the intermediate conversion to nmrpipe formats (unless you need that for something else). You can generate the unit conversion object from a universal dictionary and data using:
uc_13C = ng.fileiobase.uc_from_udic(udic_2d, dim=1)
uc_1H = ng.fileiobase.uc_from_udic(udic_2d, dim=0)
Everything seems fine with the F2 dimension since the shape is the same
f2proj.shape
(2048,)
ppm_13C.shape
(2048,)
The F1, the calculated projection has double the number of points
f1proj.shape
(256,)
ppm_1H.shape
(128,)
I've tried to use
udic_2d = ng.bruker.guess_udic(dic_2d, data_2d, strip_fake=True)
but the problem persists. But anyway both STSR and STSI are zero.
It is unlikely that the amax
function is giving the incorrect array size. So my guess is that the problem should be with the unit conversion. Can you confirm that the shape of data_pipe
is incompatible with the shape of ppm_1H
.
I believe it is. I was checking the dimension and
data_pipe.shape
(256, 2048)
But then when I run
uc_1H = ng.pipe.make_uc(dic_pipe, data_pipe, dim=0)
ppm_1H = uc_1H.ppm_scale()
The size is cut in half
ppm_1H.shape
(128,)
Does skipping the conversion back and forth from nmrpipe, and generating the unit conversion object from bruker data (as shown in this comment) give the same results? If yes, will it be possible to share the data for debugging this?
Not converting to NMRpipe solves the problem. For now its ok but maybe it would be worth it to solve this.
Hi I'm trying to get a plot some NMR data using nmrglue and matplotlib and I found that when trying to plot the 2D spectra and the respective F1 and F2 projections I get the following error
x and y must have same first dimension, but have shapes (2048,) and (1024,)
I was able to troubleshoot this in the following way 1st - Import the data and calculate the projections using
2nd - Go to topspin reprocess spectra with half SI (Size of real spectrum) of F1 dimension and run
3rd - Plot everything
If I do this 3 steps process with reprocessing the data with half SI in the second step the dimensions seem to see correct otherwise I get the error mentioned above