fitpy.fitpy module

General data fitting facilities.

In order to interpret an EPR spectrum fitting the spectrum can be helpful.

class fitpy.fitpy.FitOpt[source]

Bases: object

Include all necessary fitting options attributes.

The fitpy.fitpy.FitOpt class concerns the fitting options.

thetaofflist

List containing the offset angles in degree with respect to theta for every fitted dataset.

weightlist

List containing the weighting of the datasets.

maxiterint

Number of maximum iterations per sampling point. Default is 100.

nLHSint

Number of Latin hypercube samplings (LHS). Default is 10.

algorithmstr

Algorithm used to fit the spectrum.

Possible values: Nelder-Mead, TRF

Default is Nelder-Mead.

outputfilenamestr, optional

Filename of the output file.

normalisestr, optional

Specifies whether the area or the maximum is to be normalised. Default is area.

Possible values: area, maximum

class fitpy.fitpy.FitPy(y_data=None, sys=None, vary=None, exp=None, opt=None, fit_opt=<fitpy.fitpy.FitOpt object>, fitting_routine=None, input_dict=None)[source]

Bases: object

General fitting facilities.

spc: numpy.ndarray

y_data

xdata: numpy.ndarray

x_data

syslist

List of spin system definitions

exp{list, fitpy.fitpy.Exp}

Either a list of objects of the fitpy.fitpy.Exp or only an object of the fitpy.fitpy.Exp depending on whether one or several datasets will be fitted.

optfitpy.fitpy.Opt

All necessary simulation options.

varylist

List with whatever

fit_optfitpy.fitpy.FitOpt

all necessary fitting options

fitting_routinestr

Most probably the name of the simulation routine to be used

Therefore, it seems to be a misnomer…

result

Whatever type, but somehow the result of the fitting process…

Parameters
  • y_datanumpy.ndarray Array containing the y data.

  • syslist List consisting of one or more objects of the fitpy.fitpy.Sys class depending on the number of species to be fitted.

  • varylist List consisting of one or more dictionaries with the fitting parameters to vary depending on the number of species to be fitted.

  • exp – {list, fitpy.fitpy.Exp} Either a list of objects of the fitpy.fitpy.Exp or only an object of the fitpy.fitpy.Exp depending on whether one or several datasets will be fitted.

  • optfitpy.fitpy.Opt Object of the fitpy.fitpy.Opt class containing all necessary simulation options.

  • fit_optfitpy.fitpy.FitOpt Object of the fitpy.fitpy.FitOpt class containing all necessary fitting options.

  • input_dictdict Dictionary containing all input parameters.

fit()[source]

Perform the actual fitting.

_split_results_vector()[source]
_infer_number_of_datasets()[source]
_check_vary_values()[source]
_create_zero_arrays()[source]
_calculate_auto_weights()[source]
_set_weights()[source]
_concatenate()[source]
static _normalise(data, norm='area')[source]
_make_copy()[source]
_create_initvec()[source]
_create_boundaries()[source]
_init_lhs()[source]
_collect_args2pass()[source]
_iterate_fit()[source]
_create_initvec_tmp(fit)[source]
_fit_spc()[source]
static _objective_function(result, dim, xdata, spc, exp_points, exp_range, exp_mwfreq, sys_tmp, opt_tmp, vary, lower_bound, upper_bound, fit_opt, fitting_routine_object)[source]
_set_parameters()[source]
static _kernel_function_interface(args, *res)[source]
static _kernel_function(args, *res)[source]
_get_fitting_routine()[source]
static _vector_to_class(sys, opt, vary, result_as_array, lower_bound, upper_bound)[source]
_normalise_populations()[source]
static _create_result_dict(sys, opt, vary)[source]
_make_output_file()[source]
_get_current_date()[source]