jjhelmus / nmrglue

A module for working with NMR data in Python
BSD 3-Clause "New" or "Revised" License
211 stars 86 forks source link

Option to remove Bruker digital filter post processing #67

Closed kaustubhmote closed 7 years ago

kaustubhmote commented 7 years ago

Out of the several ways in which we can remove the Bruker digital filter, simply adding a first order phase correction corresponding to the start delay given by the GRPDLY parameter seems to work the best, atleast for TopSpin>2.0 and when the spectrum is acquired with DIGMOD= 'baseopt', which is a default for many cases. Since this has to be done after fourier transformation, I have added an option post_proc=True to do this to the remove_digital_filter and rm_dig_filter functions. This has a few advantages:

  1. No 'Bruker smiles'
  2. No additional (or a very small one, depending on how the pulse sequence was coded) first order phase correction needs to be applied
  3. Number of points for the final frequency domain spectrum remains the same as the uncorrected time domain. This is required for consistency with spectra processed with TopSpin

I have included here comparison of such a processing in nmrglue, NMRPipe (will work in version > 8.7) and TopSpin (3.5pl7). This should also serve as an example for processing spectra this way. The image for the above comparison is given below:

dig_filter_remove

Note that the time domain data still has the artifact. I dont expect this to be a problem in most cases. I am also not sure of all the implications of just doing a inverse-fft on this frequency domain data (both technical and the broderline-philosophical, as in, which of these is the true NMR FID?). but since the original function already does something like that, I am inclining towards accepting this.

However, all apodization functions must now have a time delay. This could be done by making a bruker-specific module similar to the nmrpipe-specific pipe_proc.py. For now, however, post_proc is kept as a non-default option in bruker.remove_digital_filter.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.01%) to 20.647% when pulling e296a8b7e46a1aed733f314c111316226d67c3fb on kaustubhmote:master into 7f91079998c84026f5c64c282b1f434ea61f033b on jjhelmus:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.01%) to 20.647% when pulling 9b51803f021c0ea0f6e5571c2e307d98f85f649e on kaustubhmote:master into 7f91079998c84026f5c64c282b1f434ea61f033b on jjhelmus:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.08%) to 20.58% when pulling f29b1c6804ba7f19e9c5cedfdcf44516eb817667 on kaustubhmote:master into 7f91079998c84026f5c64c282b1f434ea61f033b on jjhelmus:master.

jjhelmus commented 7 years ago

Looks good. There are a few style issues that I will correct post-merge. nmrglue tries to follow the PEP8 standard. I use the pycodestyle tool to check for this style.