Coder Social home page Coder Social logo

Comments (6)

neuroglobin avatar neuroglobin commented on June 8, 2024

Hi,
Simple sum is a routine method of doing "integration". For example, NMRPipe measures peak volumes in this way, Sparky also provides "Sum over box" and "Sum over eclipse" modes although they are not default options. I think nmrglue just does the same thing.

It seems to me that your integration method normalizes peak intensities to 1.0, which will help quantitatively comparison between spectra collected/processed differently. Is my understanding of this correct? Will you correct/scale your integrated areas/volumes by the peak heights (that are not affected significantly by zero-filling or binning)?

Thanks.

from nmrglue.

kfritzsc avatar kfritzsc commented on June 8, 2024

I agree that the simple sum method is common and works within a single spectrum.

I propose no re-normalization. I just purpose using the definition of an integral.

If integration is done properly spectra with different bin widths (as a result of different zero-filling or dwell times, ect.) can be compared quantitatively. I do not purpose to do anything with the max intensity in the range (i.e. peak hight).

I would get the same, correct, result by printing the spectrum on paper, cutting out the peaks with scissors and then weighing the peaks with an analytical balance.

from nmrglue.

atomman avatar atomman commented on June 8, 2024

I think it is a good point. For me I would prefer the unit_conv simply to be the ppm scale for the data. I realize this It is a bit hacky to produce this scale at the moment, especially for bruker data, but that is a separate problem

from nmrglue.

kfritzsc avatar kfritzsc commented on June 8, 2024

Thank you for the support! It would be pretty simple to write a function that takes either the unit_converter or the ppm scale as an array, one try / except AttributeError block would do.

I hope PR #43 fixes some of the ppm scale problems for Bruker data.

from nmrglue.

jjhelmus avatar jjhelmus commented on June 8, 2024

@kfritzsc Very interesting discussion, I agree that some additional functions on this topic could be added to nmrglue.

What is and isn't "integration" very quickly descends into semantics which I do not wish to spend to much time arguing one way or the other. More practically, finding the intensity of a peak by summing over a box or rectangular region is often used in NMR to analyse a set of spectra collected with identical parameters, for example in the fitting t1 data example. In such cases, the underlying spacing need not be considered. From email I get about nmrglue and the description of how the package is used in journal articles, these "integration" examples seem to be exactly what many scientists are looking for and are quite often used with only minor modifications.

As for the more specific questions:

  1. What is 'process.proc_base.integ' being used for? Now it is just an aliases for np.cumsum(data, axis=-1).

This performs "intergration" in the same manner as NMRPipe's INTEG function, by cumulative sum. The units of the integral are points (where dx is 1) which are used in nearly all the function in proc_base. This could be more explicitly explained in the docstring. Using this for analysis is probably not best, but this type of function is sometimes used to process data.

  1. I think there should be a function to do integration in nmrglue. It is something that most users will need. At minimum I think the function needs x (or some proxy), and y data and two x limits. Something like this would work...

Agreed, having this function somewhere in the analysis folder is probably best. You may want to think about including support for units other than PPM such as hertz and seconds as well as finding a way to support multi-dimensional integration. The unit_conversion class might be helpful here as it is designed to convert various NMR units to an index which can be used to slice the data:

>> >uc = ng.pipe.make_uc(dic, data)
>>> print(uc("100 ppm"))
411
>>> uc("650 Hz")
768
>>> print(uc("50%"))
750
>>> print(uc("5000 us")  # time units are not too helpful in the frequency domain but can be used...
250
>>> print(uc("5 ms"))
250

from nmrglue.

jjhelmus avatar jjhelmus commented on June 8, 2024

Closed by #45

from nmrglue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.