Exemple #1
0
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
Exemple #2
0
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
    if options.rawMeasurements:
        y123 *= factor
        y231 *= factor
        y312 *= factor
        y321 *= factor
        y132 *= factor
        y213 *= factor
        z123 *= factor
        z231 *= factor
        z312 *= factor
        z321 *= factor
        z132 *= factor
        z213 *= factor

tdiobs = lisaxml.Observable(obsstr)
tdiobs.TimeSeries = lisaxml.TimeSeries([t, X, Y, Z], obsstr)

tdiobs.DataType = 'FractionalFrequency'
tdiobs.TimeSeries.Cadence = options.timestep
tdiobs.TimeSeries.TimeOffset = options.inittime

if options.rawMeasurements:
    tdiobsraw = lisaxml.Observable(
        't,y123f,y231f,y312f,y321f,y132f,y213f,z123f,z231f,z312f,z321f,z132f,z213f'
    )
    tdiobsraw.TimeSeries = lisaxml.TimeSeries([
        t, y123, y231, y312, y321, y132, y213, z123, z231, z312, z321, z132,
        z213
    ], 't,y123f,y231f,y312f,y321f,y132f,y213f,z123f,z231f,z312f,z321f,z132f,z213f'
                                              )
Exemple #4
0
    # impose polarization on waveform if given

    if hasattr(mysystem,
               'Polarization') and (not hasattr(mysystem, 'dopolarization')
                                    or not mysystem.dopolarization):
        pol = mysystem.Polarization

        hp = math.cos(2 * pol) * hp0 + math.sin(2 * pol) * hc0
        hc = -math.sin(2 * pol) * hp0 + math.cos(2 * pol) * hc0
    else:
        hp = hp0
        hc = hc0

    if options.debug == True and mysystem.xmltype == 'ExtremeMassRatioInspiral':
        mysystem.TimeSeries = lisaxml.TimeSeries(
            (hp, hc, Ap, Ac, ga, al, ps, pl),
            'hp,hc,Ap,Ac,gamma,alpha,psi,psisl')
    else:
        mysystem.TimeSeries = lisaxml.TimeSeries((hp, hc), 'hp,hc')

    mysystem.TimeSeries.Cadence = options.timestep
    mysystem.TimeSeries.TimeOffset = initialtime

    if options.singleOutput or len(allsystems) == 1:
        outputXML.SourceData(mysystem)
    else:
        if options.sourcename:
            filestr = mysystem.name
        else:
            filestr = '%d' % cnt
Exemple #5
0
    del waveforms.RequestSN

    outputXML = lisaxml.lisaXML(
        inputfile, author='makeTDIsignal-synthlisa.py, MV/SB 20061129')
    outputXML.SourceData(waveforms)
    outputXML.close()

    X *= factor
    Y *= factor
    Z *= factor

tdiobs = lisaxml.Observable('t,Xf,Yf,Zf')

tdiobs.DataType = 'FractionalFrequency'

tdiobs.TimeSeries = lisaxml.TimeSeries([t, X, Y, Z], 't,Xf,Yf,Zf')
tdiobs.TimeSeries.Cadence = options.timestep
tdiobs.TimeSeries.TimeOffset = options.inittime

outputXML = lisaxml.lisaXML(outputfile)

# save the standard LISA...

lisa = lisaxml.LISA('Standard MLDC PseudoLISA')
lisa.TimeOffset = 0
lisa.TimeOffset_Unit = 'Second'
lisa.InitialPosition = 0
lisa.InitialPosition_Unit = 'Radian'
lisa.InitialRotation = 0
lisa.InitialRotation_Unit = 'Radian'
lisa.Armlength = 16.6782
Exemple #6
0
Xf = numpy.zeros(datalen, 'd')
Yf = numpy.zeros(datalen, 'd')
Zf = numpy.zeros(datalen, 'd')

norm = (1e10 / 299792458.0) / 15.0

Xf[1:datalen] = norm * (tdi.Xs[1:datalen] - tdi.Xs[0:(datalen - 1)])
Yf[1:datalen] = norm * (tdi.Ys[1:datalen] - tdi.Ys[0:(datalen - 1)])
Zf[1:datalen] = norm * (tdi.Zs[1:datalen] - tdi.Zs[0:(datalen - 1)])

Xf[0] = Xf[1]
Yf[0] = Yf[1]
Zf[0] = Zf[1]

if tdi.DataType == 'Strain':
    tdinew = lisaxml.Observable('t,Xf,Yf,Zf')

    tdinew.DataType = 'FractionalFrequency'

    tdinew.TimeSeries = lisaxml.TimeSeries([t, Xf, Yf, Zf], 't,Xf,Yf,Zf')
    tdinew.TimeSeries.Cadence = tdi.TimeSeries.Cadence
    tdinew.TimeSeries.TimeOffset = tdi.TimeSeries.TimeOffset

    outputtdifile.TDIData(tdinew)
else:
    outputtdifile.TDIData(tdi)

outputtdifile.close()

sys.exit(0)