hqs_nmr.analysis.autoshift
Routines and tools for autoshifting the shifts.
Functions
|
Adapt Hamiltonian parameters to match experimental data via simulated annealing. |
|
Automatically find the optimal chemical shifts to match experimental data. |
|
Find the optimal chemical shifts to match experimental data via simulated annealing. |
|
Performs center-of-mass shift to match experimental data. |
Classes
Collection of the (for now) hardcoded parameters for the simulated annealing autoshift. |
|
Collection of the (for now) hardcoded parameters for the autoadjuster. |
|
Collection of the (for now) hardcoded parameters for the single peak matching autoshift. |
- class hqs_nmr.analysis.autoshift.HardcodedPeakMatchingAutoshiftParameters
Collection of the (for now) hardcoded parameters for the single peak matching autoshift.
- Fields:
- num_resampled_omegas: maximum number of frequencies used for the resampling of the
experimental spectrum.
- num_linear_omegas: number of frequencies to have linearly spaced in the range. Determines
the maximum frequency step in the resampling, i.e. frequency range / num_linear_omegas.
max_shift_h: maximum allowed shift for hydrogens. max_shift_exc: maximum allowed shift for exchangeable protons. identify_peaks_threshold: threshold for peak identification in the experimental spectrum. max_fwhm_scale: maximum allowed scaling for the FWHM adaptation, values larger than this
result in poor results when manually changing the green’s function broadening. The minimum allowed scaling is taken to be 1/max_fwhm_scale.
- threshold_cost_ratio: the ratio of the maximum cost value used to set the treshold of
accepted matches when matching single spin contributions.
- num_resampled_omegas: int = 5000
- num_linear_omegas: int = 500
- max_shift_h: float = 0.3
- max_shift_exc: float = 7
- identify_peaks_threshold: float = 0.02
- max_fwhm_scale: float = 1.5
- threshold_cost_ratio: float = 0.3333333333333333
- __init__() None
- class hqs_nmr.analysis.autoshift.HardcodedAnnealingAutoshiftParameters
Collection of the (for now) hardcoded parameters for the simulated annealing autoshift.
- Fields:
- num_resampled_omegas: maximum number of frequencies used for the resampling of the
experimental spectrum.
- num_linear_omegas: number of frequencies to have linearly spaced in the range. Determines
the maximum frequency step in the resampling, i.e. frequency range / num_linear_omegas.
- num_resampled_omegas: int = 5000
- num_linear_omegas: int = 1000
- __init__() None
- class hqs_nmr.analysis.autoshift.HardcodedAutoadjustParameters
Collection of the (for now) hardcoded parameters for the autoadjuster.
- num_linear_omegas: int = 200
- step_amplitude_jc_ratio: float = 0.0625
- step_amplitude_shifts_ratio: float = 0.041666666666666664
- step_amplitude_delta_eta_ratio: float = 0.16666666666666666
- __init__() None
- hqs_nmr.analysis.autoshift.autoshift_the_shifts(result_greens_function: NMRResultGreensFunction1D, experimental_spectrum: NMRSpectrum1DProtocol, exchangeable_protons: list[int] | None = None, debug: bool = False) tuple[NMRParameters, NMRCalculationParameters, NMRAutoshiftResult]
Automatically find the optimal chemical shifts to match experimental data.
This routine assumes the experimental data has been already phase corrected and that it is reasonably clean (e.g. no solvent/reference peaks).
- Parameters:
result_greens_function (NMRResultGreensFunction1D) – calculated green’s function.
experimental_spectrum (NMRSpectrum1DProtocol) – experimental spectrum to match.
exchangeable_protons (Optional[list[int]]) – indices of the exchangeable protons. The indices relate to the order of the isotopes in the isotope list of the greens function. Defaults to None, meaning no protons are considered exchangeable.
debug (bool) – debug mode to print intermediate results. Defaults to False.
- Returns:
- NMRParameters,
NMRCalculationParameters corresponding to the input result_greens_function with optimal chemical shifts and fwhm to best match the input experimental data, and NMRAutoshiftResult containing the changes applied to these.
- Return type:
tuple[NMRParameters, NMRCalculationParameters, NMRAutoshiftResult]
- hqs_nmr.analysis.autoshift.autoshift_the_shifts_annealing(result_greens_function: NMRResultGreensFunction1D, experimental_spectrum: NMRSpectrum1DProtocol, exchangeable_protons: list[int] | None = None, convergence_parameters: NMRAutoshiftAnnealingParams | None = None, debug: bool = False) tuple[NMRParameters, NMRCalculationParameters, NMRAutoshiftResult]
Find the optimal chemical shifts to match experimental data via simulated annealing.
This routine assumes the experimental data has been reasonably cleaned (e.g. no solvent or reference peaks).
The routine first performs the center of mass shift, broadening adaptation and single peak matching to get the best guess possible at the cheapest cost. Subsequently, while the shifts found so far are fixed, a series of simulated annealing searches is performed with decreasing artificial broadening applied to the experimental and simulated spectra, as to smoothen the loss function and make the exploration of its hypersurface easier. How many artificial broadenings are used and how much exploration is allowed (controlled via temperature and cooling schedule) determine both runtime and accuracy of the method.
- Parameters:
result_greens_function (NMRResultGreensFunction1D) – calculated green’s function.
experimental_spectrum (NMRSpectrum1DProtocol) – experimental spectrum to match.
debug (bool) – debug mode to print intermediate results. Defaults to False.
exchangeable_protons (Optional[list[int]]) – indices of the exchangeable protons. The indices relate to the order of the isotopes in the isotope list of the greens function. Defaults to None, meaning no protons are considered exchangeable.
convergence_parameters (Optional[NMRAutoshiftAnnealingParams]) – convergence parameters for the multiscale simulated annealing run. None results in some default parameters to be loaded.
- Returns:
- NMRParameters,
NMRCalculationParameters corresponding to the input result_greens_function with optimal chemical shifts and fwhm to best match the input experimental data, and NMRAutoshiftResult containing the changes applied to these.
- Return type:
tuple[NMRParameters, NMRCalculationParameters, NMRAutoshiftResult]
- hqs_nmr.analysis.autoshift.autoadjust(result_greens_function: NMRResultGreensFunction1D, experimental_spectrum: NMRSpectrum1DProtocol, run_parameters: NMRAutoadjustParams, debug: bool = False) tuple[NMRParameters, NMRCalculationParameters, NMRAutoadjustResult]
Adapt Hamiltonian parameters to match experimental data via simulated annealing.
Local shifts, the selected j-coupling and the global fwhm are optimized. This routine assumes the experimental data has been reasonably cleaned (e.g. no solvent or reference peaks). Moreover, the input Green’s function is assumed to be pre-aligned with the spectrum, i.e. the autoshift routine or manual adaption has already been applied.
- Parameters:
result_greens_function (NMRResultGreensFunction1D) – calculated green’s function.
experimental_spectrum (NMRSpectrum1DProtocol) – experimental spectrum to match.
debug (bool) – debug mode to print intermediate results. Defaults to False.
run_parameters (NMRAutoadjustParams) – parameters for the autoadjust run.
- Returns:
- NMRParameters,
NMRCalculationParameters corresponding to the input result_greens_function with optimal chemical shifts and adjusted j-coupling to best match the input experimental data, and NMRAutoadjustResult containing the changes applied to these.
- Return type:
tuple[NMRParameters, NMRCalculationParameters, NMRAutoadjustResult]
- hqs_nmr.analysis.autoshift.autoshift_the_shifts_cms(result_greens_function: NMRResultGreensFunction1D, experimental_spectrum: NMRSpectrum1DProtocol, debug: bool = False) tuple[NMRParameters, NMRCalculationParameters, NMRAutoshiftResult]
Performs center-of-mass shift to match experimental data.
- Parameters:
result_greens_function (NMRResultGreensFunction1D) – calculated green’s function.
experimental_spectrum (NMRSpectrum1DProtocol) – experimental spectrum to match.
debug (bool) – debug mode to print intermediate results. Defaults to False.
- Returns:
- NMRParameters,
NMRCalculationParameters corresponding to the input result_greens_function with optimal chemical shifts and fwhm to best match the input experimental data, and NMRAutoshiftResult containing the changes applied to these.
- Return type:
tuple[NMRParameters, NMRCalculationParameters, NMRAutoshiftResult]