Blocks = [] for fname in fnames: # Read. fpath = root + fname Reader = fitsGBT.Reader(fpath) Data = Reader.read(0,0) Blocks.append(Data) for Data in Blocks: # Preprocess. rotate_pol.rotate(Data, (-5, -7, -8, -6)) cal_scale.scale_by_cal(Data, True, False, False, False, True) flag_data.flag_data(Data, 5, 0.1, 40) rebin_freq.rebin(Data, 8, True, True) rebin_time.rebin(Data, 4) #rotate_pol.rotate(Data, (1, 2, 3, 4)) def model(n_time, centre, width, amp_xx, amp_yy, amp_xy, amp_yx, off_xx, off_yy, off_yx, off_xy, slope_xx, slope_yy, slope_xy, slope_yx, gain_xx, gain_yy, quad_xx, quad_yy): # Preliminaries. time = np.arange(n_time, dtype=float) - centre out = np.empty((4, 2, n_time), dtype=float) # Generate a unit gaussian. gauss = np.exp(- time**2 / (2 * width**2)) # Generate the four time series. out[0,:,:] = amp_xx * gauss + off_xx + slope_xx * time out[3,:,:] = amp_yy * gauss + off_yy + slope_yy * time out[1,:,:] = amp_xy * gauss + off_xy + slope_xy * time
Blocks = [] for fname in fnames: # Read. fpath = root + fname Reader = fitsGBT.Reader(fpath) Data = Reader.read(0, 0) Blocks.append(Data) for Data in Blocks: # Preprocess. rotate_pol.rotate(Data, (-5, -7, -8, -6)) cal_scale.scale_by_cal(Data, True, False, False, False, True) flag_data.flag_data(Data, 5, 0.1, 40) rebin_freq.rebin(Data, 8, True, True) rebin_time.rebin(Data, 4) #rotate_pol.rotate(Data, (1, 2, 3, 4)) def model(n_time, centre, width, amp_xx, amp_yy, amp_xy, amp_yx, off_xx, off_yy, off_yx, off_xy, slope_xx, slope_yy, slope_xy, slope_yx, gain_xx, gain_yy, quad_xx, quad_yy): # Preliminaries. time = np.arange(n_time, dtype=float) - centre out = np.empty((4, 2, n_time), dtype=float) # Generate a unit gaussian. gauss = np.exp(-time**2 / (2 * width**2)) # Generate the four time series. out[0, :, :] = amp_xx * gauss + off_xx + slope_xx * time out[3, :, :] = amp_yy * gauss + off_yy + slope_yy * time
inds_total.sort() # Seems to be nessisary for fitsdata[inds] to be the right type inds = sp.array(inds_total) testhdulist[1].data = fitsdata[inds] testhdulist.writeto(test_file_name) #### A series of test data files created from guppi data. guppi_file_name = os.getenv("GBT_DATA") + "/GBT10B_036/42_wigglez15hrst_ralongmap_230-237.fits" Reader = fitsGBT.Reader(guppi_file_name) Blocks = Reader.read((0, 1), None) for Data in Blocks: rebin_freq.rebin(Data, 32, True, True) rebin_time.rebin(Data, 2) split_Blocks = () for Data in Blocks: split_Blocks += split_bands.split(Data, 2, 32, 25) comb_Blocks = copy.deepcopy(split_Blocks) for Data in comb_Blocks: combine_cal.combine(Data, sub_mean=False) rot_Blocks = copy.deepcopy(comb_Blocks) for Data in rot_Blocks: rotate_pol.rotate(Data) # Measure some parameters from the noise. # Sort into 2 bands
inds_total.sort() # Seems to be nessisary for fitsdata[inds] to be the right type inds = sp.array(inds_total) testhdulist[1].data = fitsdata[inds] testhdulist.writeto(test_file_name) #### A series of test data files created from guppi data. guppi_file_name = (os.getenv('GBT_DATA') + '/GBT10B_036/42_wigglez15hrst_ralongmap_230-237.fits') Reader = fitsGBT.Reader(guppi_file_name) Blocks = Reader.read((0,1), None) for Data in Blocks: rebin_freq.rebin(Data, 32, True, True) rebin_time.rebin(Data, 2) split_Blocks = () for Data in Blocks: split_Blocks += split_bands.split(Data, 2, 32, 25) comb_Blocks = copy.deepcopy(split_Blocks) for Data in comb_Blocks: combine_cal.combine(Data, sub_mean=False) rot_Blocks = copy.deepcopy(comb_Blocks) for Data in rot_Blocks: rotate_pol.rotate(Data) # Measure some parameters from the noise. # Sort into 2 bands