screamlab.dataset module

Spectral and Peak information containing module.

This moduel provides classes for handling and processing of spectral/peak information as well as results from spectral fitting.

Classes:

Dataset: Represents the hole dataset and provides all functions needed to start analysis. Spectra: Represents spectral data from NMR (Nuclear Magnetic Resonance) experiments. Peak: Represents a peak with its properties. BuildupList: Represents a list of buildup values used for fitting delay times and intensities.

class screamlab.dataset.Dataset(props=<screamlab.settings.Properties object>)

Bases: object

Represents a dataset containing NMR spectra, peak fitting, and buildup fitting.

start_analysis()

Starting the analysis process.

The analysis is carried out in three stages: first, the spectral data are imported from the Topspin file format; second, spectral deconvolution is performed; and finally, a buildup fit is applied.

add_peak(center_of_peak, peak_label='', fitting_type='voigt', peak_sign='-', line_broadening=None, integration_range=None)

Adds a peak to the ds.

center_of_peak(float)
Type:

Peak position in ppm (chemical shift).

peak_label(str, optional)
Type:

Custom label. Defaults to “Peak_at_<ppm>_ppm”.

fitting_type(str, optional)
Type:

Peak shape: “gauss”, “lorentz”, or “voigt” (default).

peak_sign(str, optional)
Type:

“+” for upward, “-” for downward peaks. Defaults to “+”.

line_broadening(dict, optional)

Defaults to {“sigma”: {“min”: 0, “max”: 3}, “gamma”: {“min”: 0, “max”: 3}}.

Type:

Dict with “sigma” and “gamma” keys for line width.

class screamlab.dataset.Spectra

Bases: object

Represents spectral data for NMR (Nuclear Magnetic Resonance) experiments.

number_of_scans

The number of scans performed in the NMR experiment.

Type:

list of int or None

tpol

The polarization time used in the experiment.

Type:

float or None

nucs

The nucleous measured.

Type:

str or None

x_axis

The x-axis values representing frequency domain data data.

Type:

array-like or None

y_axis

The y-axis values representing intensity or amplitude data.

Type:

array-like or None

class screamlab.dataset.Peak

Bases: object

Represents a peak with its properties.

Such as peak center, peak label, fitting group, fitting type, peak sign, line broadening, and buildup values.

to_string(spectrum_fit_type)

Returns a string representation of the peak.

If spectrum_fit_type is “numint”, detailed peak information is returned, including center, label, sign, and integration range. Otherwise, the default string representation of the object is returned.

Parameters:

spectrum_fit_type (str) – The type of spectrum fitting. Supports “numint” for numerical integration.

Returns:

str – string representation of the object.

Return type:

A formatted string with peak information, or the default

property integration_range: list

Gets the integration range.

Returns:

property buildup_vals: list

Gets the buildup values.

Returns:

A list of buildup values.

property line_broadening: str

Gets the line broadening parameters.

Returns:

A dictionary representing line broadening values.

property peak_sign: str

Gets the peak sign.

Returns:

The peak sign (‘+’ or ‘-‘).

property fitting_type: str

Gets the peak fitting type.

Returns:

The fitting type as a string.

property peak_center: (<class 'int'>, <class 'float'>)

Gets the peak center.

Returns:

The peak center as an integer or float.

property peak_label: str

Get or set the label for a peak.

Returns:

str

Return type:

The current peak label.

class screamlab.dataset.BuildupList

Bases: object

Represents a list of buildup values used for fitting delay times and intensities.

tpol(list)
Type:

List of delay times.

intensity(list)
Type:

List of intensity values.

set_vals(result, spectra, label)

Sets buildup values using the result parameters and spectra.

result(object)
Type:

Fitted parameter values used for calculating buildup.

spectra(list)
Type:

Spectrum objects used with result to compute buildup.

label(str)
Type:

Peak label used to filter relevant parameters in result.

set_num_int_vals(result, spectra)

Sets buildup values from numerical integration.

result(list)
Type:

Intensity values

spectra(list)
Type:

Spectrum objects used with result to compute buildup.

label(str)
Type:

Peak label used to filter relevant parameters in result.