示例#1
0
def sinegaussian_example(axes1, axes2, e, pol):
    axes1.grid(True)
    axes2.grid(True)

    hp, hc = lalsimulation.SimBurstSineGaussian(8.89, 250., 1., e, pol,
                                                1. / 16384)
    print("measured hrss = %.17g" % lalsimulation.MeasureHrss(hp, hc))
    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((-15, +15))
    axes1.set_xlabel(r"Time (seconds)")
    axes1.set_ylabel(r"Strain")
    axes1.set_title(
        r"$f_{0} = 250\,\mathrm{Hz}$, $Q = 8.89$, $h_{\mathrm{rss}} = 1$, $\epsilon = %g$, $\phi = %g \pi$"
        % (e, pol / math.pi))
    axes1.legend()
    axes2.plot(hc.data.data, hp.data.data, color="k")
    axes2.set_xlim((-15, +15))
    axes2.set_ylim((-15, +15))
    axes2.set_xlabel(r"$h_{\times}$")
    axes2.set_ylabel(r"$h_{+}$")
    axes2.set_title(
        r"$f_{0} = 250\,\mathrm{Hz}$, $Q = 8.89$, $h_{\mathrm{rss}} = 1$, $\epsilon = %g$, $\phi = %g \pi$"
        % (e, pol / math.pi))
    axes2.set_aspect(1., adjustable="box")
示例#2
0
centre_frequency = 350.0
chirp_rate = -5000.0
hrss = 1.0

# -----------------------------------------
# Plus-polarised time-domain waveform
#

print " -----------------------------------------------"
print ""
print "Generating plus-polarised TD Chirplet waveform"
alpha = 0.0
hp_tmp, hc_tmp = lalsim.SimBurstChirplet(Q, centre_frequency, chirp_rate, hrss, alpha,
        phi0, delta_t)
print "Check hrss:  desired=%f, actual=%f"%(hrss,
        lalsim.MeasureHrss(hp_tmp,hc_tmp))

# Put data in pycbc TimeSeries object for further manipulation
times = np.arange(0, hp_tmp.data.length * delta_t, delta_t) + hp_tmp.epoch
hp = pycbc.types.TimeSeries(initial_array=hp_tmp.data.data, delta_t=delta_t,
        epoch=hp_tmp.epoch)
hc = pycbc.types.TimeSeries(initial_array=hc_tmp.data.data, delta_t=delta_t,
        epoch=hc_tmp.epoch)

#
# Make plots
#


f,ax = pl.subplots(nrows=1, ncols=2, figsize=(10,4))
示例#3
0
 def measure_hrss(self, deltaT=None, detector=None):
     sampling_rate = 4 * (self.frequency + (self.bandwidth or 0))
     sampling_rate = 2**(int(math.log(sampling_rate, 2) + 1))
     hp, hx = self.time_series(sampling_rate)
     return lalsimulation.MeasureHrss(hp, hx)
                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)
示例#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)