def load_moonscan(filename): cal_coords = ephem.Equatorial("05:42:36.155", "+49:51:07.28", epoch=ephem.B1950) # convert cal to a Body object. cal_source = ephem.FixedBody() cal_source._ra = cal_coords.ra cal_source._dec = cal_coords.dec cal_source._epoch = cal_coords.epoch Reader = fitsGBT.Reader(filename) moon_dataobj = Reader.read(0,0) rotate_pol.rotate(moon_dataobj, (-5, -7, -8, -6)) cal_scale.scale_by_cal(moon_dataobj, scale_t_ave=True, scale_f_ave=False, sub_med=False, scale_f_ave_mod=False, rotate=True) flag_data.flag_data(moon_dataobj, 5, 0.1, 40) rebin_freq.rebin(moon_dataobj, 16, True, True) #rebin_time.rebin(moon_dataobj, 4) fgc_mueler_file = '/mnt/raid-project/gmrt/tcv/diff_gain_params/GBT12A_418/22_diff_gain_calc.txt' fgc_RM_file = ' ' fgc_R_to_sky = True fgc_DP_correct = False # this is already handled in scale_by_cal's rotate fgc_RM_correct = False from time_stream import flux_diff_gain_cal as fdg m_total = fdg.flux_dg(fgc_mueler_file) fdg.calibrate_pol(moon_dataobj, m_total, fgc_RM_file, fgc_R_to_sky, fgc_DP_correct, fgc_RM_correct) return moon_dataobj
def load_moonscan(filename, rotate_moon=True): cal_coords = ephem.Equatorial("05:42:36.155", "+49:51:07.28", epoch=ephem.B1950) # convert cal to a Body object. cal_source = ephem.FixedBody() cal_source._ra = cal_coords.ra cal_source._dec = cal_coords.dec cal_source._epoch = cal_coords.epoch Reader = fitsGBT.Reader(filename) moon_dataobj = Reader.read(0, 0) rotate_pol.rotate(moon_dataobj, (-5, -7, -8, -6)) cal_scale.scale_by_cal(moon_dataobj, scale_t_ave=True, scale_f_ave=False, sub_med=False, scale_f_ave_mod=False, rotate=True) flag_data.flag_data(moon_dataobj, 5, 0.1, 40) rebin_freq.rebin(moon_dataobj, 16, True, True) #rebin_time.rebin(moon_dataobj, 4) if rotate_moon: moon_rotation.rotate_pol_moon(moon_dataobj) fgc_mueler_file = '/mnt/raid-project/gmrt/tcv/diff_gain_params/GBT12A_418/22_diff_gain_calc.txt' fgc_RM_file = ' ' fgc_R_to_sky = True fgc_DP_correct = False # this is already handled in scale_by_cal's rotate fgc_RM_correct = False from time_stream import flux_diff_gain_cal as fdg m_total = fdg.flux_dg(fgc_mueler_file) fdg.calibrate_pol(moon_dataobj, m_total, fgc_RM_file, fgc_R_to_sky, fgc_DP_correct, fgc_RM_correct) return moon_dataobj
root = os.getenv('GBT_DATA') + 'GBT12A_418/' 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
# The following two loops is a standard set of things we do to our raw data # when it comes from the telescope. Our data format is roughly SDfits. # Read and preprocess the Data. cal_Blocks = [] for fname in cal_files: # Read. fpath = data_root + fname + end Reader = fitsGBT.Reader(fpath) Data = Reader.read(0, 0) cal_Blocks.append(Data) for Data in cal_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, 16, True, True) rebin_freq.rebin(Data, 16, True, True) #combine_cal.combine(Data, (0.5, 0.5), False, True) combine_cal.combine(Data, (0., 1.), False, True) #rebin_time.rebin(Data, 4) Data.calc_freq() # Put all the data into a same format for the fits. BeamData = beam_fit.FormattedData(cal_Blocks) # Source object. This just calculates the ephemeris of the source compared to # where the telescope is pointing. S = cal.source.Source(source)