Commit 8f726ccb authored by Richard O'Shaughnessy's avatar Richard O'Shaughnessy

generate*psd : used in test cases, needed to be upgraded to modern code

parent 2d88c23c
......@@ -4,18 +4,16 @@ import lalsimulation
from glue.ligolw import utils
from pylal.series import make_psd_xmldoc
from pylal.xlal.datatypes.ligotimegps import LIGOTimeGPS
from pylal.xlal.datatypes.real8frequencyseries import REAL8FrequencySeries
from pylal.xlal.datatypes.lalunit import LALUnit
from lal.series import make_psd_xmldoc
import lal
from optparse import OptionParser
optp = OptionParser()
optp.add_option("-n", "--nyquist", type=float, default=2048.0, help="Set the nyquist frequency of the PSD. Default is 2048 Hz.")
optp.add_option("-d", "--delta-f", type=float, default=1.0/16, help="Set frequency bin size in Hz. Default is 1/16 Hz.")
optp.add_option("-f", "--low-frequency", type=float, default=0.0, help="Set the low frequency in Hz of the output PSD. Default is zero.")
#optp.add_option( "--ifo", type=str, default="H1", help="Set the low frequency in Hz of the output PSD. Default is zero.")
opts, args = optp.parse_args()
# Generate iLIGO PSD
......@@ -26,10 +24,12 @@ psd = numpy.array(map(lalsimulation.SimNoisePSDaLIGOZeroDetHighPower, f))
psd[0] = 0
# Generate the frequency series
epoch = LIGOTimeGPS(0.0)
epoch = lal.LIGOTimeGPS(0.0)
psddict = {}
d=opts.ifo
for d in ["H1", "L1", "V1"]:
psd_s = REAL8FrequencySeries(name="aLIGO PSD", epoch=epoch, f0=f0, deltaF=df, sampleUnits=LALUnit(""), data=psd)
psd_s = lal.CreateREAL8FrequencySeries(name=d, epoch=epoch, f0=f0, deltaF=df, sampleUnits="s", length=len(psd))
psd_s.data.data = psd
psddict[d] = psd_s
xmldoc = make_psd_xmldoc(psddict)
......
......@@ -4,11 +4,8 @@ import lalsimulation
from glue.ligolw import utils
from pylal.series import make_psd_xmldoc
from pylal.xlal.datatypes.ligotimegps import LIGOTimeGPS
from pylal.xlal.datatypes.real8frequencyseries import REAL8FrequencySeries
from pylal.xlal.datatypes.lalunit import LALUnit
from lal.series import make_psd_xmldoc
import lal
from optparse import OptionParser
......@@ -26,10 +23,11 @@ psd = numpy.array(map(lalsimulation.SimNoisePSDiLIGOSRD, f))
psd[0] = 0
# Generate the frequency series
epoch = LIGOTimeGPS(0.0)
epoch = lal.LIGOTimeGPS(0.0)
psddict = {}
for d in ["H1", "L1", "V1"]:
psd_s = REAL8FrequencySeries(name="iLIGO PSD", epoch=epoch, f0=f0, deltaF=df, sampleUnits=LALUnit(""), data=psd)
psd_s = lal.CreateREAL8FrequencySeries(name=d, epoch=epoch, f0=f0, deltaF=df, sampleUnits="s", length=len(psd))
psd_s.data.data = psd
psddict[d] = psd_s
xmldoc = make_psd_xmldoc(psddict)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment