h5analysis.MathData.Object1dFit

class h5analysis.MathData.Object1dFit

Bases: Load1d

Apply fit to 1d data

Methods

add()

This method is not defined

add_Constant(constant[, constant_bounds, ...])

Add Constant LMFit model

add_Exponential(decay, amplitude[, ...])

Add Exponential LMFit model

add_Gaussian(center, amplitude, sigma[, ...])

Add Gaussian LMFit model

add_Linear(slope, intercept[, slope_bounds, ...])

Add Linear LMFit model

add_Lorentzian(center, amplitude, sigma[, ...])

Add Lorentzian LMFit model

add_Polynomial(c1, c2, c3, c4, c5, c6, c7[, ...])

Add Polynomial LMFit model

add_Quadratic(a, b, c[, a_bounds, a_vary, ...])

Add Quadratic LMFit model

background()

This method is not defined

evaluate([lower_limit, upper_limit, fit])

Construct and evaluate composite LMFit model

export(filename[, split_files])

Export and write data to specified file.

exportWidgetStep()

Helper function for exporter widget.

exporter()

Interactive exporter widget.

fit_report()

Print the fit report

fit_values()

Return the best fit values as pandas DataFrame

get_data()

Make data available in memory as exported to file.

hline(pos, **kwargs)

Draw a horizontal line in the plot.

label(pos_x, pos_y, text, **kwargs)

Draw a text box in the plot.

load(obj, line, scan)

Loader for 1d object

loadObj()

This method is not defined

plot([linewidth, title, xlabel, ylabel, ...])

Plot all data assosciated with class instance/object.

plot_legend(pos)

Overwrite default legend position.

save_plot(fname, **kwargs)

Create a matplotlib plot window

show_fluorescence(element, siegbahn_symbol)

Draw a line in the plot for the requested fluorescence line.

stitch()

This method is not defined

subtract()

This method is not defined

vline(pos, **kwargs)

Draw a vertical line in the plot.

xlim(lower, upper)

Set x-axis limits applied to data stream.

ylim(lower, upper)

Set y-axis limits applied to data stream.

add()

This method is not defined

add_Constant(constant, constant_bounds=(None, None), constant_vary=True)

Add Constant LMFit model

Parameters:
  • constant (float) – y-value of the constant

  • constant_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • constant_vary (Boolean) – Specify whether the paramter is being fit

add_Exponential(decay, amplitude, decay_bounds=(None, None), decay_vary=True, amplitude_bounds=(None, None), amplitude_vary=True)

Add Exponential LMFit model

Parameters:
  • decay (float) – Decay parameter lambda in f(x) = A*e^(-x/lambda)

  • amplitude (float) – Amplitude paramter A in f(x) = A*e^(-x/lambda)

  • decay_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • decay_vary (Boolean) – Specify whether the paramter is being fit

  • amplitude_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • amplitude_vary (Boolean) – Specify whether the paramter is being fit

add_Gaussian(center, amplitude, sigma, center_bounds=(None, None), center_vary=True, amplitude_bounds=(None, None), amplitude_vary=True, sigma_bounds=(None, None), sigma_vary=True)

Add Gaussian LMFit model

Parameters:
  • center (float) – Center position of the Gaussian

  • amplitude (float) – Amplitude of the Gaussian

  • sigma (float) – The standard deviation of the Gaussian, note that FWHM = 2.355 * sigma

  • center_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • center_vary (Boolean) – Specify whether the paramter is being fit

  • amplitude_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • amplitude_vary (Boolean) – Specify whether the paramter is being fit

  • sigma_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • sigma_vary (Boolean) – Specify whether the paramter is being fit

add_Linear(slope, intercept, slope_bounds=(None, None), slope_vary=True, intercept_bounds=(None, None), intercept_vary=True)

Add Linear LMFit model

Parameters:
  • slope (float) – Slope of the linear function (m in f(x) = m*x + b)

  • intercept (float) – y-intercept (b in f(x) = m*x + b)

  • slope_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • slope_vary (Boolean) – Specify whether the paramter is being fit

  • intercept_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • intercept_vary (Boolean) – Specify whether the paramter is being fit

add_Lorentzian(center, amplitude, sigma, center_bounds=(None, None), center_vary=True, amplitude_bounds=(None, None), amplitude_vary=True, sigma_bounds=(None, None), sigma_vary=True)

Add Lorentzian LMFit model

Parameters:
  • center (float) – Center position of the Gaussian

  • amplitude (float) – Amplitude of the Gaussian

  • sigma (float) – The standard deviation of the Gaussian, note that FWHM = 2.355 * sigma

  • center_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • center_vary (Boolean) – Specify whether the paramter is being fit

  • amplitude_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • amplitude_vary (Boolean) – Specify whether the paramter is being fit

  • sigma_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • sigma_vary (Boolean) – Specify whether the paramter is being fit

add_Polynomial(c1, c2, c3, c4, c5, c6, c7, c1_bounds=(None, None), c1_vary=True, c2_bounds=(None, None), c2_vary=True, c3_bounds=(None, None), c3_vary=True, c4_bounds=(None, None), c4_vary=True, c5_bounds=(None, None), c5_vary=True, c6_bounds=(None, None), c6_vary=True, c7_bounds=(None, None), c7_vary=True)

Add Polynomial LMFit model

Parameters:
  • For 1<=i<=7

  • ci (float) – Parameter in f(x) = sum c_i*x^i

  • ci_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • ci_vary (Boolean) – Specify whether the paramter is being fit

add_Quadratic(a, b, c, a_bounds=(None, None), a_vary=True, b_bounds=(None, None), b_vary=True, c_bounds=(None, None), c_vary=True)

Add Quadratic LMFit model

Parameters:
  • a (float) – Parameter a in f(x) = a*x^2 + b*x + c

  • b (float) – Parameter b in f(x) = a*x^2 + b*x + c

  • c (float) – Parameter c in f(x) = a*x^2 + b*x + c

  • a_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • a_vary (Boolean) – Specify whether the paramter is being fit

  • b_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • b_vary (Boolean) – Specify whether the paramter is being fit

  • c_bounds (tuple) – Specify the lower and upper bounds of the parameter

  • c_vary (Boolean) – Specify whether the paramter is being fit

background()

This method is not defined

evaluate(lower_limit=None, upper_limit=None, fit='best')

Construct and evaluate composite LMFit model

Parameters:

kwargs

lower_limit: float, None

Lower boundary for the minimizer evaluation, ignored if set to None

upper_limit: float, None

Upper boundary for the minimizer evaluation, ignored if set to None

fit: string
Options:
  • ‘best’ - displays the best fit

  • ‘init’ - displays the initial components

  • ‘components’ - displays the best fit with the optimized components

export(filename, split_files=False)

Export and write data to specified file.

Parameters:
  • filename (string)

  • split_files (Boolean) – Sets whether scans are exported appended to one file (False), or separately (True)

exportWidgetStep()

Helper function for exporter widget.

exporter()

Interactive exporter widget.

fit_report()

Print the fit report

fit_values()

Return the best fit values as pandas DataFrame

get_data()

Make data available in memory as exported to file.

Returns:

  • dfT (pandas DataFrame) – All loaded data.

  • files (list) – List of all loaded files.

hline(pos, **kwargs)

Draw a horizontal line in the plot.

Parameters:
  • pos (float)

  • **kwargs (dict, optional) – See bokeh manual for available options.

label(pos_x, pos_y, text, **kwargs)

Draw a text box in the plot.

Parameters:
  • pos_x (float)

  • pos_y (float)

  • text (string)

  • **kwargs (dict, optional) – See bokeh manual for available options.

load(obj, line, scan)

Loader for 1d object

Parameters:
  • obj (object) – Loader object

  • line (int) – load, add, subtract line of object (indexing with 0)

  • scan (int) – number of the scan to be accessed

loadObj()

This method is not defined

plot(linewidth=4, title=None, xlabel=None, ylabel=None, ylabel_right=None, plot_height=450, plot_width=700, norm=False, waterfall=None, xprec=None, yprec=None, **kwargs)

Plot all data assosciated with class instance/object.

Parameters:
  • linewidth (int, optional)

  • title (string, optional)

  • xlabel (string, optional)

  • ylabel (string, optional)

  • ylabel_right (string, optional)

  • plot_height (int, optional)

  • plot_width (int, optional)

  • norm (boolean, optional) – Normalized plot output to [0,1]

  • waterfall (float) – Normalizes plot output to [0,1] and applies offset specified

  • xprec (int, optional) – Specifies the forced floating point X precision of the hover tool

  • yprec (int, optional) – Specifies the forced floating point Y precision of the hover tool

  • kwargs – all bokeh figure key-word arguments

plot_legend(pos)

Overwrite default legend position.

Parameters:

pos (string) – See bokeh manual for available options.

save_plot(fname, **kwargs)

Create a matplotlib plot window

fname: string

path and file name of the exported file

kwargs:
figsize: tuple

determines size of plot

x_minor_ticks: float

distance between minor ticks on primary axis

x_major_ticks: float

distance between major ticks on primary axis

y_minor_ticks: float

distance between minor ticks on secondary axis

y_major_ticks: float

distance between major ticks on secondary axis

top: Boolean

Display ticks on top of the plot

right: Boolean

Display ticks on the right of the plot

fontsize_axes: string or int

Set the fontsize of the axes ticks

fontsize_labels: string or int

Set fontsize of the axis labels

fontsize_title: string or int

Set fontsize of the title

title_pad: int

Padding between title and the top of the plot

xlabel: string

Label of the primary axis

ylabel: string

Label of the secondary axis

title: string

Title displayed at the top of the plot

xlim: tuple

Limits the visible x-range

ylim: tuple

Limits the visible y-range

legend: Boolean

Show/Hide plot legend

fontsize_legend: int

Fontsize of the legend entries

data_format: string, [pdf,svg,png]

Sets the output data format and matplotlib backend used

show_fluorescence(element, siegbahn_symbol, orientation='v', **kwargs)

Draw a line in the plot for the requested fluorescence line.

Parameters:
  • element (string) – IUPAC element abbreviation

  • siegbahn_symbol (string) – Siegbahn symbol for requested energy transition

  • orientation ([‘v’,’h’]) – Determines if a vertical or horizontal line is drawn

  • **kwargs (dict, optional) – See bokeh manual for available options.

stitch()

This method is not defined

subtract()

This method is not defined

vline(pos, **kwargs)

Draw a vertical line in the plot.

Parameters:
  • pos (float)

  • **kwargs (dict, optional) – See bokeh manual for available options.

xlim(lower, upper)

Set x-axis limits applied to data stream.

Parameters:
  • lower (float)

  • upper (float)

ylim(lower, upper)

Set y-axis limits applied to data stream.

Parameters:
  • lower (float)

  • upper (float)