#### 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
file_pars = {}
band1_Blocks = []
band2_Blocks = []
band1 = 0
band2 = 0
for Data in rot_Blocks:
    band = int(round(Data.field["CRVAL1"] / 1e6))
    if band == band1:
Ejemplo n.º 2
0
 def test_subtracts_baseline(self) :
     rebin_freq.rebin(self.Data, 1.0)
     combine_cal.combine(self.Data, sub_mean=True, average_cals=False)
     data = self.Data.data
     self.assertTrue(ma.allclose(ma.mean(data, 0), 0.))
Ejemplo n.º 3
0
 def test_dims_cal_ave(self) :
     dims = self.Data.dims
     combine_cal.combine(self.Data, sub_mean=False, average_cals=True)
     dims = dims[:2] + (1,) + dims[3:]
     self.assertEqual(self.Data.dims, dims)
     self.Data.verify()
Ejemplo n.º 4
0
for fname in cal_files:
    # Read.
    fpath = data_root + fname + end
    Reader = fitsGBT.Reader(fpath)
    Data = Reader.read(0, 0)
    cal_Blocks.append(Data)
    g_n_time += Data.dims[0]

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)
    #rebin_time.rebin(Data, 4)

# Set some globals.
g_Blocks = cal_Blocks
g_n_blocks = len(cal_Blocks)
# Here we get an initial guess for the important parameters.
first_Data = cal_Blocks[0]
g_n_cal = first_Data.dims[2]
first_Data.calc_freq()
freq = first_Data.freq.copy()
n_f = len(freq)
# Initialize all parameters.
first_Data.calc_pointing()
#source = [np.mean(first_Data.ra), np.mean(first_Data.dec)]
source = [0, 0]
Ejemplo n.º 5
0
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)

# Do a preliminary fit to just the XX and YY polarizations.  This is a
# non-linear fit to the Gaussian and gets things like the centriod and the
# Gaussian width.  All fits are channel-by-channel (independantly).
center_offset, width, amps, Tsys = beam_fit.fit_simple_gaussian(BeamData, S)
#### 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
file_pars = {}
band1_Blocks = []
band2_Blocks = []
band1 = 0
band2 = 0
for Data in rot_Blocks:
    band = int(round(Data.field["CRVAL1"]/1e6))
    if band == band1:
Ejemplo n.º 7
0
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)

# Do a preliminary fit to just the XX and YY polarizations.  This is a
# non-linear fit to the Gaussian and gets things like the centriod and the
# Gaussian width.  All fits are channel-by-channel (independantly).
center_offset, width, amps, Tsys = beam_fit.fit_simple_gaussian(BeamData, S)
Ejemplo n.º 8
0
 def test_dims_cal_ave(self):
     dims = self.Data.dims
     combine_cal.combine(self.Data, sub_mean=False, average_cals=True)
     dims = dims[:2] + (1, ) + dims[3:]
     self.assertEqual(self.Data.dims, dims)
     self.Data.verify()
Ejemplo n.º 9
0
 def test_subtracts_baseline(self):
     rebin_freq.rebin(self.Data, 1.0)
     combine_cal.combine(self.Data, sub_mean=True, average_cals=False)
     data = self.Data.data
     self.assertTrue(ma.allclose(ma.mean(data, 0), 0.))
Ejemplo n.º 10
0
for fname in cal_files:
    # Read.
    fpath = data_root + fname + end
    Reader = fitsGBT.Reader(fpath)
    Data = Reader.read(0, 0)
    cal_Blocks.append(Data)
    g_n_time += Data.dims[0]

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)
    # rebin_time.rebin(Data, 4)

# Set some globals.
g_Blocks = cal_Blocks
g_n_blocks = len(cal_Blocks)
# Here we get an initial guess for the important parameters.
first_Data = cal_Blocks[0]
g_n_cal = first_Data.dims[2]
first_Data.calc_freq()
freq = first_Data.freq.copy()
n_f = len(freq)
# Initialize all parameters.
first_Data.calc_pointing()
# source = [np.mean(first_Data.ra), np.mean(first_Data.dec)]
source = [0, 0]