nqrduck_spectrometer.measurement#

This module defines the measurement data structure and the fit class for measurement data.

Classes

Fit(name, domain, measurement)

The fit class for measurement data.

LorentzianFit(measurement[, name])

Lorentzian fit for measurement data.

Measurement(name, tdx, tdy, target_frequency)

This class defines how measurement data should look.

T2StarFit(measurement[, name])

T2* fit for measurement data.

class nqrduck_spectrometer.measurement.Fit(name: str, domain: str, measurement: Measurement)#

The fit class for measurement data. A fit can be performed on either the frequency or time domain data.

A measurement can have multiple fits.

fit() None#

Fits the measurement data and sets the fit parameters and covariance.

fit_function(x: array, *parameters) array#

The fit function.

Parameters:
  • x (np.array) – The x data.

  • *parameters – The fit parameters.

Returns:

The y data.

Return type:

np.array

classmethod from_json(data: dict, measurement: Measurement) Fit#

Converts the JSON format to a fit.

Parameters:
  • data (dict) – The fit in JSON-compatible format.

  • measurement (Measurement) – The measurement.

Returns:

The fit.

Return type:

Fit

initial_guess() list#

Initial guess for the fit.

Returns:

The initial guess.

Return type:

list

to_json() dict#

Converts the fit to a JSON-compatible format.

Returns:

The fit in JSON-compatible format.

Return type:

dict

property x: array#

The x data of the fit.

property y: array#

The y data of the fit.

class nqrduck_spectrometer.measurement.LorentzianFit(measurement: Measurement, name: str = 'Lorentzian')#

Lorentzian fit for measurement data.

fit() None#

Fits the measurement data and sets the fit parameters and covariance.

fit_function(f: array, S0: float, T2Star: float) array#

The Lorentzian fit function used for curve fitting.

initial_guess() list#

Initial guess for the Lorentzian fit.

class nqrduck_spectrometer.measurement.Measurement(name: str, tdx: array, tdy: array, target_frequency: float, frequency_shift: float = 0, IF_frequency: float = 0)#

This class defines how measurement data should look.

It includes pulse parameters necessary for further signal processing. Every spectrometer should adhere to this data structure in order to be compatible with the rest of the nqrduck.

Parameters:
  • name (str) – Name of the measurement.

  • tdx (np.array) – Time axis for the x axis of the measurement data.

  • tdy (np.array) – Time axis for the y axis of the measurement data.

  • target_frequency (float) – Target frequency of the measurement.

  • frequency_shift (float, optional) – Frequency shift of the measurement. Defaults to 0.

  • IF_frequency (float, optional) – Intermediate frequency of the measurement. Defaults to 0.

tdx#

Time axis for the x axis of the measurement data.

Type:

np.array

tdy#

Time axis for the y axis of the measurement data.

Type:

np.array

target_frequency#

Target frequency of the measurement.

Type:

float

frequency_shift#

Frequency shift of the measurement.

Type:

float

IF_frequency#

Intermediate frequency of the measurement.

Type:

float

fdx#

Frequency axis for the x axis of the measurement data.

Type:

np.array

fdy#

Frequency axis for the y axis of the measurement data.

Type:

np.array

add_fit(fit: Fit) None#

Adds a fit to the measurement.

Parameters:

fit (Fit) – The fit to add.

apodization(function: Function) Measurement#

Applies apodization to the measurement data.

Parameters:

function (Function) – Apodization function.

Returns:

The apodized measurement.

Return type:

Measurement

delete_fit(fit: Fit) None#

Deletes a fit from the measurement.

Parameters:

fit (Fit) – The fit to delete.

edit_fit_name(fit: Fit, name: str) None#

Edits the name of a fit.

Parameters:
  • fit (Fit) – The fit to edit.

  • name (str) – The new name.

property fdx: array#

Frequency domain data for the measurement (x).

property fdy: array#

Frequency domain data for the measurement (y).

property fits: list#

Fits of the measurement.

classmethod from_json(json: dict) Measurement#

Converts the JSON format to a measurement.

Parameters:

json (dict) – The measurement in JSON-compatible format.

Returns:

The measurement.

Return type:

Measurement

property name: str#

Name of the measurement.

property target_frequency: float#

Target frequency of the measurement.

property tdx: array#

Time domain data for the measurement (x).

property tdy: array#

Time domain data for the measurement (y).

to_json() dict#

Converts the measurement to a JSON-compatible format.

Returns:

The measurement in JSON-compatible format.

Return type:

dict

class nqrduck_spectrometer.measurement.T2StarFit(measurement: Measurement, name: str = 'T2*')#

T2* fit for measurement data.

fit() None#

Fits the measurement data and sets the fit parameters and covariance.

fit_function(t: array, S0: float, T2Star: float) array#

The T2* fit function used for curve fitting.

initial_guess() list#

Initial guess for the T2* fit.