def ReadMirrorAlt(Date, path): ''' Read a PAD file ''' #get the file name fname = path + '{:08d}/'.format(Date) + 'Mirror.bin' #check it exists if not os.path.isfile(fname): print('File not found') return None #read the data f = open(fname, 'rb') out = {} keys = [ 'Date', 'ut', 'utc', 'Alt', 'AltMid', 'Bm', 'BmMid', 'B0', 'AlphaN', 'AlphaS', 'BaltN', 'BaltS', 'LCAlt' ] for k in keys: if k == 'utc': dtype = 'float64' else: dtype = 'float32' out[k] = pf.ArrayFromFile(dtype, f) f.close() return out
def ReadPAD(Date,path,SpecType): ''' Read a PAD file ''' #get the file name fname = path + '{:08d}/'.format(Date) + SpecType + '.bin' #check it exists if not os.path.isfile(fname): print('File not found') return None #read the data f = open(fname,'rb') out = {} out['Date'] = pf.ArrayFromFile('int32',f) out['ut'] = pf.ArrayFromFile('float32',f) out['utc'] = pf.ArrayFromFile('float64',f) out['Emin'] = pf.ArrayFromFile('float32',f) out['Emax'] = pf.ArrayFromFile('float32',f) out['Alpha'] = pf.ArrayFromFile('float32',f) out['Flux'] = pf.ArrayFromFile('float32',f) f.close() return out
def ReadMatrix(Name='P-3-m-2'): ''' Read one of the test matrices. ''' fname = Globals.MatrixPath + '{:s}.bin'.format(Name) f = open(fname, 'rb') P = pf.ArrayFromFile('float32', f) f.close() return P