def product(self, other): assert self.dt == other.dt assert self.len == other.len lowi = max(1, self.fLow / self.df) highi = min(self.len / 2, self.fHigh / self.df) sn, st = lisanoise(self.f[lowi:highi]) intA = 4.0 / (self.len**2 * self.df) * numpy.conj( self.At[lowi:highi]) * other.At[lowi:highi] / sn intE = 4.0 / (self.len**2 * self.df) * numpy.conj( self.Et[lowi:highi]) * other.Et[lowi:highi] / sn intT = 4.0 / (self.len**2 * self.df) * numpy.conj( self.Tt[lowi:highi]) * other.Tt[lowi:highi] / st if options.outputIntegrand: # ints = numpy.concatenate((self.f[lowi:highi],sn,st)) tdistr = 'f,Are,Aim,Ere,Eim,Tre,Tim' tdiobs = lisaxml.Observable(tdistr) tdiobs.FrequencySeries = lisaxml.FrequencySeries([ self.f[lowi:highi], intA.real, intA.imag, intE.real, intE.imag, intT.real, intT.imag ], tdistr) tdiobs.DataType = 'FractionalFrequency' tdiobs.FrequencySeries.Cadence = self.df tdiobs.FrequencySeries.Cadence_Unit = 'Hertz' tdiobs.FrequencySeries.FrequencyOffset = self.f[lowi] tdiobs.FrequencySeries.FrequencyOffset_Unit = 'Hertz' outputXML = lisaxml.lisaXML(options.outputIntegrand) outputXML.TDIData(tdiobs) outputXML.close() innerA = numpy.sum(intA) innerE = numpy.sum(intE) innerT = numpy.sum(intT) res = resprod() res.A = innerA.real res.E = innerE.real res.T = innerT.real return res
parser.error("I need at least one file to work with.") if options.nokey and options.keyonly: parser.error("Conflicting options --keyOnly and --noKey.") outputfile = options.outputfile and options.outputfile or args[0] inputfiles = args[0:] observables = {}; obslist = [] sources = [] uniquesecs = {}; seclist = [] comments = '' for i,filename in enumerate(inputfiles): xml = lisaxml2.lisaXML(filename,'r') if xml.Comment: # TODO: better provenance tracking comments += (comments and '\n' or '') # add a newline if we have something already comments += '(From %s.)' % f comments += xml.Comment # accumulate comments for sec in xml: if len(sec) > 0: if sec.Type == 'TDIData' and not (options.keyonly and i > 0): for obs in sec: obsname = obs.TimeSeries.name if obsname not in obslist: # collect the first instance of every observable set observables[obsname] = obs obslist.append(obsname) else:
if options.nokey and options.keyonly: parser.error("Conflicting options --keyOnly and --noKey.") outputfile = options.outputfile and options.outputfile or args[0] inputfiles = args[0:] observables = {} obslist = [] sources = [] uniquesecs = {} seclist = [] comments = '' for i, filename in enumerate(inputfiles): xml = lisaxml2.lisaXML(filename, 'r') if xml.Comment: # TODO: better provenance tracking comments += (comments and '\n' or '') # add a newline if we have something already comments += '(From %s.)' % f comments += xml.Comment # accumulate comments for sec in xml: if len(sec) > 0: if sec.Type == 'TDIData' and not (options.keyonly and i > 0): for obs in sec: obsname = obs.TimeSeries.name if obsname not in obslist: # collect the first instance of every observable set observables[obsname] = obs obslist.append(obsname)
help="display progress [off by default]") (options, args) = parser.parse_args() if len(args) < 1: parser.error("You must specify an output file!") if options.duration < 10: options.duration = options.duration * 31457280 if options.seed == None: parser.error("You must specify the seed!") # open the output file outputfile = args[0] outputXML = lisaxml.lisaXML(outputfile,'w') # set the noise seed random.seed(options.seed) # make LISA, add caching? if options.armlength == 'Standard': if options.LISAmodel == 'Eccentric': lisa = synthlisa.EccentricInclined(0.0,1.5*pi,-1) elif options.LISAmodel == 'Static': lisa = synthlisa.OriginalLISA() elif options.LISAmodel == 'Rigid': lisa = synthlisa.CircularRotating(0.0,1.5*pi,-1) else: try: lisa = synthlisa.makeSampledLISA(options.LISAmodel)
author = getattr(mergedtdifile, 'Author', None) if not author and 'USER' in os.environ: author = os.environ['USER'] else: author = 'mergeXML.py' # it would be nice also to collect comments from the additional files... # but lisaxml2.py does not currently support this! comments = mergedtdifile.Comment mergedtdifile.close() if options.outputfile: newmergedtdifile = lisaxml2.lisaXML(options.outputfile, author=author, comments=comments) else: newmergedtdifile = lisaxml2.lisaXML(mergedfile, author=author, comments=comments) if not options.nokey: for source in sources: newmergedtdifile.SourceData(source) for inputfile in inputfiles: if options.debug: print "---> Processing", inputfile inputtdifile = lisaxml2.readXML(inputfile) # will use the first LISA that it finds anywhere...
author = getattr(mergedtdifile,'Author',None) if not author and 'USER' in os.environ: author = os.environ['USER'] else: author = 'mergeXML.py' # it would be nice also to collect comments from the additional files... # but lisaxml2.py does not currently support this! comments = mergedtdifile.Comment mergedtdifile.close() if options.outputfile: newmergedtdifile = lisaxml2.lisaXML(options.outputfile,author=author,comments=comments) else: newmergedtdifile = lisaxml2.lisaXML(mergedfile,author=author,comments=comments) if not options.nokey: for source in sources: newmergedtdifile.SourceData(source) for inputfile in inputfiles: if options.debug: print "---> Processing", inputfile inputtdifile = lisaxml2.readXML(inputfile) # will use the first LISA that it finds anywhere... if not lisa: lisa = inputtdifile.getLISAgeometry()
parser.add_option("-N", "--firstN", type="int", dest="firstN", default=None, help="limit total number of lines printed") (options, args) = parser.parse_args() if len(args) != 2: parser.error( "You must specify the input lisaXML file and the output text file!") lisaxml.Table.DisableRemoteTableLoad = True srcfile = lisaxml.lisaXML(args[0], 'r') table = srcfile.SourceData[0] outfile = open(args[1], 'w') count = 0 for s in table.makeTableSources(): # if not (f0 < s.Frequency < f1) and not (f2 < s.Frequency < f3) and not (f4 < s.Frequency < f5): # continue if options.addCount: print >> outfile, count, print >> outfile, s.Frequency, s.FrequencyDerivative, s.EclipticLatitude, s.EclipticLongitude, print >> outfile, ( options.logAmplitude and 10**s.Amplitude or s.Amplitude), s.Inclination, s.Polarization, s.InitialPhase
parser.add_option("-l", "--logAmplitude", action="store_true", dest="logAmplitude", default=False, help="assume the Amplitude column is given as log10 (off by default)") parser.add_option("-N", "--firstN", type="int", dest="firstN", default=None, help="limit total number of lines printed") (options, args) = parser.parse_args() if len(args) != 2: parser.error("You must specify the input lisaXML file and the output text file!") lisaxml.Table.DisableRemoteTableLoad = True srcfile = lisaxml.lisaXML(args[0],'r') table = srcfile.SourceData[0] outfile = open(args[1],'w') count = 0 for s in table.makeTableSources(): # if not (f0 < s.Frequency < f1) and not (f2 < s.Frequency < f3) and not (f4 < s.Frequency < f5): # continue if options.addCount: print >> outfile, count, print >> outfile, s.Frequency, s.FrequencyDerivative, s.EclipticLatitude, s.EclipticLongitude, print >> outfile, (options.logAmplitude and 10**s.Amplitude or s.Amplitude), s.Inclination, s.Polarization, s.InitialPhase # print >> outfile, s.Frequency, s.EclipticLatitude, s.EclipticLongitude, s.Amplitude,
# prepare a lisaXML table structure with the binary parameters we've just generated table = lisaxml2.Table(numpy.array(binaries,'d'),len(binaries),len(binaries[0]), name=options.galaxyName,filetype='Remote',encoding='Text') # set up the Column names table.Frequency = None; table.Frequency_Unit = 'Hz' if options.centerdotf != None: table.FrequencyDerivative = None; table.FrequencyDerivative_Unit = 'Hz/Second' table.EclipticLatitude = None; table.EclipticLatitude_Unit = 'Radian' table.EclipticLongitude = None; table.EclipticLongitude_Unit = 'Radian' table.Amplitude = None; table.Amplitude = '1' table.Inclination = None; table.Inclination = 'Radian' table.Polarization = None; table.Polarization = 'Radian' table.InitialPhase = None; table.InitialPhase = 'Radian' # make a lisaXML SourceTable object mygalaxy = lisaxml2.SourceTable('GalacticBinary',name=options.galaxyName) mygalaxy.__dict__['Table'] = table # write out the XML file outputXML = lisaxml2.lisaXML(outXMLfile,author='M. Vallisneri') outputXML.SourceData.append(mygalaxy) outputXML.close()