def tsXML_to_psdXML(inxmlpath, outxmldir): ''' Not too nice function for opening a TDIsignal xml file, reading the time-series' inside, calculate the PSDs for each, and then saving them in a similar xml file, but with the time-series replaced by PSDs. Will have to do for now. ''' inxml = lisaxml.readXML(inxmlpath) source = inxml.SourceData[0] lisa = inxml.LISAData tdiobs = inxml.TDIData[0] inxml.close() hr = 60.0**2 patches = int(tdiobs.TimeSeries.Duration / hr) specAA = synthlisa.spect(tdiobs.A, tdiobs.TimeSeries.Cadence, patches) specEE = synthlisa.spect(tdiobs.E, tdiobs.TimeSeries.Cadence, patches) specTT = synthlisa.spect(tdiobs.T, tdiobs.TimeSeries.Cadence, patches) f = specAA[:, 0] pAA = specAA[:, 1] pEE = specEE[:, 1] pTT = specTT[:, 1] pobs = lisaxml.Observable('f,pAA,pEE,pTT', DataType='FractionalFrequency') pobs.TimeSeries = lisaxml.TimeSeries([f, pAA, pEE, pTT], 'f,pAA,pEE,pTT') pobs.TimeSeries.Cadence = f[1] - f[0] pobs.TimeSeries.Cadence_Unit = 'Hertz' pobs.TimeSeries.TimeOffset = 0 pobs.TimeSeries.TimeOffset_Unit = 'Hertz' inxmlname = os.path.basename(inxmlpath) outxmlpath = outxmldir + re.sub('\.xml$', '', inxmlname) + '-psd.xml' outxml = lisaxml.lisaXML(outxmlpath, author='J.Yu') outxml.TDIData(pobs) outxml.LISAData(lisa) outxml.SourceData(source) outxml.close() return
def tsXML_to_psdXML(inxmlpath,outxmldir): """ Not too nice function for opening a TDIsignal xml file, reading the time-series' inside, calculate the PSDs for each, and then saving them in a similar xml file, but with the PSDs saved as lisaxml's TimeSeries objects. Will have to do for now. """ inxml = lisaxml.readXML(inxmlpath) sources = inxml.SourceData lisa = inxml.LISAData tdiobs = inxml.TDIData[0] inxml.close() segduration = 2*60.0**2 patches = int(tdiobs.TimeSeries.Duration/segduration) specAA = synthlisa.spect(tdiobs.A,tdiobs.TimeSeries.Cadence,patches) specEE = synthlisa.spect(tdiobs.E,tdiobs.TimeSeries.Cadence,patches) specTT = synthlisa.spect(tdiobs.T,tdiobs.TimeSeries.Cadence,patches) f = specAA[:,0] pAA = specAA[:,1] pEE = specEE[:,1] pTT = specTT[:,1] pobs = lisaxml.Observable('f,pAA,pEE,pTT',DataType = 'FractionalFrequency') pobs.TimeSeries = lisaxml.TimeSeries([f,pAA,pEE,pTT],'f,pAA,pEE,pTT') pobs.TimeSeries.Cadence = f[1] - f[0] pobs.TimeSeries.Cadence_Unit = 'Hertz' pobs.TimeSeries.TimeOffset = 0 pobs.TimeSeries.TimeOffset_Unit = 'Hertz' inxmlname = os.path.basename(inxmlpath) outxmlpath = outxmldir + re.sub('\.xml$','',inxmlname) + '-psd.xml' outxml = lisaxml.lisaXML(outxmlpath,author='J.Yu') outxml.TDIData(pobs) outxml.LISAData(lisa) for source in sources: outxml.SourceData(source) outxml.close() return
def __init__(self,xmlfilepath): inxml = lisaxml.readXML(xmlfilepath) tdiobs = inxml.TDIData[0] self.t = tdiobs.t self.A, self.E, self.T = tdiobs.A, tdiobs.E, tdiobs.T self.TimeOffset = tdiobs.TimeSeries.TimeOffset self.Cadence = tdiobs.TimeSeries.Cadence self.Length = tdiobs.TimeSeries.Length print 'Time-series file read successfully!' return
def __init__(self, xmlfilepath): inxml = lisaxml.readXML(xmlfilepath) pobs = inxml.TDIData[0] self.f = pobs.f self.pAA, self.pEE, self.pTT = pobs.pAA, pobs.pEE, pobs.pTT self.FreqOffset = pobs.TimeSeries.TimeOffset self.Cadence = pobs.TimeSeries.Cadence self.Length = pobs.TimeSeries.Length print 'Auto-spectra file read sucessfully!' return
def __init__(self, xmlfilepath): inxml = lisaxml.readXML(xmlfilepath) tdiobs = inxml.TDIData[0] self.t = tdiobs.t self.A, self.E, self.T = tdiobs.A, tdiobs.E, tdiobs.T self.TimeOffset = tdiobs.TimeSeries.TimeOffset self.Cadence = tdiobs.TimeSeries.Cadence self.Length = tdiobs.TimeSeries.Length print 'Time-series file read successfully!' return
def __init__(self,xmlfilepath): inxml = lisaxml.readXML(xmlfilepath) pobs = inxml.TDIData[0] self.f = pobs.f self.pAA, self.pEE, self.pTT = pobs.pAA, pobs.pEE, pobs.pTT self.FreqOffset = pobs.TimeSeries.TimeOffset self.Cadence = pobs.TimeSeries.Cadence self.Length = pobs.TimeSeries.Length print 'Auto-spectra file read sucessfully!' return
def avg_psdXML_avg(day, psdlxmlpath, psdrxmlpath, psddir): xmll = lisaxml.readXML(psdlxmlpath) xmlr = lisaxml.readXML(psdrxmlpath) sources = xmll.SourceData lisa = xmll.LISAData pobsl = xmll.TDIData[0] pobsr = xmlr.TDIData[0] xmll.close() xmlr.close() pAAl, pEEl, pTTl = pobsl.pAA, pobsl.pEE, pobsl.pTT pAAr, pEEr, pTTr = pobsr.pAA, pobsr.pEE, pobsr.pTT f = pobsl.f pAA, pEE, pTT = (pAAl + pAAr) / 2, (pEEl + pEEr) / 2, (pTTl + pTTr) / 2 pobs = lisaxml.Observable('f,pAA,pEE,pTT', DataType='FractionalFrequency') pobs.TimeSeries = lisaxml.TimeSeries([f, pAA, pEE, pTT], 'f,pAA,pEE,pTT') pobs.TimeSeries.Cadence = pobsl.TimeSeries.Cadence pobs.TimeSeries.Cadence_Unit = pobsl.TimeSeries.Cadence_Unit pobs.TimeSeries.TimeOffset = pobsl.TimeSeries.TimeOffset pobs.TimeSeries.TimeOffset_Unit = pobsl.TimeSeries.TimeOffset_Unit psdlxmlname = os.path.basename(psdlxmlpath) psdxmlname = re.split('-', psdlxmlname, 1)[0] + '-s%03d-psd.xml' % day psdxmlpath = psddir + psdxmlname psdxml = lisaxml.lisaXML(psdxmlpath, author='J.Yu') psdxml.TDIData(pobs) psdxml.LISAData(lisa) for source in sources: psdxml.SourceData(source) psdxml.close() return
def avg_psdXML_avg(day,psdlxmlpath,psdrxmlpath,psddir): xmll = lisaxml.readXML(psdlxmlpath) xmlr = lisaxml.readXML(psdrxmlpath) sources = xmll.SourceData lisa = xmll.LISAData pobsl = xmll.TDIData[0] pobsr = xmlr.TDIData[0] xmll.close() xmlr.close() pAAl, pEEl, pTTl = pobsl.pAA, pobsl.pEE, pobsl.pTT pAAr, pEEr, pTTr = pobsr.pAA, pobsr.pEE, pobsr.pTT f = pobsl.f pAA, pEE, pTT = (pAAl + pAAr)/2, (pEEl + pEEr)/2, (pTTl + pTTr)/2 pobs = lisaxml.Observable('f,pAA,pEE,pTT', DataType = 'FractionalFrequency') pobs.TimeSeries = lisaxml.TimeSeries([f,pAA,pEE,pTT],'f,pAA,pEE,pTT') pobs.TimeSeries.Cadence = pobsl.TimeSeries.Cadence pobs.TimeSeries.Cadence_Unit = pobsl.TimeSeries.Cadence_Unit pobs.TimeSeries.TimeOffset = pobsl.TimeSeries.TimeOffset pobs.TimeSeries.TimeOffset_Unit = pobsl.TimeSeries.TimeOffset_Unit psdlxmlname = os.path.basename(psdlxmlpath) psdxmlname = re.split('-',psdlxmlname,1)[0] + '-s%03d-psd.xml' % day psdxmlpath = psddir + psdxmlname psdxml = lisaxml.lisaXML(psdxmlpath,author='J.Yu') psdxml.TDIData(pobs) psdxml.LISAData(lisa) for source in sources: psdxml.SourceData(source) psdxml.close() return
__version__ = '$Id: $' import lisaxml from lisaxml.convertunit import convertUnit import sys, re import math import synthlisa if (len(sys.argv) < 2): print "missing name of xml file: usage create_quadratures.py XMLFILE" sys.exit(1) xmlInput = sys.argv[1] outputname1 = xmlInput[:-4] + "_0.xml" inputXML = lisaxml.readXML(xmlInput) mysystems = inputXML.getLISASources() inputXML.close() outputXML1 = lisaxml.lisaXML(outputname1, author='Stas Babak') Zerosystems = mysystems for system in Zerosystems: system.InitialAngularOrbitalPhase = 0.0 outputXML1.SourceData(system) outputXML1.close()
import lisaxml from lisaxml.convertunit import convertUnit import sys, re import math import synthlisa if (len(sys.argv) < 2): print "missing name of xml file: usage create_quadratures.py XMLFILE" sys.exit(1) xmlInput = sys.argv[1] outputname1 = xmlInput[:-4]+"_0.xml" inputXML = lisaxml.readXML(xmlInput) mysystems = inputXML.getLISASources() inputXML.close() outputXML1 = lisaxml.lisaXML(outputname1,author='Stas Babak') Zerosystems = mysystems for system in Zerosystems: system.InitialAngularOrbitalPhase = 0.0 outputXML1.SourceData(system) outputXML1.close()
parser = OptionParser( usage="usage: %prog [options] MERGED.xml TDIFILE-1.xml TDIFILE-2.xml ...", version="$Id: mergeXML.py 401 2007-05-23 20:22:23Z vallisneri $") (options, args) = parser.parse_args() # currently we support only a single source parameter file if len(args) < 2: parser.error( "You must specify at least the output file and one input file!") inputfile = args[0] outputfile = args[1] inputtdifile = lisaxml.readXML(inputfile) lisa = inputtdifile.getLISAgeometry() sources = inputtdifile.getLISASources() tdi = inputtdifile.getTDIObservables()[0] # take author and comments, if any, from MERGED.xml author = inputtdifile.Author if not author: author = 'Michele Vallisneri (through mergeXML.py)' comments = inputtdifile.Comment
print Injfile print "Analysis files" print Detfiles # To do: Need to read quadrutures as well... if options.phasemax : if ( re.search('Challenge1.2', Injfile) == None and \ re.search('Challenge1.1.1', Injfile) == None ): print "phase maximization can be done only for 1.2 and 1.1.1 chalenges" sys.exit(1) # Reading the data Datatdifile = lisaxml.readXML(Datafile) tdiData = Datatdifile.getTDIObservables()[0] Xdata = tdiData.Xs Adata = (2.0*tdiData.Xs -tdiData.Ys - tdiData.Zs)/3.0 Edata = (tdiData.Zs - tdiData.Ys)/math.sqrt(3.0) samples = Numeric.shape(Xdata)[0] # computing useful number of points pdlen3 = samples/2 nyquistf = 0.5/15.0 # !!! hardcoded !!!! freqs = Numeric.arange(0,pdlen3+1,dtype='d') * (nyquistf / pdlen3) ind = 0 for i in xrange(pdlen3): if (freqs[i] > 1.e-5 and freqs[i]<0.009): ind += 1
ParamRange.append(0.2) # 4-Spin ParamRange.append(1.0) # 5-MassOfCompactObject ParamRange.append(1.e6) # 6-MassOfSMBH (for 1.3.1) should be 5.e5 for 132,3 and 1.e5 for 134,5 ParamRange.append("NA") # 7-InitialAzimuthalOrbitalFrequency ParamRange.append(2.*pi) # 8-InitialAzimuthalOrbitalPhase ParamRange.append(options.de) # 9- InitialEccentricity (guess) ParamRange.append(2.*pi) # 10-InitialTildeGamma ParamRange.append(2.*pi) # 11-InitialAlphaAngle ParamRange.append(pi) # 12-LambdaAngle ParamRange.append("NA") # 13-Distance ParamRange.append(5.e7) # 14 to be filled up with Plunge time print ParamRange print "Dealing with ", keyFile inputXML = lisaxml.readXML(keyFile) KeySystems = inputXML.getLISASources() SourceXML = lisaxml.readXML(datFile) RecSystems = SourceXML.getLISASources() fout = open(outF, 'w') spr = " " for key in KeySystems: #print "Keys: ", key.name if (key.name == keyS): for emri in RecSystems: err = []
# make a temporary directory here = os.getcwd() workdir = os.path.abspath(tempfile.mkdtemp(dir='.')) # XML and binary filenames for the input (source or barycentric) file xmlfile = os.path.abspath(inputfile) binfile = re.sub('.xml', '-0.bin', xmlfile) # XML filename for output (TDI) file; create empty tdifile = os.path.abspath(outputfile) sourcefileobj = lisaxml.lisaXML(tdifile).close() if options.immediate: # process sources in source file, one by one copylisasim(lisasimdir, workdir) # make virtual LISAsim environment inputxml = lisaxml.readXML(xmlfile) for src in inputxml.getLISASources(): sourcefilename = workdir + '/XML/tmpsource.xml' baryfilename = workdir + '/XML/tmpbary_Barycenter.xml' sourcefile = lisaxml.lisaXML(sourcefilename) sourcefile.SourceData(src) sourcefile.close() if options.debug: print "---> Generating barycentric file for source", src.name run('%s/makebarycentric.py -T %s -d %s %s %s' % (execdir, options.duration, options.timestep, sourcefilename, baryfilename))
# make a temporary directory here = os.getcwd() workdir = os.path.abspath(tempfile.mkdtemp(dir='.')) # XML and binary filenames for the input (source or barycentric) file xmlfile = os.path.abspath(inputfile) binfile = re.sub('.xml','-0.bin',xmlfile) # XML filename for output (TDI) file; create empty tdifile = os.path.abspath(outputfile) sourcefileobj = lisaxml.lisaXML(tdifile).close() if options.immediate: # process sources in source file, one by one copylisasim(lisasimdir,workdir) # make virtual LISAsim environment inputxml = lisaxml.readXML(xmlfile) for src in inputxml.getLISASources(): sourcefilename = workdir + '/XML/tmpsource.xml' baryfilename = workdir + '/XML/tmpbary_Barycenter.xml' sourcefile = lisaxml.lisaXML(sourcefilename) sourcefile.SourceData(src) sourcefile.close() if options.debug: print "---> Generating barycentric file for source", src.name run('%s/makebarycentric.py -T %s -d %s %s %s' % (execdir,options.duration,options.timestep,sourcefilename,baryfilename)) os.chdir(workdir) if options.debug: print "---> Generating TDI file for source", src.name
(options, args) = parser.parse_args() if options.duration < 10: options.duration = options.duration * 31457280 # for the moment, support a single input barycentric file samples = int(options.duration / options.timestep + 0.1) if len(args) != 2: parser.error("You must specify an input file and an output file!") (inputfile, outputfile) = args inputXML = lisaxml.readXML(inputfile) allsources = inputXML.getLISASources() inputXML.close() sourceobjects = [] settime = False for waveforms in allsources: if hasattr(waveforms, 'RequestSN') and len(allsources) > 1: print "Cannot process multiple sources with RequestSN." sys.exit(1) if hasattr(waveforms, 'RequestTimeOffset') and hasattr( waveforms, 'RequestDuration'): # modify the region where we are making TDI, but not beyond the boundaries
timestep = options.timestep duration = options.duration lcseed = options.seed LISAmodel = options.LISAmodel PhasemF = "Off" ### Define phasemeters' output if(options.rawMeasurements == False): rawcname = "None" outsignals = "t,Xf,Yf,Zf" else: rawcname = cname outsignals = "t,Xf,Yf,Zf,y231,y321,z231,z321,y312,y132,z312,z132,y123,y213,z123,z213" inputsrc = lisaxml.readXML(inputfile) sources = inputsrc.getLISASources() #print "Duration = " , duration #print "TimeOffset = ", timeoffset isrc = 0 for source in sources: isrc = isrc + 1 if hasattr(source,'RequestTimeOffset') and hasattr(source,'RequestDuration'): #print "Request Duration = " , source.RequestDuration #print "Request TimeOffset = ", source.RequestTimeOffset if((timeoffset > source.RequestTimeOffset) or (isrc == 1)): timeoffset = source.RequestTimeOffset if((duration < source.RequestDuration) or (isrc == 1)): duration = source.RequestDuration
(options, args) = parser.parse_args() if len(args) < 1 or len(args) > 2: parser.error( "You must specify one input file (XML), or an input file (XML) and an output file (WAV)!" ) inputfile = args[0] if len(args) == 2: outputfile = args[1] else: outputfile = re.sub('\.xml', '.wav', inputfile) inputxml = lisaxml.readXML(inputfile) tdi = inputxml.getTDIObservables()[0] inputxml.close() DataType = tdi.DataType Length = tdi.TimeSeries.Length Cadence = tdi.TimeSeries.Cadence if tdi.DataType == 'FractionalFrequency': A = (2.0 * tdi.Xf - tdi.Yf - tdi.Zf) / 3.0 E = (tdi.Zf - tdi.Yf) / math.sqrt(3.0) elif tdi.DataType == 'Strain': A = (2.0 * tdi.Xs - tdi.Ys - tdi.Zs) / 3.0 E = (tdi.Zs - tdi.Ys) / math.sqrt(3.0) else: raise
parser = OptionParser(usage="usage: %prog [options] TDIFILE.xml WAVEFILE.wav ...", version="$Id: $") (options, args) = parser.parse_args() if len(args) < 1 or len(args) > 2: parser.error("You must specify one input file (XML), or an input file (XML) and an output file (WAV)!") inputfile = args[0] if len(args) == 2: outputfile = args[1] else: outputfile = re.sub('\.xml','.wav',inputfile) inputxml = lisaxml.readXML(inputfile) tdi = inputxml.getTDIObservables()[0] inputxml.close() DataType = tdi.DataType Length = tdi.TimeSeries.Length Cadence = tdi.TimeSeries.Cadence if tdi.DataType == 'FractionalFrequency': A = (2.0*tdi.Xf - tdi.Yf - tdi.Zf) / 3.0 E = (tdi.Zf - tdi.Yf) / math.sqrt(3.0) elif tdi.DataType == 'Strain': A = (2.0*tdi.Xs - tdi.Ys - tdi.Zs) / 3.0 E = (tdi.Zs - tdi.Ys) / math.sqrt(3.0) else: raise
### Make base XML input file makefromtemplate('%s-LCbase.xml' % cname, '%s/../Template/LISACode2.xml' % execdir, challengename=cname, rawchallengename=rawcname, outputsignals=outsignals, cadence=timestep, duration=duration , timeoffset= timeoffset, randomseed=lcseed, orbit=LISAmodel, phasemeterfilter=PhasemF) ## Make lisacode noise (note that the random seed is really set above in the standard instruction set) #run('makeTDInoise-synthlisa2.py --keyOnly --keyOmitsLISA --seed=123456 --duration=%(duration)s --timeStep=%(timestep)s %(noiseoptions)s SLnoise.xml') #run('mergeXML.py %(cname)s-input.xml noise.xml') #run('rm noise.xml') #### Merge XML file ## Extract informations from LISACode XML input file LCBaseXML = cname + '-LCbase.xml' LCbasefile = lisaxml.readXML(LCBaseXML) LClisa = LCbasefile.getLISAgeometry() LCsources = LCbasefile.getLISASources() LCextrasecs = [] for sec in ['Simulate','LISACode','NoiseData']: if LCbasefile.getExtraSection(sec): LCextrasecs.append(LCbasefile.getExtraSection(sec)) author = "Antoine Petiteau and Michele Vallisneri" comments = LCbasefile.Comment LCbasefile.close() ## Make lisacode noise (note that the random seed is really set above in the standard instruction set) run('makeTDInoise-synthlisa2.py --keyOnly --keyOmitsLISA --seed=123456 --duration=%(duration)s --timeStep=%(timestep)s %(noiseoptions)s SLnoise.xml') ## Extract informations from SyntheticLISA XML noise file SLinputXML = 'SLnoise.xml'
### Make base XML input file makefromtemplate('%s-input.xml' % cname, '%s/../Template/LISACode2.xml' % execdir, challengename=cname, rawchallengename=rawcname, outputsignals=outsignals, cadence=timestep, duration=duration , timeoffset= timeoffset, randomseed=lcseed, orbit=LISAmodel, phasemeterfilter=PhasemF) ### Make GW+noise XML input file if donoise: ## Make lisacode noise (note that the random seed is really set above in the standard instruction set) run('makeTDInoise-synthlisa2.py --keyOnly --keyOmitsLISA --seed=123456 --duration=%(duration)s --timeStep=%(timestep)s %(noiseoptions)s noise.xml') run('mergeXML.py %(cname)s-input.xml noise.xml') run('rm noise.xml') LCinputXML = cname + '-input.xml' ## Merge with source data into a single lisacode input file basefile = lisaxml.readXML(LCinputXML) lisa = basefile.getLISAgeometry() sources = basefile.getLISASources() extrasecs = [] for sec in ['Simulate','LISACode','NoiseData']: if basefile.getExtraSection(sec): extrasecs.append(basefile.getExtraSection(sec)) author = "Antoine Petiteau and Michele Vallisneri" comments = basefile.Comment basefile.close() newbasefile = lisaxml.lisaXML(LCinputXML,author=author,comments=comments) for inputfilename in args: inputfile = lisaxml.readXML(inputfilename) sources = inputfile.getLISASources() if not lisa:
ParamRange.append( 1.e6 ) # 6-MassOfSMBH (for 1.3.1) should be 5.e5 for 132,3 and 1.e5 for 134,5 ParamRange.append("NA") # 7-InitialAzimuthalOrbitalFrequency ParamRange.append(2. * pi) # 8-InitialAzimuthalOrbitalPhase ParamRange.append(options.de) # 9- InitialEccentricity (guess) ParamRange.append(2. * pi) # 10-InitialTildeGamma ParamRange.append(2. * pi) # 11-InitialAlphaAngle ParamRange.append(pi) # 12-LambdaAngle ParamRange.append("NA") # 13-Distance ParamRange.append(5.e7) # 14 to be filled up with Plunge time print ParamRange print "Dealing with ", keyFile inputXML = lisaxml.readXML(keyFile) KeySystems = inputXML.getLISASources() SourceXML = lisaxml.readXML(datFile) RecSystems = SourceXML.getLISASources() fout = open(outF, 'w') spr = " " for key in KeySystems: #print "Keys: ", key.name if (key.name == keyS): for emri in RecSystems: err = [] keyPar = []
ParamRange.append(2. * pi) # 11-InitialAlphaAngle ParamRange.append(pi) # 12-LambdaAngle ParamRange.append("NA") # 13-Distance ParamRange.append(5.e7) # 14 to be filled up with Plunge time print ParamRange if (challengename == "Challenge1.3"): sources = "Source/Challenge1.3/*xml" elif (challengename == "Challenge1B.3"): sources = "Source/Challenge1B.3/*xml" print glob.glob(sources) for xmlKey in KeysChal1_3: inputXML = lisaxml.readXML(xmlKey) KeySystem = inputXML.getLISASources()[0] print "Dealing with ", xmlKey for xmlfile in glob.glob(sources): SourceXML = lisaxml.readXML(xmlfile) RecSystems = SourceXML.getLISASources() if (re.search('3.1', xmlKey) != None and re.search('3.1', xmlfile) != None): print "processing file", xmlfile Errors = FindDeltas("EMRI-1", ParamRange, RecSystems, KeySystem) # print Errors # print ParamRange # print xmlfile # print xmlKey # sys.exit(0) elif (re.search('3.2', xmlKey) != None
(options, args) = parser.parse_args() if options.duration < 10: options.duration = options.duration * 31457280 # for the moment, support a single input barycentric file samples = int( options.duration / options.timestep + 0.1 ) if len(args) != 2: parser.error("You must specify an input file and an output file!") (inputfile,outputfile) = args inputXML = lisaxml.readXML(inputfile) allsources = inputXML.getLISASources() inputXML.close() sourceobjects = [] settime = False for waveforms in allsources: if hasattr(waveforms,'RequestSN') and len(allsources) > 1: print "Cannot process multiple sources with RequestSN." sys.exit(1) if hasattr(waveforms,'RequestTimeOffset') and hasattr(waveforms,'RequestDuration'): # modify the region where we are making TDI, but not beyond the boundaries # of the region requested by command-line arguments
run('mkdir Binary', quiet=True) run('mkdir Data', quiet=True) run('mkdir XML', quiet=True) run('ln -s %s/Data/dwd_GWR_all_pars.dat ./Data/dwd_GWR_all_pars.dat' % galaxydir, quiet=True) run('ln -s %s/Data/Verification.dat ./Data/Verification.dat' % galaxydir, quiet=True) # begin work os.chdir(here) readgalaxy = lisaxml.readXML(galaxyfile) sources = readgalaxy.getLISASources() stream = None for src in sources: if type(src) == lisaxml.PlaneWaveTable: if '-bright' not in src.name: streamlen = src.Table.StreamLength if (src.Table.parameters == [ 'Frequency', 'EclipticLatitude', 'EclipticLongitude', 'Amplitude', 'Inclination', 'Polarization', 'InitialPhase' ] and streamlen > 0): stream = src.Table.StreamName streamseed = 42
(options, args) = parser.parse_args() if len(args) != 3: parser.error("I need the Galaxy input file and the output TDI files!") galaxyfile = args[0] sltdifile = args[1] lstdifile = args[2] galaxywhich = None # find the Galaxy table readgalaxy = lisaxml.readXML(galaxyfile) sources = readgalaxy.getLISASources() stream = None # will use the first PlaneWaveTable it finds, but skip the -bright Galaxies... for src in sources: if type(src) == lisaxml.PlaneWaveTable: if '-bright' not in src.name: streamlen = src.Table.StreamLength # should be easy to generalize this to recognize which Galaxy code should be used if (src.Table.parameters == ['Frequency', 'EclipticLatitude', 'EclipticLongitude','Amplitude', 'Inclination', 'Polarization', 'InitialPhase'] and streamlen > 0):
ParamRange.append(2.*pi) # 11-InitialAlphaAngle ParamRange.append(pi) # 12-LambdaAngle ParamRange.append("NA") # 13-Distance ParamRange.append(5.e7) # 14 to be filled up with Plunge time print ParamRange if (challengename == "Challenge1.3"): sources = "Source/Challenge1.3/*xml" elif (challengename == "Challenge1B.3"): sources = "Source/Challenge1B.3/*xml" print glob.glob(sources) for xmlKey in KeysChal1_3: inputXML = lisaxml.readXML(xmlKey) KeySystem = inputXML.getLISASources()[0] print "Dealing with ", xmlKey for xmlfile in glob.glob(sources): SourceXML = lisaxml.readXML(xmlfile) RecSystems = SourceXML.getLISASources() if (re.search('3.1', xmlKey) != None and re.search('3.1', xmlfile) != None): print "processing file", xmlfile Errors = FindDeltas("EMRI-1", ParamRange, RecSystems, KeySystem) # print Errors # print ParamRange # print xmlfile # print xmlKey # sys.exit(0) elif (re.search('3.2', xmlKey) != None and re.search('3.2', xmlfile) != None): print "processing file", xmlfile
cadence=timestep, duration=duration, timeoffset=timeoffset, randomseed=lcseed, orbit=LISAmodel, phasemeterfilter=PhasemF) ## Make lisacode noise (note that the random seed is really set above in the standard instruction set) #run('makeTDInoise-synthlisa2.py --keyOnly --keyOmitsLISA --seed=123456 --duration=%(duration)s --timeStep=%(timestep)s %(noiseoptions)s SLnoise.xml') #run('mergeXML.py %(cname)s-input.xml noise.xml') #run('rm noise.xml') #### Merge XML file ## Extract informations from LISACode XML input file LCBaseXML = cname + '-LCbase.xml' LCbasefile = lisaxml.readXML(LCBaseXML) LClisa = LCbasefile.getLISAgeometry() LCsources = LCbasefile.getLISASources() LCextrasecs = [] for sec in ['Simulate', 'LISACode', 'NoiseData']: if LCbasefile.getExtraSection(sec): LCextrasecs.append(LCbasefile.getExtraSection(sec)) author = "Antoine Petiteau and Michele Vallisneri" comments = LCbasefile.Comment LCbasefile.close() ## Make lisacode noise (note that the random seed is really set above in the standard instruction set) run('makeTDInoise-synthlisa2.py --keyOnly --keyOmitsLISA --seed=123456 --duration=%(duration)s --timeStep=%(timestep)s %(noiseoptions)s SLnoise.xml' ) ## Extract informations from SyntheticLISA XML noise file SLinputXML = 'SLnoise.xml'
timeoffset=timeoffset, randomseed=lcseed, orbit=LISAmodel, phasemeterfilter=PhasemF) ### Make GW+noise XML input file if donoise: ## Make lisacode noise (note that the random seed is really set above in the standard instruction set) run('makeTDInoise-synthlisa2.py --keyOnly --keyOmitsLISA --seed=123456 --duration=%(duration)s --timeStep=%(timestep)s %(noiseoptions)s noise.xml' ) run('mergeXML.py %(cname)s-input.xml noise.xml') run('rm noise.xml') LCinputXML = cname + '-input.xml' ## Merge with source data into a single lisacode input file basefile = lisaxml.readXML(LCinputXML) lisa = basefile.getLISAgeometry() sources = basefile.getLISASources() extrasecs = [] for sec in ['Simulate', 'LISACode', 'NoiseData']: if basefile.getExtraSection(sec): extrasecs.append(basefile.getExtraSection(sec)) author = "Antoine Petiteau and Michele Vallisneri" comments = basefile.Comment basefile.close() newbasefile = lisaxml.lisaXML(LCinputXML, author=author, comments=comments) for inputfilename in args: inputfile = lisaxml.readXML(inputfilename) sources = inputfile.getLISASources() if not lisa:
for i in xrange(sz): if i !=0: Detfiles[i] = Detfiles[i][:-1] # To do: Need to read quadrutures as well... if options.phasemax : if ( re.search('challenge2.2', Injfile) == None ): print "phase maximization can be done only for 2.2 chalenge" sys.exit(1) # Reading the data Datatdifile = lisaxml.readXML(Datafile) tdiData = Datatdifile.getTDIObservables()[0] Xdata = tdiData.Xf Adata = (2.0*tdiData.Xf -tdiData.Yf - tdiData.Zf)/3.0 Edata = (tdiData.Zf - tdiData.Yf)/math.sqrt(3.0) samples = Numeric.shape(Xdata)[0] # computing useful number of points pdlen3 = samples/2 nyquistf = 0.5/15.0 # !!! hardcoded !!!! freqs = Numeric.arange(0,pdlen3+1,dtype='d') * (nyquistf / pdlen3) ind = 0 for i in xrange(pdlen3): if (freqs[i] > fLow and freqs[i]<= fHigh): ind += 1
tdiGens = [] if(re.search("X", options.tdidata) != None): tdiGens.append('X') if(re.search("Y", options.tdidata) != None): tdiGens.append('Y') if(re.search("Z", options.tdidata) != None): tdiGens.append('Z') for tdiG in tdiGens: print "--> For TDI ", tdiG , ":" X = [] for Sim in xrange(len(args)): Datatdifile = lisaxml.readXML(args[Sim]) tdiData = Datatdifile.getTDIObservables()[0] if (Sim == 0): stime = tdiData.TimeSeries.Cadence else: if (stime != tdiData.TimeSeries.Cadence): print "All the file should have the same time step." sys.exit() if ( (UsedSim[Sim] == 'SL') or (UsedSim[Sim] == 'LC') ): if (options.verbose): if (UsedSim[Sim] == 'SL'): print " --> Read synthlisa data : ", args[Sim], " ..." else: print " --> Read lisacode data : ", args[Sim], " ..." if(tdiG == 'X'): X.append(tdiData.Xf)