:py:mod:`pemtk.fit._aggUtil` ============================ .. py:module:: pemtk.fit._aggUtil Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: pemtk.fit._aggUtil.setAggCompData pemtk.fit._aggUtil.setAggMatE pemtk.fit._aggUtil.aggToXR .. py:function:: setAggCompData(dataIn, keys={'comp': ['m', 'p'], 'compC': ['n', 'pc']}) Set complex forms for aggregate results from [mag,phase] columns. :param data: Data to convert. :type data: pd.dataframe :param keys: Dict of keys for output, and [mag,phase] columns to convert. :type keys: dict, optional, default = {'comp':['m','p'],'compC':['n','pc']} :param TODO: :type TODO: generalise further? .. py:function:: setAggMatE(self, key='agg', dataOut=None, compDataLabels={'comp': ['m', 'p'], 'compC': ['n', 'pc']}, simpleForm=False, dropLabelsList=['Cont', 'Targ', 'Total', 'mu', 'it'], dropLevelsList=['Targ', 'Total', 'it']) Set aggregate results to matE format (Pandas) If key='ref' use self.data[self.subKey]['matE'] instead of aggregate data 18/07/22 - quickly hacked in ref data case for consistent results tabulations, probably already have this stuff elsewhere. See also pemtk.fit._conv.pdConvRef() and self.setMatEFit() .. py:function:: aggToXR(self, key='agg', cols={'comp': ['m', 'p'], 'compC': ['n', 'pc']}, EkeList=[1.1], dType='matE', conformDims=True, refKey=None, returnType='ds', simpleForm=False) Pull columns from PD dataframe & stack to XR dataset. cols : dict, optional, default = {'comp':['m','p'],'compC':['n','pc']} Dict of keys for output items/columns, and [mag,phase] columns to convert. TODO: - EkeList from input data subset? - Use existing routines for more flexible dim handling? E.g. pemtk.sym._util.toePSproc - More returnTypes, currently set for single dataset or set of arrays (per col) UPDATE 19/07/22 - implemented ep.misc.restack(), which includes dim checking and expansions. Set `conformDims` True/False for the latter. Eke dim still handled separately here. NOTE: conformDims=False with refKey only works reliably for da return type, otherwise may fail at dataset stacking.