pemtk.fit._conv

Module Contents

Functions

pdConv(self[, fitVars, paramVars, dataRange, batches])

Basic conversion for set of fit results > Pandas, long format.

pdConvRef(self[, paramVars, outputIndex])

Convert reference params set to reference PD table.

pdConvSetFit(self, matE[, colDim])

Restack matE to pd.DataFrame and force to 1D.

pemtk.fit._conv.pdConv(self, fitVars=['success', 'chisqr', 'redchi'], paramVars=['value', 'stderr', 'vary', 'expr'], dataRange=None, batches=None)[source]

Basic conversion for set of fit results > Pandas, long format.

Extract fit and parameter results from lmFit objects and stack to PD dataframe.

Parameters:
  • fitVars (optional, list, default = ['success', 'chisqr', 'redchi']) – Values to extract from lmfit result object (per fit).

  • paramVars (optional, list, default = ['value', 'stderr', 'vary', 'expr']) – Values to extract from lmfit params object (per parameter per fit).

  • dataRange (optional, list, default = None) – Range of indexes to use, defaults to [0, self.fitInd].

  • batches (optional, int, default = None) – Additional batch of labelling for fits. - If int, label as ceil(fit #)/batches. E.g. batches = 100 will label fits per 100. - If list, use as labels per fit. (NOT YET IMPLEMENTED)

  • Todo

  • options (- Additional batching) –

  • case. (inc. by file for multiple read) –

  • 13/07/22 (Added type checking and casting, this seems to be an issue now/sometimes (PD version?) - currently defaulting all types to 'object' in testing, although was working previously!) –

pemtk.fit._conv.pdConvRef(self, paramVars=['value'], outputIndex=['Fit', 'Type', 'pn'])[source]

Convert reference params set to reference PD table.

Basic routine stripped from main pdConv() method for reuse elsewhere.

TODO: add flexibility here.

13/07/22: Added type checking and casting, this seems to be an issue now/sometimes (PD version?) - currently defaulting all types to ‘object’ in testing, although was working previously!

pemtk.fit._conv.pdConvSetFit(self, matE, colDim='it')[source]

Restack matE to pd.DataFrame and force to 1D.

Utility function for setting up fit parameter sets.