def rawopen(iobs, channel='tp12bit'): from scipy.io import netcdf if channel=='tp12bit': filename = glob(pathname_12bit % iobs)[-1] elif channel=='tp16bit': filename = glob(pathname_16bit % iobs)[-1] else: print('ERROR: you can only specify tp12bit or tp16bit for the channel') nc = netcdf.netcdf_file(filename) keep = Namespace() keep.BufPos = nc.variables['Data.TelescopeBackend.BufPos'].data keep.Time = nc.variables['Data.TelescopeBackend.TelTime'].data keep.XPos = nc.variables['Data.TelescopeBackend.TelAzMap'].data keep.YPos = nc.variables['Data.TelescopeBackend.TelElMap'].data if channel=='tp16bit': keep.APower = -nc.variables['Data.LmtTpm.Signal'].data[:,0] keep.BPower = keep.APower elif channel=='tp12bit': keep.BPower = np.sum(nc.variables['Data.IfProc.BasebandLevel'].data, axis=1) / nc.variables['Data.IfProc.BasebandLevel'].data.shape[1] keep.APower = keep.BPower keep.nc = nc if 'Data.IfProc.BasebandTime' in nc.variables: keep.ADCTime = nc.variables['Data.IfProc.BasebandTime'].data return keep
def rawopen(iobs): from scipy.io import netcdf filename = glob('/data_lmt/vlbi1mm/vlbi1mm_*%06d*.nc' % iobs)[-1] nc = netcdf.netcdf_file(filename) # keep = dict((name.split('.')[-1], val.data) for (name, val) in nc.variables.items() # if name[:4] == 'Data') keep = Namespace() keep.BufPos = nc.variables['Data.Dcs.BufPos'].data keep.Time = nc.variables['Data.Sky.Time'].data keep.XPos = nc.variables['Data.Sky.XPos'].data keep.YPos = nc.variables['Data.Sky.YPos'].data keep.APower = nc.variables['Data.Vlbi1mmTpm.APower'].data keep.BPower = nc.variables['Data.Vlbi1mmTpm.BPower'].data if 'Data.Vlbi1mmTpm.Time' in nc.variables: keep.ADCTime = nc.variables['Data.Vlbi1mmTpm.Time'].data return keep