satlas.models.hfsmodel.HFSModel

class satlas.models.hfsmodel.HFSModel(I, J, ABC, centroid, fwhm=[50.0, 50.0], scale=1.0, background_params=[0.001], shape='voigt', use_racah=False, use_saturation=False, saturation=0.001, shared_fwhm=True, sidepeak_params={'Offset': 0, 'N': 0, 'Poisson': 0.68}, crystalballparams={'Taillocation': 1, 'Tailamplitude': 1}, pseudovoigtparams={'Eta': 0.5, 'A': 0}, asymmetryparams={'a': 0})[source]

Constructs a HFS spectrum, consisting of different peaks described by a certain profile. The number of peaks is governed by the nuclear spin and the atomic spins of the levels.

__init__(I, J, ABC, centroid, fwhm=[50.0, 50.0], scale=1.0, background_params=[0.001], shape='voigt', use_racah=False, use_saturation=False, saturation=0.001, shared_fwhm=True, sidepeak_params={'Offset': 0, 'N': 0, 'Poisson': 0.68}, crystalballparams={'Taillocation': 1, 'Tailamplitude': 1}, pseudovoigtparams={'Eta': 0.5, 'A': 0}, asymmetryparams={'a': 0})[source]

Builds the HFS with the given atomic and nuclear information.

Parameters:
  • I (float) – The nuclear spin.
  • J (list of 2 floats) – The spins of the fine structure levels.
  • ABC (list of 6 floats) – The hyperfine structure constants A, B and C for ground- and excited fine level. The list should be given as [A lower, A upper, B lower, B upper, C upper, C lower].
  • centroid (float) – Centroid of the spectrum.
Other Parameters:
 
  • fwhm (float or list of 2 floats, optional) – Depending on the used shape, the FWHM is defined by one or two floats. Defaults to [50.0, 50.0]

  • scale (float, optional) – Sets the strength of the spectrum, defaults to 1.0. Comparable to the amplitude of the spectrum.

  • background_params (list of float, optional) – Sets the coefficients of the polynomial background to the given values. Order of polynomial is equal to the number of parameters given minus one. Highest order coefficient is the first element, etc.

  • shape (string, optional) – Sets the transition shape. String is converted to lowercase. For possible values, see HFSModel__shapes__.keys()`. Defaults to Voigt if an incorrect value is supplied.

  • use_racah (boolean, optional) – If True, fixes the relative peak intensities to the Racah intensities. Otherwise, gives them equal intensities and allows them to vary during fitting.

  • use_saturation (boolean, optional) – If True, uses the saturation parameter to calculate relative intensities.

  • saturation (float, optional) – If different than 0, calculate the saturation effect on the intensity of transition intensity. This is done by an exponential transition between Racah intensities and the saturated intensities.

  • shared_fwhm (boolean, optional) – If True, the same FWHM is used for all peaks. Otherwise, give them all the same initial FWHM and let them vary during the fitting.

  • sidepeak_params (dict) – A dictionary with the following keys and values:

    n: int

    Sets the number of sidepeaks that are present in the spectrum. Defaults to 0.

    poisson: float

    Sets the relative intensity of the first side peak. The intensity of the other sidepeaks is calculated from the Poisson-factor.

    offset: float

    Sets the distance (in MHz) of each sidepeak in the spectrum.

  • crystalballparams (dict) – A dictionary with the following keys and values:

    tailamp: float

    Sets the relative amplitude of the tail for the Crystalball shape function.

    tailloc: float

    Sets the location of the tail for the Crystalball shape function.

  • pseudovoigtparams (dict) – A dictionary with the following keys and values:

    Eta: float between 0 and 1

    Describes the mixing percentage of the Gaussian and Lorentzian shapes

    A: float

    Describes the asymmetry of the peak.

Note

The list of parameter keys is:
  • FWHM (only for profiles with one float for the FWHM)
  • FWHMG (only for profiles with two floats for the FWHM)
  • FWHML (only for profiles with two floats for the FWHM)
  • Al
  • Au
  • Bl
  • Bu
  • Cl
  • Cu
  • Centroid
  • Background
  • Poisson (only if the attribute n is greater than 0)
  • Offset (only if the attribute n is greater than 0)
  • Amp (with the correct labeling of the transition)
  • scale
__call__(x)[source]

Get the response for frequency x (in MHz) of the spectrum.

Parameters:x (float or array_like) – Frequency in MHz
Returns:Response of the spectrum for each value of x.
Return type:float or NumPy array

Methods

__init__(I, J, ABC, centroid[, fwhm, scale, ...]) Builds the HFS with the given atomic and nuclear information.
__call__(x) Get the response for frequency x (in MHz) of the spectrum.
display_chisquare_fit([scaled]) Display all relevent info of the least-squares fitting routine, if this has been performed.
display_mle_fit([scaled]) Give a readable overview of the result of the MLE fitting routine.
fix_ratio(value[, target, parameter]) Fixes the ratio for a given hyperfine parameter to the given value.
get_chisquare_mapping()
get_lnprior_mapping(params)
get_result([selection]) Return the variable names, values and estimated error bars for the parameters as seperate lists.
get_result_dict([method, scaled]) Returns the fitted parameters in a dictionary of the form {name: [value, uncertainty]}.
get_result_frame([method, selected, bounds, ...]) Returns the data from the fit in a pandas DataFrame.
plot([x, y, yerr, no_of_points, ax, show, ...]) Plot the hfs, possibly on top of experimental data.
plot_scheme([show, upper_color, ...]) Create a figure where both the splitting of the upper and lower state is drawn, and the hfs associated with this.
plot_spectroscopic(\*\*kwargs) Plots the hfs on top of experimental data with errorbar given by the square root of the data.
save(path) Saves the current spectrum, including the results of the fitting and the parameters, to the specified file.
seperate_response(x) Wraps the output of the __call__ in a list, for ease of coding in the fitting routines.
set_boundaries(boundaryDict) Sets the boundaries of the fitparameters as supplied in the dictionary.
set_chisquare_mapping(mappingDict) Sets the prior mapping for the different parameters.
set_expr(exprDict) Sets the expression of the selected parameters to the given expressions.
set_literature_values(literatureDict) Sets the lnprior and chisquare mapping to handle the given literature values and uncertainties.
set_lnprior_mapping(mappingDict) Sets the prior mapping for the different parameters.
set_value(valueDict) Sets the value of the given parameters to the given values.
set_variation(varyDict) Sets the variation of the fitparameters as supplied in the dictionary.

Attributes

ftof List of transition labels, of the form Flow__Fhigh (half-integers have an underscore instead of a division sign), same ordering as given by the attribute locations.
locations Contains the locations of the peaks.
params Instance of lmfit.Parameters object characterizing the shape of the HFS.
HFSModel.roi
use_racah Boolean to set the behaviour to Racah intensities (True) or to individual amplitudes (False).
use_saturation Boolean to set the behaviour to the saturation model (True) or not (False).