示例#1
0
def btlwnb_example(axes1, axes2, f0, dof, duration, e, pol):
	axes1.grid(True)
	axes2.grid(True)

	# dof/2 = dof in each polarization
	bandwidth = dof/2 * (2./math.pi) / duration

	import lal
	import lalburst
	simburst_row = lalburst.CreateSimBurst()
	simburst_row.waveform = "BTLWNB"
	simburst_row.egw_over_rsquared = 1. / (lal.GMSUN_SI * 4 / lal.C_SI / lal.PC_SI / lal.PC_SI)
	simburst_row.waveform_number = 0
	simburst_row.duration = duration
	simburst_row.frequency = f0
	simburst_row.bandwidth = bandwidth
	simburst_row.pol_ellipse_e = e
	simburst_row.pol_ellipse_angle = pol
	hp, hc = lalburst.GenerateSimBurst(simburst_row, 1./16384)

	t = float(hp.epoch) + numpy.arange(0., len(hp.data.data)) * hp.deltaT
	axes1.plot(t, hp.data.data, label = r"$h_{+}$")
	t = float(hc.epoch) + numpy.arange(0., len(hc.data.data)) * hc.deltaT
	axes1.plot(t, hc.data.data, label = r"$h_{\times}$")
	axes1.set_ylim((-0.015, +0.015))
	axes1.set_xlabel(r"Time (seconds)")
	axes1.set_ylabel(r"Strain")
	axes1.set_title(r"$\int(\dot{h}_{+}^{2} + \dot{h}_{\times}^{2})\,\mathrm{d}t = 1$, $f_{0} = %g\,\mathrm{Hz}$, $\Delta t = %g\,\mathrm{s}$, $%g\,\mathrm{DOF}$ ($\Delta f = %g\,\mathrm{Hz}$), $\epsilon = %g$, $\phi = %g \pi$" % (f0, duration, dof, bandwidth, e, pol / math.pi))
	axes1.legend()
	axes2.plot(hc.data.data, hp.data.data, color = "k")
	axes2.set_xlim((-0.015, +0.015))
	axes2.set_ylim((-0.015, +0.015))
	axes2.set_xlabel(r"$h_{\times}$")
	axes2.set_ylabel(r"$h_{+}$")
	axes2.set_aspect(1., adjustable = "box")
示例#2
0
    def time_series(self, sampling_rate, detector=None):
        """
        Generate a time series at a given sampling_rate (Hz) for the waveform using a call to lalsimulation. If detector is None (default), return only the (h+, hx) tuple. Otherwise, apply the proper detector anntenna patterns and return the resultant series F+h+ + Fxhx.
        """

        hp, hx = lalburst.GenerateSimBurst(copy_sim_burst(self),
                                           1.0 / sampling_rate)

        if detector is None:
            return hp, hx

        detector = LAL_DETECTORS[detector]
        return lalsimulation.SimDetectorStrainREAL8TimeSeries(
            hp, hx, self.ra, self.dec, self.psi, detector)
                1.0 - options.overlap_fraction)
            gps = options.gps_start_time + i * options.delta_t * (
                1.0 - options.overlap_fraction)
            row.time_geocent_gps, row.time_geocent_gps_ns = gps.seconds, gps.nanoseconds
            row.bandwidth = options.delta_f
            row.duration = options.delta_t

            # amplitude.  hrss column is ignored by waveform
            # generation code.  it is included for convenience.
            # the waveform is normalized by generating the
            # burst, measuring its hrss, then rescaling to
            # achieve the desired value.  this process requires
            # the sample rate to be known.
            row.hrss = options.hrss_scale * img.getpixel(
                (i, height - 1 - j)) / 255.0
            if row.hrss != 0:
                row.egw_over_rsquared = 1
                row.egw_over_rsquared *= row.hrss / lalsimulation.MeasureHrss(
                    *lalburst.GenerateSimBurst(row, 1.0 / 16384))
                sim_burst_tbl.append(row)
            if options.verbose:
                print >> sys.stderr, "generating sim_burst table ... %d injections\r" % len(
                    sim_burst_tbl),
    if options.verbose:
        print >> sys.stderr

ligolw_utils.write_filename(xmldoc,
                            options.output,
                            gz=(options.output or "stdout").endswith(".gz"),
                            verbose=options.verbose)
示例#4
0
#

# nyquist frequency is determined by DATA. preferably a power of 2.
if opts.nyquist_frequency is not None:
	fnyq = opts.nyquist_frequency
else:
	fnyq = 16.

deltaT = 1./(2.*fnyq)

#
## Use lalburst to generate hp, hx for specified waveforms.
#

# note index selects a single row from the simBurst table
wnb_hp, wnb_hx = lalburst.GenerateSimBurst(waveforms["BTLWNB"][1], deltaT)
sg_hp, sg_hx = lalburst.GenerateSimBurst(waveforms["SineGaussian"][0], deltaT)

#if opts.waveform_length == None:
#	deltaF = 1./waveforms["BTLWNB"][1].duration
#	print 'deltaF = ', deltaF
#else:
#	deltaF = 1./waveform_length

#
## Establish the hrss
#

# define detectors in swigland notation
det = lal.lalCachedDetectors[lal.LAL_LHO_4K_DETECTOR]
示例#5
0
                (1.0 - options.overlap_fraction),
                frequency=options.f_low + j * options.delta_f *
                (1.0 - options.overlap_fraction),
                bandwidth=options.delta_f,
                duration=options.delta_t,

                # brightness.  hrss is ignored, set
                # egw_over_rsquared to 1, to be re-scaled
                # after measuring waveform's real
                # brightness
                hrss=hrss,
                egw_over_rsquared=1.)

            # generate waveform, then scale egw_over_rsquared
            # to get desired brightness
            row.egw_over_rsquared *= hrss / lalsimulation.MeasureHrss(
                *lalburst.GenerateSimBurst(row, 1.0 / options.sample_rate))

            # put row into table
            sim_burst_tbl.append(row)
    del progress

#
# write output
#

ligolw_utils.write_filename(xmldoc,
                            options.output,
                            gz=(options.output or "stdout").endswith(".gz"),
                            verbose=options.verbose)