grapa.datatypes.curveMCA.CurveMCA

class grapa.datatypes.curveMCA.CurveMCA(data, attributes, silent=False)

Bases: Curve

__init__(data, attributes, silent=False)

Methods

__init__(data, attributes[, silent])

addElementLabels(addrem, element, line[, ...])

Add labels for transition for a given element, according to the database https://xdb.lbl.gov/Section1/Table_1-3.pdf

alterListGUI()

Determines the possible curve visualisations.

channel_to_kev(channel)

fit(func, roi, p0, fixed)

fit_explicit(roi, *args[, funcname, ...])

Fit fit_explicit: fit data, for example a peak of a CurveMCA data.

fit_preset(preset_label[, roi, p0, fixed])

funcListGUI(**kwargs)

Fills in the Curve actions specific to the Curve type. Retuns a list, which elements are instances of FuncGUI, or (old style): ::.

kev_to_channel(kev)

peaks_data()

print_help()

Prints help for the Curve subclass, generated from docstrings.

updateFitParam(*param)

Update the curve y values of a fit curve.

x_kev(**kwargs)

Attributes

AXISLABELS_X

AXISLABELS_Y

CURVE

DEFAULTVALUES

DEFAULTVALUES_FILE

FITHANDLER

FITPARAMETERS_FILE

PEAKS_DATA

PEAKS_ELEMENTS

PEAKS_FILENAME

PEAKS_LINES

addElementLabels(addrem: str, element: str, line, multiplier=1, vlinebottom=0, **kwargs) bool

Add labels for transition for a given element, according to the database https://xdb.lbl.gov/Section1/Table_1-3.pdf

Parameters:
  • addrem – ‘add’, or ‘remove’ sets of lines.

  • element – str starting with element 2-letter, or numeric (Z number). Possible values: ‘Cu’, ‘Zn 30’, 25, etc.

  • line – ‘K’, ‘M, ‘L’, ‘all’

  • multiplier – multiplier to the tabulated peak intensity. Default 1.

  • vlinebottom – value at which the vertical line ends. Default 0.

Returns:

True if success, False otherwise

alterListGUI()

Determines the possible curve visualisations. One element has the form: AlterListItem(‘Label GUI’, [‘alter_x’, ‘alter_y’], ‘semilogx’, “print help doc”) By default only neutral (i.e. raw data) is provided

fit_explicit(roi, *args, funcname='', preset_label='', p0_raw=None, sum_amp_gaussian=None, **kwargs)

Fit fit_explicit: fit data, for example a peak of a CurveMCA data. Pre-set fit parameters are configured in file XRF_fitparameters.txt.

Parameters:
  • roi – range of interest, in unit of channel

  • funcname – name of the fit function. Mandatory (provided by GUI)

  • preset_label – label of the fit preset in the configuration file, if relevant (provided by GUI)

  • p0_raw – p0 values of the fit preset in configuration file, if relevant.

  • kwargs

    to provide custom initial guess p0. Weird syntax for grapa GUI.

    • Syntax 1: keywords “p0” and “fixed” are provided. Instances of list.

    • Syntax 2: to meet limitations of grapa GUI. Example: “0p0”: 1.0, “0fixed”: True (i.e. is fixed fit parameter), “1p0”: 2.1, etc. These are later compiled into lists: p0 and fixed

  • sum_amp_gaussian – how to compute to return “amplitude” value. Eg [0, 1] would compute as the sum of peak areas of gaussian peaks 0 and 1, accounting for definition of gaussians with fixed respective peak areas e.g. func_linbg_2gaussaratiodelta

Returns:

a CurveMCA fit curve

funcListGUI(**kwargs)

Fills in the Curve actions specific to the Curve type. Retuns a list, which elements are instances of FuncGUI, or (old style):

[func,
 'Button text',
 ['label 1', 'label 2', ...],
 ['value 1', 'value 2', ...],
 {'hiddenvar1': 'value1', ...}, (optional)
 [dictFieldAttributes, {}, ...]] (optional)

By default, returns quick modifs for offset and muloffset (if already set), and a help for some plot types (errorbar, scatter).

Parameters:

kwargs – this function should be called specifying kwargs[‘graph’] the graph self is embedded in, and kwargs[‘graph_i’] as position of self in graph.

print_help()

Prints help for the Curve subclass, generated from docstrings.

updateFitParam(*param)

Update the curve y values of a fit curve. Raise IncorrectInputError if problem with input.

Parameters:
  • param – the new parameters to consider for the fit formula. Will be placed into _popt.

  • func – if provided, will call func(…) instead of getattr(self, self.attr(“_fitfunc”))(…) Used for example in curveMCA for fit