jjhelmus / nmrglue

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

Roll data and update unit conversion object #219

Open weisscharlesj opened 3 weeks ago

weisscharlesj commented 3 weeks ago

Is there a way to reference the data that also updates the unit conversion object? I'm rolling the data in the frequency domain to reference the data correctly (i.e., move TMS to 0.0 ppm), but this is causing issues with integrating the data later on because the unit conversion object is not aware of the shift.

kaustubhmote commented 3 weeks ago

Currently, a unit conversion object once created is not designed to be updated. You will have to manually create a new unit conversion object with the new carrier frequency. However, there is a 'hack' that will work:

new_carrier_frq = uc._car + 100 # change this according to how your axis needs to be updated
uc.__init__(uc._size, uc._cplx, uc._sw, uc._obs, new_carrier_frq)

I think it is a good idea to add this functionality to the uc object so that the carrier frequency can be updated. The use case that you describe is common enough for this to be useful. I will mark this issue as an enhancement proposal for people to consider.