Utility Functions

mrsimulator.utils.spectral_fitting.make_LMFIT_params(sim, post_sim=None, exclude_key=None)

Parses the Simulator and PostSimulator objects for a list of LMFIT parameters. The parameter name is generated using the following syntax:

sys_i_site_j_attribute1_attribute2

for spin system attribute with signature sys[i].sites[j].attribute1.attribute2

Parameters
  • sim – a Simulator object.

  • post_sim – a SignalProcessor object

Returns

LMFIT Parameters object.

mrsimulator.utils.spectral_fitting.LMFIT_min_function(params, sim, post_sim=None)

The simulation routine to calculate the vector difference between simulation and experiment based on the parameters update.

Parameters
  • params – Parameters object containing parameters to vary during minimization.

  • sim – Simulator object used in the simulation. Initialized with guess fitting parameters.

  • post_sim – PostSimulator object used in the simulation. Initialized with guess fitting parameters.

Returns

Array of the differences between the simulation and the experimental data.

mrsimulator.utils.get_spectral_dimensions(csdm_object)

Extract the count, spectral_width, and reference_offset parameters, associated with the spectral dimensions of the method, from the CSDM dimension objects.

Parameters

csdm_object – A CSDM object holding the measurement dataset.

Returns

A list of dict objects, where each dict containts the count, spectral_width, and reference_offset.