def get_comatrix( f , tditype , tdigen , whichtdis ) : """ Returns the covariance matrix of a set of TDI observables INPUT: f --- frequencies (numpy array) tditype --- type of TDI observables ('Michelson','Sagnac') tdigen --- generation of TDI observables ('G0','G1','Gm','G2') whichtdis --- set of TDI observables ('123','AET') OUTPUT: comatrix --- covariance matrix ( Nvar x Nvar x Nf numpy array) """ if whichtdis == '123' : pairs = [ ('1','1') , ('1','2') , ('1','3') , ('2','1') , ('2','2') , ('2','3') , ('3','1') , ('3','2') , ('3','3') ] cIJs = [ mlisar.get_tdiNSD( tditype , tdigen , pair[0] , pair[1] , f ) for pair in pairs ] elif whichtdis == 'AET' : pairs = [ ('A','A') , ('A','E') , ('A','T') , ('E','A') , ('E','E') , ('E','T') , ('T','A') , ('T','E') , ('T','T') ] cIJs = [ mlisar.get_tdiNSD( tditype , tdigen , pair[0] , pair[1] , f ) for pair in pairs ] comatrix = np.array( [ [ cIJs[0] , cIJs[1] , cIJs[2] ] , [ cIJs[3] , cIJs[4] , cIJs[5] ] , [ cIJs[6] , cIJs[7] , cIJs[8] ] ] ) return comatrix
def get_comatrix(f, tditype, tdigen, whichtdis): """ Returns the covariance matrix of a set of TDI observables INPUT: f --- frequencies (numpy array) tditype --- type of TDI observables ('Michelson','Sagnac') tdigen --- generation of TDI observables ('G0','G1','Gm','G2') whichtdis --- set of TDI observables ('123','AET') OUTPUT: comatrix --- covariance matrix ( Nvar x Nvar x Nf numpy array) """ if whichtdis == '123': pairs = [('1', '1'), ('1', '2'), ('1', '3'), ('2', '1'), ('2', '2'), ('2', '3'), ('3', '1'), ('3', '2'), ('3', '3')] cIJs = [ mlisar.get_tdiNSD(tditype, tdigen, pair[0], pair[1], f) for pair in pairs ] elif whichtdis == 'AET': pairs = [('A', 'A'), ('A', 'E'), ('A', 'T'), ('E', 'A'), ('E', 'E'), ('E', 'T'), ('T', 'A'), ('T', 'E'), ('T', 'T')] cIJs = [ mlisar.get_tdiNSD(tditype, tdigen, pair[0], pair[1], f) for pair in pairs ] comatrix = np.array([[cIJs[0], cIJs[1], cIJs[2]], [cIJs[3], cIJs[4], cIJs[5]], [cIJs[6], cIJs[7], cIJs[8]]]) return comatrix
) else: csddir = args[0] if options.whichtdi == 'ordinary': IJs = ['12', '13', '23'] elif options.whichtdi == 'optimal': IJs = ['AE', 'AT', 'ET'] if csddir not in glob.glob(csddir): os.system('mkdir %s' % csddir) fdata = options.f0 + options.df * np.arange(options.Nf) fscale = {'Offset1': options.f0, 'Cadence1': options.df} f = AS.Coarsable(fdata, **fscale) print "Calculating expected cross NSD..." PIJdatas = [ mlisar.get_tdiNSD(options.tditype, options.tdigen, IJ[0], IJ[1], fdata) for IJ in IJs ] PIJs = [AS.Coarsable(PIJdata, **fscale) for PIJdata in PIJdatas] P12, P13, P23 = PIJs print 'done' psddict = {'f': f, 'AE': P12, 'AT': P13, 'ET': P23} file = open(csddir + 'd001.pkl', 'wb') cpkl.dump(psddict, file, -1) file.close()
def get_PnTnT(f): return 16e39 * mlisar.get_tdiNSD(tditype, tdigen, 'T', 'T', f)
def get_PnEnE(f): return 16e39 * mlisar.get_tdiNSD(tditype, tdigen, 'E', 'E', f)
def get_PnAnA(f): return 16e39 * mlisar.get_tdiNSD(tditype, tdigen, 'A', 'A', f)
def get_PnTnT( f ) : return 16e39 * mlisar.get_tdiNSD( tditype , tdigen , 'T' , 'T' , f )
def get_PnEnE( f ) : return 16e39 * mlisar.get_tdiNSD( tditype , tdigen , 'E' , 'E' , f )
def get_PnAnA( f ) : return 16e39 * mlisar.get_tdiNSD( tditype , tdigen , 'A' , 'A' , f )
( options , args ) = parser.parse_args() if len( args ) < 1 : parser.error( "You must specify CSDDIR! Type './x_simulate_expected_signal_CSD.py -h' for help " ) else : csddir = args[ 0 ] if options.whichtdi == 'ordinary' : IJs = [ '12' , '13' , '23' ] elif options.whichtdi == 'optimal' : IJs = [ 'AE' , 'AT' , 'ET' ] if csddir not in glob.glob( csddir ) : os.system( 'mkdir %s' % csddir ) fdata = options.f0 + options.df * np.arange( options.Nf ) fscale = { 'Offset1':options.f0 , 'Cadence1':options.df } f = AS.Coarsable( fdata , **fscale ) print "Calculating expected cross NSD..." PIJdatas = [ mlisar.get_tdiNSD( options.tditype , options.tdigen , IJ[0] , IJ[1] , fdata ) for IJ in IJs ] PIJs = [ AS.Coarsable( PIJdata , **fscale ) for PIJdata in PIJdatas ] P12 , P13 , P23 = PIJs print 'done' psddict = { 'f':f , 'AE':P12 , 'AT':P13 , 'ET':P23 } file = open( csddir + 'd001.pkl' , 'wb' ) ; cpkl.dump( psddict , file , -1 ) ; file.close()
( options , args ) = parser.parse_args() if len( args ) < 1 : parser.error( "You must specify PSDDIR! Type './x_simulate_expected_signal_PSD.py -h' for help " ) else : psddir = args[ 0 ] if options.whichtdi == 'ordinary' : IIs = [ '11' , '22' , '33' ] elif options.whichtdi == 'optimal' : IIs = [ 'AA' , 'EE' , 'TT' ] if psddir not in glob.glob( psddir ) : os.system( 'mkdir %s' % psddir ) fdata = options.f0 + options.df * np.arange( options.Nf ) fscale = { 'Offset1':options.f0 , 'Cadence1':options.df } f = AS.Coarsable( fdata , **fscale ) print "Calculating expected auto NSD..." PIIdatas = [ mlisar.get_tdiNSD( options.tditype , options.tdigen , II[0] , II[1] , fdata ) for II in IIs ] PIIs = [ AS.Coarsable( PIIdata , **fscale ) for PIIdata in PIIdatas ] P11 , P22 , P33 = PIIs print 'done' psddict = { 'f':f , 'AA':P11 , 'EE':P22 , 'TT':P33 } file = open( psddir + 'd001.pkl' , 'wb' ) ; cpkl.dump( psddict , file , -1 ) ; file.close()