grapa.datatypes.curveXRD.CurveXRD

class grapa.datatypes.curveXRD.CurveXRD(data, attributes, silent=False)

Bases: Curve

CurveXRD offers almost no capabilities for peak fitting of XRD diffractograms.

The CurveXRD class was mostly to created to test whether it was easy to implement the generic fitting routine mechanisms. If you want to learn scientifically from your data, you should rather use a dedicated software.

__init__(data, attributes, silent=False)

Methods

__init__(data, attributes[, silent])

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

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

funcListGUI(**kwargs)

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

updateFitParam(*param)

Update the curve y values of a fit curve.

Attributes

CURVE

FITHANDLER

FITPARAMETERS_FILE

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

Fit fit_explicit: fit data, for example a peak of a CurveXRD data. Pre-set fit parameters are configured in file XRD_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

Returns:

a CurveXRD 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.

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