hqs_nmr.postprocessing
NMR spectra postprocessing routines.
Functions
Adapt a spectrum with respect to a shift in a J-coupling. |
|
|
Create a new molecular NMR parameter representation, with adapted shifts. |
|
Fit spline to real or complex vector function. |
|
Calculate a spline fit of a Green's function after rediscretizing the frequencies. |
Determine all parameters needed to adapt a Green's function with respect to some J-coupling. |
|
Calculate the Green's function and all parameters needed to perform a J-coupling adaptation. |
|
|
Prepare splines and rediscretized frequency points for shifting the shifts. |
|
Rediscretize the frequency range for the spline fits. |
|
Shift Green's function using spline fit. |
- hqs_nmr.postprocessing.adapt_spectrum_by_j_coupling(delta_j_coupling: float, rediscretized_omegas_rad_per_s: ndarray, rediscretized_omegas_ppm: ndarray, broadening_rad_per_s: float, sz_terms_rad_per_s: ndarray, greens_function: ndarray, eom_greens_function: ndarray, eom_correction_greens_function: ndarray) ndarray
Adapt a spectrum with respect to a shift in a J-coupling.
Which J-coupling is shifted depends on the EOM correction Green’s function.
- Args.:
delta_j_coupling: Shift of the J-coupling. rediscretized_omegas_rad_per_s: Rediscretized frequency range in rad per s. rediscretized_omegas_ppm: Rediscretized frequency range in ppm. broadening_rad_per_s: Artificial broadening (half of the fwhm) in rad per s. sz_terms_rad_per_s: Array with the coefficients of the I^z terms in the Hamiltonian. greens_function: The values of the Green’s function to be adapted. eom_greens_function: The values of the EOM Green’s function associated with the standard
Green’s function.
eom_correction_greens_function: The values of the EOM correction Green’s function.
- Returns:
The normalized green’s function values with the adapted J-coupling taken into account.
- hqs_nmr.postprocessing.create_new_molecule(molecule_parms: NMRParameters, shifts_of_Jz_ppm: ndarray) NMRParameters
Create a new molecular NMR parameter representation, with adapted shifts.
- Parameters:
molecule_parms – Molecular NMR parameters that should be adapted.
shifts_of_Jz_ppm – Shifts of the magnetic shifts in ppm.
- Returns:
Molecular NMR parameters with the adapted shifts.
- hqs_nmr.postprocessing.fit_spline_to_vector_function(parameters: ndarray, vector_function: ndarray) list[CubicSpline] | tuple[list[CubicSpline], list[CubicSpline]]
Fit spline to real or complex vector function.
- Parameters:
parameters – Parameters at which the vector function was evaluated.
vector_function – Values of the vector function.
- Returns:
If the vector function is real, it returns one list with a spline associated with each vector function entry, otherwise it returns one list for the real and one for the complex part.
- hqs_nmr.postprocessing.get_fitted_greens_function(greens_function: NMRGreensFunction1D, num_omegas_spline: int = 2000, offset: float = 1e-12) tuple[ndarray, ndarray]
Calculate a spline fit of a Green’s function after rediscretizing the frequencies.
- Args.:
greens_function: Green’s function to fit. num_omegas_spline: Number of frequency points added to the rediscretized.
frequencies. Defaults to 2000.
- offset: Small factor to avoid division by zero when fitting the Green’s function.
Defaults to 1e-12.
- Returns:
Rediscretized frequency range and fitted Green’s function.
- hqs_nmr.postprocessing.j_coupling_adaptation_parameters(result_greens_function: NMRResultGreensFunction1D, result_eom_greens_function: NMRResultGreensFunction1D, result_eom_correction_greens_function: NMRResultGreensFunction1D) dict[str, Any]
Determine all parameters needed to adapt a Green’s function with respect to some J-coupling.
Note that all Green’s functions used here should be non normalized.
- Args.:
result_greens_function: Green’s function that should be adapted. result_eom_greens_function: EOM Green’s function associated with the standard NMR Green’s
function.
- result_eom_correction_greens_function: EOM Green’s function to correct the standard NMR
Green’s function
- Returns:
A dictionary with all necessary parameters.
- hqs_nmr.postprocessing.prepare_j_coupling_adaptation(molecule_parms: NMRParameters, calculation_parms: NMRCalculationParameters, adaptation_indices: tuple[int, int] | list[tuple[int, int]]) tuple[NMRResultGreensFunction1D, dict[str, Any]]
Calculate the Green’s function and all parameters needed to perform a J-coupling adaptation.
- Args.:
molecule_parms: The NMR parameters of the molecule, which should be adapted. calculation_parms: The NMR calculation parameters as defined for a standard NMR Green’s
function calculation.
- adaptation_indices: Tuple or list of tuple of all J-coupling which are supposed to be
adapted at once.
- Returns:
The result of a standard Green’s function calculation using the input parameters and a dictionary with all necessary parameters to perform a J-coupling adaptation.
- hqs_nmr.postprocessing.prepare_shifting(greens_function: NMRGreensFunction1D, num_omegas_spline: int = 2000, offset: float = 1e-12) tuple[ndarray, list[CubicSpline], list[CubicSpline]]
Prepare splines and rediscretized frequency points for shifting the shifts.
- Parameters:
greens_function – Green’s function calculated using hqs_nmr.
num_omegas_spline – Number of frequency points added to the rediscretized.
2000. (frequencies. Defaults to)
offset – Small factor to avoid division by zero. Defaults to 1e-12.
- Returns:
Original omegas with added linear discretization in ppm. splines_real: List with splines fitting the real part entries of the Green’s function. splines_complex: List with splines fitting the imaginary part entries of the Green’s function.
- Return type:
rediscretized_omegas_ppm
- hqs_nmr.postprocessing.rediscretize_frequency_range(omegas_ppm: ndarray, num_omegas_spline: int = 2000) ndarray
Rediscretize the frequency range for the spline fits.
Add an additional linear discretization to the current distribution.
- Parameters:
omegas_ppm – Frequency discretization without the linear discretization.
num_omegas_spline – Minimal number of points in the linear discretization.
- Returns.:
Vector with new discretization.
- hqs_nmr.postprocessing.shift_greens_function(shifts: ndarray, greens_function: NMRGreensFunction1D, rediscretized_omegas_ppm: ndarray, splines_real: list[CubicSpline], splines_imag: list[CubicSpline], number_relevant_spins: int) NMRSpectrum1D
Shift Green’s function using spline fit.
- Parameters:
shifts – The shifts of the magnetic shifts.
greens_function – Green’s function that is supposed to be shifted.
rediscretized_omegas_ppm – Rediscretized frequency points in ppm.
splines_real – Splines for the real part of the Green’s function.
splines_imag – Splines for the imaginary part of the Green’s function.
number_relevant_spins – Number of times the homo-isotope appears in the molecule.
- Returns:
Normalized and shifted spectrum.