def detCrossCal(df,var,baseDet='UB1',allowedDets=goodDets): """ Cross correlate each detector to the signal from UB1. Takes a ...H or ...S data frame, returns a data frame with calibration fit results data, indexed by the detector name. """ df = df[var] # subset now only has all detector data for this variable. dets = [x for x in np.unique(df.columns.values) if x in allowedDets] calData = pd.concat([st.findCorr(df,None,det,baseDet,False) for det in dets]) calData = calData.set_index('det1') calData.calVar = var # note: not Pandas, just using the object to store extra info. return calData
def meanCrossCal(df,var,allowedDets=goodDets): """ Cross correlate each detector to the mean of all detectors. Takes a ...H or ...S data frame, returns a data frame with calibration fit results data, indexed by the detector name. """ df = df[var] # subset now only has all detector data for this variable. dets = [x for x in np.unique(df.columns.values) if x in allowedDets] mcol = 'm%s'%var df[mcol] = df.mean(axis=1) # mean of rows calData = pd.concat([st.findCorr(df,None,det,mcol,False) for det in dets]) calData = calData.set_index('det1') calData.calVar = var # note: not Pandas, just using the object to store extra info. return calData