def test_bwm(self):
        """Test BWM waveform."""
        log10_h = parameter.Uniform(-20, -11)('bwm_log10_h')
        cos_gwtheta = parameter.Uniform(-1, 1)('bwm_cos_gwtheta')
        gwphi = parameter.Uniform(0, 2*np.pi)('bwm_gwphi')
        gwpol = parameter.Uniform(0, np.pi)('bwm_gwpol')
        t0 = parameter.Uniform(53000, 57000)('bwm_t0')
        bwm_wf = utils.bwm_delay(log10_h=log10_h, cos_gwtheta=cos_gwtheta,
                                 gwphi=gwphi, gwpol=gwpol, t0=t0)
        bwm = deterministic_signals.Deterministic(bwm_wf)
        m = bwm(self.psr)

        # true parameters
        log10_h = -14
        cos_gwtheta = 0.5
        gwphi = 0.5
        gwpol = 0.0
        t0 = 55000
        params = {'bwm_log10_h': log10_h, 'bwm_cos_gwtheta': cos_gwtheta,
                  'bwm_gwphi': gwphi, 'bwm_gwpol': gwpol, 'bwm_t0': t0}

        d1 = utils.bwm_delay(self.psr.toas, self.psr.pos, log10_h=log10_h,
                             cos_gwtheta=cos_gwtheta, gwphi=gwphi,
                             gwpol=gwpol, t0=t0)

        # test
        msg = 'BWM Delay incorrect'
        assert np.all(m.get_delay(params) == d1), msg
Beispiel #2
0
    def test_bwm(self):
        """Tests :meth:`enterprise.signals.deterministic_signals.Deterministic`
        using the burst-with-memory function :func:`enterprise.signals.utils.bwm_delay`.
        The test instantiates a deterministic Signal on our test pulsar, and
        compares the array returned by calling `get_delay()` on the Signal
        with a fixed dictionary of parameters, with the result of calling
        the function directly with those parameters.
        """

        log10_h = parameter.Uniform(-20, -11)("bwm_log10_h")
        cos_gwtheta = parameter.Uniform(-1, 1)("bwm_cos_gwtheta")
        gwphi = parameter.Uniform(0, 2 * np.pi)("bwm_gwphi")
        gwpol = parameter.Uniform(0, np.pi)("bwm_gwpol")
        t0 = parameter.Uniform(53000, 57000)("bwm_t0")

        bwm_wf = utils.bwm_delay(log10_h=log10_h,
                                 cos_gwtheta=cos_gwtheta,
                                 gwphi=gwphi,
                                 gwpol=gwpol,
                                 t0=t0)

        bwm = deterministic_signals.Deterministic(bwm_wf)
        m = bwm(self.psr)

        # true parameters
        log10_h = -14
        cos_gwtheta = 0.5
        gwphi = 0.5
        gwpol = 0.0
        t0 = 55000
        params = {
            "bwm_log10_h": log10_h,
            "bwm_cos_gwtheta": cos_gwtheta,
            "bwm_gwphi": gwphi,
            "bwm_gwpol": gwpol,
            "bwm_t0": t0,
        }

        d1 = utils.bwm_delay(self.psr.toas,
                             self.psr.pos,
                             log10_h=log10_h,
                             cos_gwtheta=cos_gwtheta,
                             gwphi=gwphi,
                             gwpol=gwpol,
                             t0=t0)

        # test
        msg = "BWM Delay incorrect"
        assert np.all(m.get_delay(params) == d1), msg
Beispiel #3
0
def bwm_block(Tmin,
              Tmax,
              amp_prior='log-uniform',
              skyloc=None,
              logmin=-18,
              logmax=-11,
              name='bwm'):
    """
    Returns deterministic GW burst with memory model:
        1. Burst event parameterized by time, sky location,
        polarization angle, and amplitude
    :param Tmin:
        Min time to search, probably first TOA (MJD).
    :param Tmax:
        Max time to search, probably last TOA (MJD).
    :param amp_prior:
        Prior on log10_A. Default if "log-uniform". Use "uniform" for
        upper limits.
    :param skyloc:
        Fixed sky location of BWM signal search as [cos(theta), phi].
        Search over sky location if ``None`` given.
    :param logmin:
        log of minimum BWM amplitude for prior (log10)
    :param logmax:
        log of maximum BWM amplitude for prior (log10)
    :param name:
        Name of BWM signal.
    """

    # BWM parameters
    amp_name = '{}_log10_A'.format(name)
    if amp_prior == 'uniform':
        log10_A_bwm = parameter.LinearExp(logmin, logmax)(amp_name)
    elif amp_prior == 'log-uniform':
        log10_A_bwm = parameter.Uniform(logmin, logmax)(amp_name)

    pol_name = '{}_pol'.format(name)
    pol = parameter.Uniform(0, np.pi)(pol_name)

    t0_name = '{}_t0'.format(name)
    t0 = parameter.Uniform(Tmin, Tmax)(t0_name)

    costh_name = '{}_costheta'.format(name)
    phi_name = '{}_phi'.format(name)
    if skyloc is None:
        costh = parameter.Uniform(-1, 1)(costh_name)
        phi = parameter.Uniform(0, 2 * np.pi)(phi_name)
    else:
        costh = parameter.Constant(skyloc[0])(costh_name)
        phi = parameter.Constant(skyloc[1])(phi_name)

    # BWM signal
    bwm_wf = utils.bwm_delay(log10_h=log10_A_bwm,
                             t0=t0,
                             cos_gwtheta=costh,
                             gwphi=phi,
                             gwpol=pol)
    bwm = deterministic_signals.Deterministic(bwm_wf, name=name)

    return bwm
    def test_bwm(self):
        """Test BWM waveform."""
        log10_h = parameter.Uniform(-20, -11)("bwm_log10_h")
        cos_gwtheta = parameter.Uniform(-1, 1)("bwm_cos_gwtheta")
        gwphi = parameter.Uniform(0, 2 * np.pi)("bwm_gwphi")
        gwpol = parameter.Uniform(0, np.pi)("bwm_gwpol")
        t0 = parameter.Uniform(53000, 57000)("bwm_t0")
        bwm_wf = utils.bwm_delay(log10_h=log10_h,
                                 cos_gwtheta=cos_gwtheta,
                                 gwphi=gwphi,
                                 gwpol=gwpol,
                                 t0=t0)
        bwm = deterministic_signals.Deterministic(bwm_wf)
        m = bwm(self.psr)

        # true parameters
        log10_h = -14
        cos_gwtheta = 0.5
        gwphi = 0.5
        gwpol = 0.0
        t0 = 55000
        params = {
            "bwm_log10_h": log10_h,
            "bwm_cos_gwtheta": cos_gwtheta,
            "bwm_gwphi": gwphi,
            "bwm_gwpol": gwpol,
            "bwm_t0": t0,
        }

        d1 = utils.bwm_delay(self.psr.toas,
                             self.psr.pos,
                             log10_h=log10_h,
                             cos_gwtheta=cos_gwtheta,
                             gwphi=gwphi,
                             gwpol=gwpol,
                             t0=t0)

        # test
        msg = "BWM Delay incorrect"
        assert np.all(m.get_delay(params) == d1), msg
Beispiel #5
0
    def test_bwm(self):
        """Test BWM waveform."""
        log10_h = parameter.Uniform(-20, -11)('bwm_log10_h')
        cos_gwtheta = parameter.Uniform(-1, 1)('bwm_cos_gwtheta')
        gwphi = parameter.Uniform(0, 2 * np.pi)('bwm_gwphi')
        gwpol = parameter.Uniform(0, np.pi)('bwm_gwpol')
        t0 = parameter.Uniform(53000, 57000)('bwm_t0')
        bwm_wf = utils.bwm_delay(log10_h=log10_h,
                                 cos_gwtheta=cos_gwtheta,
                                 gwphi=gwphi,
                                 gwpol=gwpol,
                                 t0=t0)
        bwm = deterministic_signals.Deterministic(bwm_wf)
        m = bwm(self.psr)

        # true parameters
        log10_h = -14
        cos_gwtheta = 0.5
        gwphi = 0.5
        gwpol = 0.0
        t0 = 55000
        params = {
            'bwm_log10_h': log10_h,
            'bwm_cos_gwtheta': cos_gwtheta,
            'bwm_gwphi': gwphi,
            'bwm_gwpol': gwpol,
            'bwm_t0': t0
        }

        d1 = utils.bwm_delay(self.psr.toas,
                             self.psr.pos,
                             log10_h=log10_h,
                             cos_gwtheta=cos_gwtheta,
                             gwphi=gwphi,
                             gwpol=gwpol,
                             t0=t0)

        # test
        msg = 'BWM Delay incorrect'
        assert np.all(m.get_delay(params) == d1), msg
Beispiel #6
0
rn_pl = utils.powerlaw(log10_A=rn_log10_A, gamma=rn_gamma)
rn = gp_signals.FourierBasisGP(rn_pl, components=30, Tspan=Tspan)

# GW BWM
amp_name = 'bwm_log10_A'
if args.UL:
    bwm_log10_A = parameter.LinearExp(-18, -11)(amp_name)
else:
    bwm_log10_A = parameter.Uniform(-18, -11)(amp_name)

t0 = parameter.Constant(args.t0)('bwm_t0')
pol = parameter.Constant(args.psi)('bwm_pol')
phi = parameter.Constant(args.phi)('bwm_phi')
costh = parameter.Constant(args.costh)('bwm_costheta')

bwm_wf = utils.bwm_delay(log10_h=bwm_log10_A, t0=t0,
                         cos_gwtheta=costh, gwphi=phi, gwpol=pol)
# BWM signal
bwm = deterministic_signals.Deterministic(bwm_wf, name='bwm')

# Timing Model
tm = gp_signals.TimingModel(use_svd=True)

# BayesEphem
be = deterministic_signals.PhysicalEphemerisSignal(use_epoch_toas=True)

# construct PTA
mod = tm + wn + rn + bwm
if args.BE:
    mod += be

pta = signal_base.PTA([mod(p) for p in psrs])