Subject: Re: [nmr_sparky] integration
From: Tom Goddard
Date: Jun 4, 2010

Previous: 729 Next: 732


Sparky does not have a routine to do linear interpolation of spectrum data values.

I believe the correction to relaxbox.py I suggested are correct.  The equations are centering the ppm box at the peak position.  The parentheses were mis-placed in the original code so the box was not centered.

    Tom


 

Hi Tom,

thanks for reassuring me :-)

Is there an easy way for you to have Sparky call the linear
interpolation vs. nearest grid point? I mean, if you have a modified
script... not essential, but it would be nice to compare the results.

Finally, I think that the corrections that you propose in the script
(the extra parentheses) are wrong. Please check, but I think the
original script is correct

Stefano

On Jun 3, 2010, at 8:24 PM, Thomas Goddard wrote:

Hi Stefano,

That is right. The sampling done by the relaxbox.py code does not
use the spectrum grid point spacing but instead interpolates in a box
defined by PPM. I believe the Sparky interpolation is nearest grid
point, not linear interpolation. There are Python calls to get the
spectrum grid point spacing if you want that.

I see that the relaxbox.py code has an error. The parentheses are
wrong in the lines that compute the offset in the spectrum.

for i in range(0, bsi):
dx = isz * (i - .5*(bsi-1)/(bsi-1))
for j in range(0, bsj):
dy = jsz * (j - .5*(bsj-1)/(bsj-1))
box_sum += s.data_height((px+dx, py+dy))

should instead be

for i in range(0, bsi):
dx = isz * (i - .5*(bsi-1))/(bsi-1)
for j in range(0, bsj):
dy = jsz * (j - .5*(bsj-1))/(bsj-1)
box_sum += s.data_height((px+dx, py+dy))

Tom


Hello,
I think I now understand the meaning of the two parameters: the
box size
defines the dimension of the box, and the number of box samples
define
how many points within the so-defined box will be used for the
sum. Correct?

# Parameters for sum over box mode. Spectrum values are taken at
nearest
# spectrum grid point.
box_samples = (9, 9)
box_size_ppm = (0.2, 0.5) # PPM box size along w1, w2 axes.

Stefano

--
LA RICERCA C’È E SI VEDE:
5 per mille allUniversità di Bologna - C.F.: 80007010376
http://www.unibo.it/Vademecum5permille.htm

Questa informativa è inserita in automatico dal sistema al fine
esclusivo della realizzazione dei fini istituzionali dell’ente.

--
LA RICERCA C’È E SI VEDE:
5 per mille allUniversità di Bologna - C.F.: 80007010376
http://www.unibo.it/Vademecum5permille.htm

Questa informativa è inserita in automatico dal sistema al fine esclusivo della realizzazione dei fini istituzionali dell’ente.