hqs_nmr.analysis.mixtures
Functionality for the mixture analysis.
- class hqs_nmr.analysis.mixtures.FindRatioOptions(*, repeats: int = 2, pre_optimizations: int = 1, max_shift_deviation: float = 0.1, verbose: bool = False)
Options for the find_ratio function.
- repeats: int = 2
The number of optimizations cycles.
- pre_optimizations: int = 1
Number of preliminary optimization cycles.
- max_shift_deviation: float = 0.1
The maximum shift deviation that is allowed during model fitting.
- verbose: bool = False
Whether the method should print diagnostic messages.
- __init__(*, repeats: int = 2, pre_optimizations: int = 1, max_shift_deviation: float = 0.1, verbose: bool = False) None
- class hqs_nmr.analysis.mixtures.FindRatioResult(*, ratio: np.ndarray, fitted_nmr_parameters: list[NMRParameters], fitted_mixture: SimpleSpectrum1D, fitted_components: list[SimpleSpectrum1D])
Result of the find_ratio function.
- ratio: np.ndarray
The molar ratio of the components.
- fitted_nmr_parameters: list[NMRParameters]
The fitted parameters of the components.
- fitted_mixture: SimpleSpectrum1D
The spectrum of the fitted model.
- fitted_components: list[SimpleSpectrum1D]
The spectrum of the individual components of the fitted model.
- __init__(*, ratio: np.ndarray, fitted_nmr_parameters: list[NMRParameters], fitted_mixture: SimpleSpectrum1D, fitted_components: list[SimpleSpectrum1D]) None
- class hqs_nmr.analysis.mixtures.SimpleSpectrum1D(omegas_ppm: np.ndarray, intensity: np.ndarray)
Storage for the sampling of a spectrum.
Adheres to the NMRSpectrum1DProtocol.
Create new instance of SimpleSpectrum1D(omegas_ppm, intensity)
- omegas_ppm: ndarray
The frequency sampling points.
- intensity: ndarray
The signal intensity corresponding to the sampling points.
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {}
- _fields = ('omegas_ppm', 'intensity')
- classmethod _make(iterable)
Make a new SimpleSpectrum1D object from a sequence or iterable
- _replace(**kwds)
Return a new SimpleSpectrum1D object replacing specified fields with new values
- count(value, /)
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
- hqs_nmr.analysis.mixtures.find_ratio(mixture: NMRSpectrum1DProtocol, components: Sequence[NMRParameters | MolecularData], calculation_parameters: NMRCalculationParameters, *, drop_spin_indices: Sequence[Sequence[int] | None] | None = None, options: FindRatioOptions = FindRatioOptions(repeats=2, pre_optimizations=1, max_shift_deviation=0.1, verbose=False)) FindRatioResult
Determine the molar ratio of the components in a given mixture.
- Parameters:
mixture (NMRSpectrum1DProtocol) – The spectrum of the mixture.
components (Sequence[NMRParameters]) – The NMR parameters of the components of the mixture. All components need to be known.
calculation_parameters (NMRCalculationParameters) – The calculation parameters for the computation.
drop_spin_indices (Sequence[Sequence[int] | None] | None) –
List of indices per component that will be dropped after the computation.
This argument can be used to remove parts from the computed mixture that is compared to the experimental mixture. This is useful when there are parts of the spectrum that cannot be reliably matched to the computational result, e.g., exchangable protons. These parts need to be manually removed from the experimental spectrum and the corresponding spin contributions must then be removed via this argument.
options – (FindRatioOptions): The options for influencing the behavior of the function.