Comments (6)
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.
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.
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.
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.
@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:
- 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.
- 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.
Closed by #45
from nmrglue.
Related Issues (20)
- Problem number of points in 2D experiments HOT 6
- nmrglue import fails with scipy=1.8
- Installation fails with setuptools v61.2.0 HOT 2
- Import error - scipy version 1.8.0 HOT 1
- integrate_2d: how to get limits.in? HOT 2
- Problem with 1D plotting - maybe HOT 3
- Failed to load Bruker Data HOT 2
- Give up on Python 3.6 HOT 1
- Process_pipe_3d:There seems to be some issues with the processing script HOT 13
- nmrglue fails loading due to scipy.minpack deprecation (1.9.3) HOT 2
- Does the spectral raw data obtained by 'Echo-Antiecho', 'States', 'TPPI' and 'States-TPPI' require additional manual operations? HOT 2
- ng.analysis.peakpick.pick() generating deprecation warning due to np.float() HOT 3
- Suggestion: nmrglue/fileio/SPINit.py
- Issue when trying to convert Varian data to Pipe HOT 2
- How to Process and display multiple 1D Bruker data HOT 3
- Port tests away from nose HOT 2
- New release HOT 4
- Help plotting Bruker 2D spectra HOT 3
- Issue with ng.peakpick.pick for "thres" and "thres-fast" algorithms with Numpy ^v1.22 HOT 2
- Peak picking from a 2D contour plot HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nmrglue.