Analysis

spinlab.analysis.peaks.find_peaks(data, dims=None, normalize=True, regions=None, height=0.5, threshold=None, distance=None, prominence=None, width=None, wlen=None, rel_height=0.5, plateau_size=None, *, dim=None)

Find peaks in spectrum

Find peaks in spectrum (SpinData object) and return peak index, peak coordinate, peak height, peak width (Hz), and peak width height. The function uses the SciPy functions find_peaks and peak_widths.

Parameters:
  • data (SpinData) -- Data object

  • dims (str or None) -- Dimension to find peaks. If None, the first dimension is used. dim is accepted as a clearer keyword alias.

  • regions (None, list) -- List of tuples defining the region to find peaks

  • normalize (boolean) -- Normalize data to a maximum value of 1. Default is True

  • height (float or numpy.array) -- Optionally, height of peaks. If an array is supplied, the first element is minimum and the second is maximum

  • threshold (float or numpy.array) -- Optionally, threshold of minimum peak height to be counted. If an array is supplied, the first element is minimum and the second is maximum

  • distance (float) -- Optionally, minimal horizontal distance in samples between peaks. Smaller peaks are removed first until the condition is fulfilled for all remaining peaks.

  • prominence (float or numpy.array) -- Optionally, prominence of peaks. If an array is supplied, the first element is minimum and the second is maximum

  • width (float or numpy.array) -- Optionally, width of peaks. If an array is supplied, the first element is minimum and the second is maximum

  • wlen (int) -- Optionally, for calculating the peaks prominences. Only valid if prominence is given

  • rel_height (float) -- Optionally, relative height at which peak width is measured. Default is 0.5 for FWHH

  • plateau_size (float or numpy.array) -- Optionally, size of the flat top of peaks in samples. If an array is supplied, the first element is minimum and the second is maximum

  • peak_info (boolean) -- If True print output to terminal

Returns:

Array of peak index, peak coordinate, peak

height, peak width and relative peak height. The linewidth is returned in Hz using spinlab_attrs["frequency"] or the legacy attrs["nmr_frequency"].

Return type:

data (SpinData)

Examples

Find peaks in entire data region:

>>> data = sl.load("path/to/data")
>>> peak_list = sl.find_peaks(data)

Find peaks with an amplitude > 0.01 (after normalization):

>>> peak_list = sl.find_peaks(data, height=0.05)

Find peaks with an amplitude > 500 (data not normalized):

>>> peak_list = sl.find_peaks(data, height=500, normalize=False)
spinlab.analysis.peaks.peak_info(data)

Print peak list in human readable form

Function to print the peak list in a human readable form. You first have to run find_peaks to create a sldata object that includes a peak list.

Parameters:

data (SpinData) -- SpinData object created by find_peaks

Returns:

Peak list table

Return type:

Output (str)

Module which provides functions to analyze relaxation measurements

spinlab.analysis.relaxation_fit.inversion_recovery_fit(integrals)

Fit an inversion recovery experiment to extract the longitudinal relaxation time T1.

Fits the real part of the integrated signal intensities to the inversion recovery function spinlab.math.relaxation.t1() using an automatically estimated initial guess.

Parameters:

integrals (SpinData) -- Integrated signal intensities as a function of the inversion recovery delay time. The data object must have a dimension labeled "t1".

Returns:

Fit results dictionary containing the fitted curve, optimal

parameters, and fit errors (see spinlab.fitting.fit()).

Return type:

dict

Note

This function is currently under development. Results are printed to the console but not yet returned in a structured format.

Modules to calculate Spin enhancement profiles

spinlab.analysis.simulate_enhancement_profiles.sim_sl_profile(data, B0, nucleus='1H', sl_process='SE', add_details=False, remove_background=True, normalize=True, integrate=True)

Simulate Spin enhancement profile

Simulate Spin enhancement profile based on the EPR spectrum. For more details:

Banerjee, D., D. Shimon, A. Feintuch, S. Vega, and D. Goldfarb. “The Interplay between the Solid Effect and the Cross Effect Mechanisms in Solid State (1)(3)C Spin at 95 GHz Using Trityl Radicals.” Journal of Magnetic Resonance 230 (May 2013): 212–19. https://doi.org/10.1016/j.jmr.2013.02.010.

Parameters:
  • data (Spindata) -- EPR spectrum

  • B0 (float) -- Field position for the Spin experiment in (T)

  • nucleus (int) -- Nucleus for Spin experiment

  • sl_process (int) -- Select Spin mechanism, SE - Solid Effect, CE/TM - Cross-Effect/Thermal Mixing

  • add_details (boolean) -- Add individual spectra to proc_attrs. Default is False

  • remove_background (boolean) -- Remove 0th order background from EPR spectrum. Default is True

  • normalize (boolean) -- Normalize EPR spectrum to maximum amplitude of 1. Default is True

  • integrate (boolean) -- Integrate EPR spectrum. Default is True

Returns:

Simulated Spin enhancement profile

Return type:

data (Spindata)

\[\]