def correctXrayTestMirror(d,ifs,shade=None,dx=None,azweight=.015,smax=5.,\ bounds=None): """ Get distortion on same grid as IFs and run correction. Rebin result onto original distortion grid and apply. dx should be on IF grid size """ #Rebin to IF grid d2 = man.newGridSize(d, np.shape(ifs[0])) #Handle shademask if shade is None: shade = np.ones(np.shape(d2)) #Run correction volt = slv.correctDistortion(d2,ifs,shade,\ dx=dx,azweight=azweight,\ smax=smax,bounds=bounds) # Compute the correction on the same scale as the original # data. This correction will need to be added to the original # data to yield the final corrected figure. ifs2 = ifs.transpose(1, 2, 0) cor2 = np.dot(ifs2, volt) cor3 = man.newGridSize(cor2, np.shape(d), method='linear') #Handle shademask cor2[shade == 0] = np.nan cornan = man.newGridSize(cor2, np.shape(d), method='linear') cor3[np.isnan(cornan)] = np.nan return cor3, volt
def correctHFDFC3(d,ifs,shade=None,dx=None,azweight=.015,smax=5.,\ bounds=None): """ Get distortion on same grid as IFs and run correction. Rebin result onto original distortion grid and apply. dx should be on IF grid size. Needs update on doc string! """ #Rebin to IF grid d2 = man.newGridSize(d, np.shape(ifs[0])) #Handle shademask if shade is None: shade = np.ones(np.shape(d2)) #Run correction volt = slv.correctDistortion(d2,ifs,shade,\ dx=dx,azweight=azweight,\ smax=smax,bounds=bounds) #Add correction to original data ifs2 = ifs.transpose(1, 2, 0) cor2 = np.dot(ifs2, volt) #Handle shademask cor2[shade == 0] = np.nan cor3 = man.newGridSize(cor2, np.shape(d), method='linear') return cor3, volt