예제 #1
0
max_n_timestamps = 10
min_timestamp = 0
bchan = 0  # beginning channel (to cut out edges of the bandpass)
echan = 108  # ending channel
max_antenna_radius = 400.0  # meters. To cut outtrigger(s)
pols_use = ["P1"]
npol_use = len(pols_use)
apply_cal = True
MOFF_tbinsize = None

# Use absolute antenna locs to get lat and lon
antfile = "/data5/LWA_OV_data/m_files/antenna-positions.txt"
# Location array is 256x3, in ITRF coordinates
ant_locs_xyz = NP.loadtxt(antfile, delimiter=",")
xyz_ref = NP.mean(ant_locs_xyz, axis=0, keepdims=True)
lat0, lon0, alt0 = GEOM.ecef2lla(xyz_ref[:, 0], xyz_ref[:, 1], xyz_ref[:, 2], units="radians")
lat0 = NP.degrees(lat0)
lon0 = NP.degrees(lon0)

# Load in cal file, which is also used for flagging
calfile = "/data5/LWA_OV_data/m_files/flagged-calibration.mat"
cal = sio.loadmat(calfile)
gains = cal["gains"] / np.sqrt(np.mean(np.abs(cal["gains"]) ** 2.0))  # Not sure why this is done
calflags = cal["flags"]
flags = set(NP.where(NP.any(calflags, axis=1))[0])  # This particular set of flags is all or none per antenna

# Get file, read in header
datafile = "/data5/LWA_OV_data/data_reformatted/jun11/47mhz/2016-06-11-08-00-37_0000000000000000.000000.dada.hdf5"
with h5py.File(datafile, "r") as fileobj:
    ntimes = fileobj["header"]["ntimes"].value  # Number of time samples
    nant = fileobj["header"]["nant"].value  # Numer of antennas
ant_per_f_engine = 8
time_per_chunk = 2
n_pol = 2
n_ant = n_f_engines * ant_per_f_engine / n_pol
f0 = 46.992e6 # Center frequency
freq_resolution = 24e3 # frequency resolution (Hz)
bw = n_chan * freq_resolution
pol = NP.asarray(['P1', 'P2'])
channels = f0 + freq_resolution * (NP.arange(n_chan) - int(0.5*n_chan))

# Get the antenna locations
r_earth = 6.371e6  # meters
antfile = '/data5/LWA_OV_data/m_files/antenna-positions.txt'
# Location array is 256x3, in ITRF coordinates
ant_locs_xyz = NP.loadtxt(antfile, delimiter=',')
ant_locs_lla = GEOM.ecef2lla(ant_locs_xyz[:,0], ant_locs_xyz[:,1], ant_locs_xyz[:,2], units='radians')
ant_locs_xyz_ref = NP.mean(ant_locs_xyz, axis=0, keepdims=True)
ant_locs_ref_lat, ant_locs_ref_lon, ant_locs_ref_alt = GEOM.ecef2lla(ant_locs_xyz_ref[:,0], ant_locs_xyz_ref[:,1], ant_locs_xyz_ref[:,2], units='radians')
ant_locs_enu = GEOM.ecef2enu(ant_locs_xyz, ref_info={'xyz': ant_locs_xyz_ref, 'lat': ant_locs_ref_lat[0], 'lon': ant_locs_ref_lon[0], 'units': 'radians'})
n_ant = ant_locs_enu.shape[0]
ant_id = NP.arange(n_ant)
ant_labels = ant_id.astype(str)

# lat,lon,alt = uvdata.LatLonAlt_from_XYZ(ant_locs)
# lat0 = NP.mean(lat)
# lon0 = NP.mean(lon)
# alt0 = NP.mean(alt)
# east = r_earth * NP.cos(lat0) * NP.sin(lon - lon0)
# north = r_earth * NP.sin(lat - lat0)
# ant_locs = NP.vstack((east, north, alt-alt0)).transpose()
time_per_chunk = 2
n_pol = 2
n_ant = n_f_engines * ant_per_f_engine / n_pol
f0 = 46.992e6  # Center frequency
freq_resolution = 24e3  # frequency resolution (Hz)
bw = n_chan * freq_resolution
pol = NP.asarray(['P1', 'P2'])
channels = f0 + freq_resolution * (NP.arange(n_chan) - int(0.5 * n_chan))

# Get the antenna locations
r_earth = 6.371e6  # meters
antfile = '/data5/LWA_OV_data/m_files/antenna-positions.txt'
# Location array is 256x3, in ITRF coordinates
ant_locs_xyz = NP.loadtxt(antfile, delimiter=',')
ant_locs_lla = GEOM.ecef2lla(ant_locs_xyz[:, 0],
                             ant_locs_xyz[:, 1],
                             ant_locs_xyz[:, 2],
                             units='radians')
ant_locs_xyz_ref = NP.mean(ant_locs_xyz, axis=0, keepdims=True)
ant_locs_ref_lat, ant_locs_ref_lon, ant_locs_ref_alt = GEOM.ecef2lla(
    ant_locs_xyz_ref[:, 0],
    ant_locs_xyz_ref[:, 1],
    ant_locs_xyz_ref[:, 2],
    units='radians')
ant_locs_enu = GEOM.ecef2enu(ant_locs_xyz,
                             ref_info={
                                 'xyz': ant_locs_xyz_ref,
                                 'lat': ant_locs_ref_lat[0],
                                 'lon': ant_locs_ref_lon[0],
                                 'units': 'radians'
                             })
n_ant = ant_locs_enu.shape[0]
예제 #4
0
# Make some choices about the analysis
max_n_timestamps = 5
max_antenna_radius = 400.0  # meters. To cut outtrigger(s)
pols_use = ['P1']
npol_use = len(pols_use)
apply_cal = True
MOFF_tbinsize = None

# Use absolute antenna locs to get lat and lon
antfile = '/data5/LWA_OV_data/m_files/antenna-positions.txt'
# Location array is 256x3, in ITRF coordinates
ant_locs_xyz = np.loadtxt(antfile, delimiter=',')
xyz_ref = np.mean(ant_locs_xyz, axis=0, keepdims=True)
lat0, lon0, alt0 = GEOM.ecef2lla(xyz_ref[:, 0],
                                 xyz_ref[:, 1],
                                 xyz_ref[:, 2],
                                 units='radians')
lat0 = np.degrees(lat0)
lon0 = np.degrees(lon0)

# Load in cal file, which is also used for flagging
calfile = '/data5/LWA_OV_data/m_files/flagged-calibration.mat'
cal = sio.loadmat(calfile)
gains = cal['gains'] / np.sqrt(np.mean(np.abs(cal['gains'])**
                                       2.))  # Not sure why this is done
calflags = cal['flags']
flags = set(np.where(np.any(
    calflags,
    axis=1))[0])  # This particular set of flags is all or none per antenna

# Get file, read in header