:py:mod:`pemtk.fit._util` ========================= .. py:module:: pemtk.fit._util Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: pemtk.fit._util.setClassArgs pemtk.fit._util.lmmuListStrReformat pemtk.fit._util._setDefaultFits pemtk.fit._util._getFitInds pemtk.fit._util.addColLevel pemtk.fit._util.renameParams pemtk.fit._util.renormMagnitudes pemtk.fit._util.phaseCorrection .. py:function:: setClassArgs(self, args) .. py:function:: lmmuListStrReformat(lmmuList) Convert list of tuple labels to short str format .. py:function:: _setDefaultFits(self, dataRange) .. py:function:: _getFitInds(self) Get fitInds = all numerical fit indexes, and fitInd = fitInds.max() .. py:function:: addColLevel(df, newCol='ref', names=['Dataset', 'Type']) Add top-level column to Pandas dataframe (crude) .. py:function:: renameParams(data, mapDict, mapNames=['lm'], mapType='col') Very basic column name reampper for Pandas DataFrame. Based on routine in SymHarm class. 21/04/22 v1 for testing only. TODO: generalise this & consolidate! See also value remapping in paramPlot() routine, runs data.replace({'Param':self.lmmu[remap]}, inplace=True) .. py:function:: renormMagnitudes(dfWide) Basic renormalisation of magnitudes so sum(mags**2) = 1 Prototype from test code: - Assumes full Pandas tabulated wide-form dataset as input. - Renormed values appended to input dataframe, as Type=n TODO: implement dim preservation? Currently handled by calling fn., and assumes Type=m is present in index. .. py:function:: phaseCorrection(dfWide, dfRef=None, refParam=None, wrapFlag=True, phaseLabel='p', absFlag=False) Phase correction/shift/wrap function. Prototype from test code: - Assumes full Pandas tabulated wide-form dataset as input. - Supply dfRef to use reference phase (abs phase values), otherwise will be relative with refParam set to zero. - wrapFlag: wrap to -pi:pi range? Default True. - absFlag: set abs values (drop signs)? Default False, otherwise sets all values to abs(). TODO: implement dim preservation? Currently handled by calling fn., and returned values will have Type dim dropped here. Setting "drop_level=False" to xs() would fix this. Stated to implement, but skipped for now.