hqs_qorrelator_app.post_processing

Collection of post-processing functions for the experimental NMR helpers.

Functions

windowing(signal, time_axis[, lambda_hz, ...])

Apply hybrid windowing to signal: exponential damping + cosine taper.

zero_padding(signal, time_axis[, ...])

Apply padding (zeroes) to the signal.

hqs_qorrelator_app.post_processing.windowing(signal: ndarray, time_axis: ndarray, lambda_hz: float | None = None, t_c_fraction: float = 0.9) → ndarray[source]

Apply hybrid windowing to signal: exponential damping + cosine taper.

Parameters:
  • signal (np.ndarray) -- Signal to pad for smoothening.

  • time_axis (np.ndarray) -- Time values in seconds

  • lambda_hz (float) -- Exponential damping parameter -> trial and error until correct one is found OR make a MatPlotLib slider. If decay is too small we will see strange oscillations in spectrum, which shouldn't be there. That's a sign that the decay wasn't strong enough and then when the cosine kicks in, the time-signal sharply drops, leading to oscillations in frequency space at the rate of the cosine oscillation. Check that where the cosine kicks in we don't have a strong drop-off in the time domain. Note: Want lambda to be equal to the width of the broadest peak in the spectrum.

  • t_c_fraction (float) -- Fraction of T_max where cosine taper starts (should be between 0 and 1).

Returns:

Windowed signal

Return type:

np.ndarray

Raises:

ValueError -- The value for t_c_fraction needs to be in [0, 1].

hqs_qorrelator_app.post_processing.zero_padding(signal: ndarray, time_axis: ndarray, extension_factor: int | None = None) → tuple[ndarray, ndarray][source]

Apply padding (zeroes) to the signal.

This ensures the later correlation functions look smoother. Note that this function also returns the modified time axis, as the shape of the signal and time axis needs to match.

Parameters:
  • signal (np.ndarray) -- Signal to pad for smoothening.

  • time_axis (np.ndarray) -- Time values in seconds

  • extension_factor (int | None) -- by how many times to extend the time and signal arrays.

Returns:

padded signal and time axis.

Return type:

tuple(np.ndarray, np.ndarray)