spectrochempy.set_nmr_context
- set_nmr_context(larmor)[source]
- Set a NMR context relative to the given Larmor frequency. - Parameters:
- larmor ( - Quantityor- float) – The Larmor frequency of the current nucleus. If it is not a quantity it is assumed to be given in MHz.
 - Examples - First we set the NMR context, - >>> from spectrochempy.core.units import ur, set_nmr_context >>> >>> set_nmr_context(104.3 * ur.MHz) - then, we can use the context as follow - >>> fhz = 10000 * ur.Hz >>> with ur.context('nmr'): ... fppm = fhz.to('ppm') >>> print("{:~.3f}".format(fppm)) 95.877 ppm - or in the opposite direction - >>> with ur.context('nmr'): ... fhz = fppm.to('kHz') >>> print("{:~.3f}".format(fhz)) 10.000 kHz - Now we update the context : - >>> with ur.context('nmr', larmor=100. * ur.MHz): ... fppm = fhz.to('ppm') >>> print("{:~.3f}".format(fppm)) 100.000 ppm - >>> set_nmr_context(75 * ur.MHz) >>> fhz = 10000 * ur.Hz >>> with ur.context('nmr'): ... fppm = fhz.to('ppm') >>> print("{:~.3f}".format(fppm)) 133.333 ppm