示例#1
0
def test_two():
    parhet = PulsarParametersPy()
    parhet['F'] = [123.4567, -9.876e-12]  # set frequency
    parhet['RAJ'] = lal.TranslateHMStoRAD('01:23:34.6')  # set right ascension
    parhet['DECJ'] = lal.TranslateDMStoRAD('-45:01:23.5')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('58000')
    parhet['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds
    parhet['H0'] = 5.6e-26
    parhet['COSIOTA'] = -0.2
    parhet['PSI'] = 0.4
    parhet['PHI0'] = 2.3

    parinj = PulsarParametersPy()
    parinj['F'] = [123.456789, -9.87654321e-12]  # set frequency
    parinj['DELTAF'] = parinj['F'] - parhet['F']  # frequency difference
    parinj['RAJ'] = lal.TranslateHMStoRAD('01:23:34.5')  # set right ascension
    parinj['DECJ'] = lal.TranslateDMStoRAD('-45:01:23.4')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('58000')
    parinj['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds
    parinj['H0'] = 5.6e-26
    parinj['COSIOTA'] = -0.2
    parinj['PSI'] = 0.4
    parinj['PHI0'] = 2.3

    freqfactor = 2.  # set frequency factor
    det = 'H1'  # the detector

    # convert into GPS times
    gpstimes = lalpulsar.CreateTimestampVector(len(t2output))
    for i, time in enumerate(t2output[:, 0]):
        gpstimes.data[i] = lal.LIGOTimeGPS(time)

    detector = lalpulsar.GetSiteInfo(det)

    # set the response function look-up table
    dt = t2output[1, 0] - t2output[0, 0]  # time step
    resp = lalpulsar.DetResponseLookupTable(t2output[0, 0], detector,
                                            parhet['RAJ'], parhet['DECJ'],
                                            2880, dt)

    # get the heterodyned file SSB delay
    hetSSBdelay = lalpulsar.HeterodynedPulsarGetSSBDelay(
        parhet.PulsarParameters(), gpstimes, detector, edat, tdat,
        lalpulsar.TIMECORRECTION_TCB)

    fullsignal = lalpulsar.HeterodynedPulsarGetModel(
        parinj.PulsarParameters(), freqfactor, 1, 0, 0, gpstimes, hetSSBdelay,
        1, None, 0, resp, edat, tdat, lalpulsar.TIMECORRECTION_TCB)

    # check output matches that from lalapps_pulsar_parameter_estimation_nested
    if np.any(np.abs(fullsignal.data.data.real - t2output[:, 1]) > 1e-34):
        return False
    elif np.any(np.abs(fullsignal.data.data.imag - t2output[:, 2]) > 1e-34):
        return False
    else:
        return True
示例#2
0
def test_three(harmonic):
    parhet = PulsarParametersPy()
    parhet['F'] = [123.4567, -9.876e-12]  # set frequency
    parhet['RAJ'] = lal.TranslateHMStoRAD('01:23:34.6')  # set right ascension
    parhet['DECJ'] = lal.TranslateDMStoRAD('-45:01:23.5')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('58000')
    parhet['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds
    parhet['C22'] = 5.6e-26
    parhet['C21'] = 1.4e-25
    parhet['COSIOTA'] = -0.2
    parhet['PSI'] = 0.4
    parhet['PHI21'] = 2.3
    parhet['PHI22'] = 4.5

    parinj = PulsarParametersPy()
    parinj['F'] = [123.456789, -9.87654321e-12]  # set frequency
    parinj['RAJ'] = lal.TranslateHMStoRAD('01:23:34.5')  # set right ascension
    parinj['DECJ'] = lal.TranslateDMStoRAD('-45:01:23.4')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('58000')
    parinj['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds
    parinj['C22'] = 5.6e-26
    parinj['C21'] = 1.4e-25
    parinj['COSIOTA'] = -0.2
    parinj['PSI'] = 0.4
    parinj['PHI21'] = 2.3
    parinj['PHI22'] = 4.5

    det = 'H1'  # the detector
    detector = lalpulsar.GetSiteInfo(det)

    freqfactor = float(harmonic)  # set frequency factor

    # convert into GPS times
    gpstimes = lalpulsar.CreateTimestampVector(len(t3output[harmonic]))
    for i, time in enumerate(t3output[harmonic][:, 0]):
        gpstimes.data[i] = lal.LIGOTimeGPS(time)

    # set the response function look-up table
    dt = t3output[harmonic][1, 0] - t3output[harmonic][0, 0]  # time step
    resp = lalpulsar.DetResponseLookupTable(t3output[harmonic][0, 0], detector,
                                            parhet['RAJ'], parhet['DECJ'],
                                            2880, dt)

    # get the heterodyned file SSB delay
    hetSSBdelay = lalpulsar.HeterodynedPulsarGetSSBDelay(
        parhet.PulsarParameters(), gpstimes, detector, edat, tdat,
        lalpulsar.TIMECORRECTION_TCB)

    fullsignal = lalpulsar.HeterodynedPulsarGetModel(
        parinj.PulsarParameters(), parhet.PulsarParameters(), freqfactor, 1, 0,
        0, gpstimes, hetSSBdelay, 1, None, 0, None, 0, None, 0, resp, edat,
        tdat, lalpulsar.TIMECORRECTION_TCB)

    # check output matches that from lalapps_pulsar_parameter_estimation_nested
    assert_allclose(fullsignal.data.data.real, t3output[harmonic][:, 1])
    assert_allclose(fullsignal.data.data.imag, t3output[harmonic][:, 2])
示例#3
0
def test_five():
    par = PulsarParametersPy()
    par['F'] = [123.456789, -9.87654321e-12]  # set frequency
    par['DELTAF'] = [0.0, 0.0]  # frequency difference
    par['RAJ'] = lal.TranslateHMStoRAD('01:23:34.5')  # set right ascension
    par['DECJ'] = lal.TranslateDMStoRAD('-45:01:23.4')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('58000')
    par['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds
    par['HPLUS'] = 5.6e-26
    par['HCROSS'] = 1.3e-26
    par['HVECTORX'] = 1.4e-26
    par['HVECTORY'] = 2.3e-26
    par['HSCALARB'] = 4.5e-26
    par['HSCALARL'] = 3.1e-26
    par['PHI0TENSOR'] = 0.4
    par['PSITENSOR'] = 1.2
    par['PHI0SCALAR'] = 3.1
    par['PSISCALAR'] = 0.2
    par['PHI0VECTOR'] = 4.5
    par['PSIVECTOR'] = 2.4
    par['PHI0'] = 2.3

    freqfactor = 2.  # set frequency factor

    det = 'H1'  # detector
    detector = lalpulsar.GetSiteInfo(det)

    gpstimes = lalpulsar.CreateTimestampVector(len(t5output))
    for i, time in enumerate(t5output[:, 0]):
        gpstimes.data[i] = lal.LIGOTimeGPS(time)

    # set the response function look-up table
    dt = t5output[1, 0] - t5output[0, 0]  # time step
    resp = lalpulsar.DetResponseLookupTable(t5output[0, 0], detector,
                                            par['RAJ'], par['DECJ'], 2880, dt)

    # get the heterodyned file SSB delay
    hetSSBdelay = lalpulsar.HeterodynedPulsarGetSSBDelay(
        par.PulsarParameters(), gpstimes, detector, edat, tdat,
        lalpulsar.TIMECORRECTION_TCB)

    fullsignal = lalpulsar.HeterodynedPulsarGetModel(
        par.PulsarParameters(),
        freqfactor,
        1,
        0,
        1,  # use non-GR modes
        gpstimes,
        hetSSBdelay,
        0,
        None,
        0,
        resp,
        edat,
        tdat,
        lalpulsar.TIMECORRECTION_TCB)

    # check output matches that from lalapps_pulsar_parameter_estimation_nested
    if np.any(np.abs(fullsignal.data.data.real - t5output[:, 1]) > 1e-34):
        return False
    elif np.any(np.abs(fullsignal.data.data.imag - t5output[:, 2]) > 1e-34):
        return False

    return True
示例#4
0
def test_four():
    parhet = PulsarParametersPy()
    parhet['F'] = [123.4567, -9.876e-12]  # set frequency
    parhet['RAJ'] = lal.TranslateHMStoRAD('01:23:34.6')  # set right ascension
    parhet['DECJ'] = lal.TranslateDMStoRAD('-45:01:23.5')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('58000')
    parhet['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds
    parhet['H0'] = 5.6e-26
    parhet['COSIOTA'] = -0.2
    parhet['PSI'] = 0.4
    parhet['PHI0'] = 2.3
    parhet['BINARY'] = 'BT'
    T0 = lal.TranslateStringMJDTTtoGPS('58121.3')
    parhet['T0'] = T0.gpsSeconds + 1e-9 * T0.gpsNanoSeconds
    parhet['OM'] = np.deg2rad(2.2)
    parhet['A1'] = 8.9
    parhet['PB'] = 0.54 * 86400.
    parhet['ECC'] = 0.0001

    parinj = PulsarParametersPy()
    parinj['F'] = [123.456789, -9.87654321e-12]  # set frequency
    parinj['DELTAF'] = parinj['F'] - parhet['F']  # frequency difference
    parinj['RAJ'] = lal.TranslateHMStoRAD('01:23:34.5')  # set right ascension
    parinj['DECJ'] = lal.TranslateDMStoRAD('-45:01:23.4')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('58000')
    parinj['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds
    parinj['H0'] = 5.6e-26
    parinj['COSIOTA'] = -0.2
    parinj['PSI'] = 0.4
    parinj['PHI0'] = 2.3
    parinj['BINARY'] = 'BT'
    T0 = lal.TranslateStringMJDTTtoGPS('58121.3')
    parinj['T0'] = T0.gpsSeconds + 1e-9 * T0.gpsNanoSeconds
    parinj['OM'] = np.deg2rad(1.2)
    parinj['A1'] = 8.9
    parinj['PB'] = 0.54 * 86400.
    parinj['ECC'] = 0.0001

    freqfactor = 2.  # set frequency factor
    det = 'H1'  # the detector

    # convert into GPS times
    gpstimes = lalpulsar.CreateTimestampVector(len(t4output))
    for i, time in enumerate(t4output[:, 0]):
        gpstimes.data[i] = lal.LIGOTimeGPS(time)

    detector = lalpulsar.GetSiteInfo(det)

    # set the response function look-up table
    dt = t4output[1, 0] - t4output[0, 0]  # time step
    resp = lalpulsar.DetResponseLookupTable(t4output[0, 0], detector,
                                            parhet['RAJ'], parhet['DECJ'],
                                            2880, dt)

    # get the heterodyned file SSB delay
    hetSSBdelay = lalpulsar.HeterodynedPulsarGetSSBDelay(
        parhet.PulsarParameters(), gpstimes, detector, edat, tdat,
        lalpulsar.TIMECORRECTION_TCB)

    # get the heterodyned file BSB delay
    hetBSBdelay = lalpulsar.HeterodynedPulsarGetBSBDelay(
        parhet.PulsarParameters(), gpstimes, hetSSBdelay, edat)

    fullsignal = lalpulsar.HeterodynedPulsarGetModel(
        parinj.PulsarParameters(),
        freqfactor,
        1,  # phase is varying between par files
        0,  # not using ROQ
        0,  # not using non-tensorial modes
        gpstimes,
        hetSSBdelay,
        1,  # the SSB delay should be updated compared to hetSSBdelay
        hetBSBdelay,
        1,  # the BSB delay should be updated compared to hetBSBdelay
        resp,
        edat,
        tdat,
        lalpulsar.TIMECORRECTION_TCB)

    # check output matches that from lalapps_pulsar_parameter_estimation_nested
    if np.any(np.abs(fullsignal.data.data.real - t4output[:, 1]) > 1e-33):
        return False
    elif np.any(np.abs(fullsignal.data.data.imag - t4output[:, 2]) > 1e-33):
        return False
    else:
        return True
示例#5
0
def test_seven():
    parhet = PulsarParametersPy()
    parhet['F'] = [153.4567, -2.876e-11]  # set frequency
    parhet['RAJ'] = lal.TranslateHMStoRAD('04:23:34.6')  # set right ascension
    parhet['DECJ'] = lal.TranslateDMStoRAD('-05:01:23.5')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('55810')
    parhet['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds

    parinj = PulsarParametersPy()
    parinj['F'] = [153.456789, -2.87654321e-11]  # set frequency
    parinj['RAJ'] = lal.TranslateHMStoRAD('04:23:34.5')  # set right ascension
    parinj['DECJ'] = lal.TranslateDMStoRAD('-05:01:23.4')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('55810')
    parinj['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds
    parinj['BINARY'] = 'BT'
    T0 = lal.TranslateStringMJDTTtoGPS('58121.3')
    parinj['T0'] = T0.gpsSeconds + 1e-9 * T0.gpsNanoSeconds
    parinj['OM'] = np.deg2rad(7.2)
    parinj['A1'] = 14.9
    parinj['PB'] = 1.03 * 86400.0
    parinj['ECC'] = 0.0002
    parinj['GLF0'] = [7.4e-6, 3.4e-7]
    parinj['GLF1'] = [-3.2e-12, -1.2e-14]
    parinj['GLF0D'] = [1.2e-5, -0.4e-6]
    parinj['GLTD'] = [0.41 * 86400, 1.45 * 86400]
    parinj['GLPH'] = [0.3, 0.91]
    glep1 = lal.TranslateStringMJDTTtoGPS('55818.08161090822')
    glep2 = lal.TranslateStringMJDTTtoGPS('55818.08276831563')
    parinj['GLEP'] = [
        glep1.gpsSeconds + 1e-9 * glep1.gpsNanoSeconds,
        glep2.gpsSeconds + 1e-9 * glep2.gpsNanoSeconds
    ]
    waveep = lal.TranslateStringMJDTTtoGPS('55818.0')
    parinj['WAVEEPOCH'] = waveep.gpsSeconds + 1e-9 * waveep.gpsNanoSeconds
    parinj['WAVE_OM'] = 0.005
    parinj['WAVESIN'] = [0.098, 0.078, -0.03]
    parinj['WAVECOS'] = [0.056, -0.071, -0.12]

    freqfactor = 2.  # set frequency factor
    det = 'H1'  # the detector

    # convert into GPS times
    gpstimes = lalpulsar.CreateTimestampVector(len(t7output))
    for i, time in enumerate(np.linspace(1000000000.0, 1000000540.0, 10)):
        gpstimes.data[i] = lal.LIGOTimeGPS(time)

    detector = lalpulsar.GetSiteInfo(det)

    # replicate coarse heterodyne in which no SSB/BSB delay is applied
    hetSSBdelay = lal.CreateREAL8Vector(len(t6output))
    hetBSBdelay = lal.CreateREAL8Vector(len(t6output))
    for i in range(len(t6output)):
        hetSSBdelay.data[i] = 0.0
        hetBSBdelay.data[i] = 0.0

    # get the heterodyne glitch phase (which should be zero)
    glphase = lalpulsar.HeterodynedPulsarGetGlitchPhase(
        parhet.PulsarParameters(), gpstimes, hetSSBdelay, hetBSBdelay)

    assert_equal(glphase.data, np.zeros(len(t7output)))

    # get the FITWAVES phase (which should be zero)
    fwphase = lalpulsar.HeterodynedPulsarGetFITWAVESPhase(
        parhet.PulsarParameters(), gpstimes, hetSSBdelay, parhet["F0"])

    assert_equal(fwphase.data, np.zeros(len(t7output)))

    fullphase = lalpulsar.HeterodynedPulsarPhaseDifference(
        parinj.PulsarParameters(),
        parhet.PulsarParameters(),
        gpstimes,
        freqfactor,
        hetSSBdelay,
        1,  # the SSB delay should be updated compared to hetSSBdelay
        hetBSBdelay,
        1,  # the BSB delay should be updated compared to hetBSBdelay
        glphase,
        1,  # the glitch phase should be updated compared to glphase
        fwphase,
        1,  # the FITWAVES phase should be updated compare to fwphase
        detector,
        edat,
        tdat,
        lalpulsar.TIMECORRECTION_TCB)

    # check output matches that from lalapps_heterodyne_pulsar
    assert_allclose(2.0 * np.pi * np.fmod(fullphase.data, 1.),
                    t7output,
                    rtol=1e-3)
示例#6
0
def test_six():
    parhet = PulsarParametersPy()
    parhet['F'] = [123.4567, -9.876e-12]  # set frequency
    parhet['RAJ'] = lal.TranslateHMStoRAD('01:23:34.6')  # set right ascension
    parhet['DECJ'] = lal.TranslateDMStoRAD('-45:01:23.5')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('58000')
    parhet['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds

    parinj = PulsarParametersPy()
    parinj['F'] = [123.456789, -9.87654321e-12]  # set frequency
    parinj['RAJ'] = lal.TranslateHMStoRAD('01:23:34.5')  # set right ascension
    parinj['DECJ'] = lal.TranslateDMStoRAD('-45:01:23.4')  # set declination
    pepoch = lal.TranslateStringMJDTTtoGPS('58000')
    parinj['PEPOCH'] = pepoch.gpsSeconds + 1e-9 * pepoch.gpsNanoSeconds
    parinj['BINARY'] = 'BT'
    T0 = lal.TranslateStringMJDTTtoGPS('58121.3')
    parinj['T0'] = T0.gpsSeconds + 1e-9 * T0.gpsNanoSeconds
    parinj['OM'] = np.deg2rad(1.2)
    parinj['A1'] = 8.9
    parinj['PB'] = 0.54 * 86400.0
    parinj['ECC'] = 0.0001
    parinj['GLF0'] = [5.4e-6, 3.4e-7]
    parinj['GLF1'] = [-3.2e-13, -1.2e-14]
    parinj['GLF0D'] = [1.2e-5, -0.4e-6]
    parinj['GLTD'] = [0.31 * 86400, 0.45 * 86400]
    parinj['GLPH'] = [0.3, 0.7]
    glph1 = lal.TranslateStringMJDTTtoGPS('55818.08161090822')
    glph2 = lal.TranslateStringMJDTTtoGPS('55818.08276831563')
    parinj['GLEP'] = [
        glph1.gpsSeconds + 1e-9 * glph1.gpsNanoSeconds,
        glph2.gpsSeconds + 1e-9 * glph2.gpsNanoSeconds
    ]

    freqfactor = 2.  # set frequency factor
    det = 'H1'  # the detector

    # convert into GPS times
    gpstimes = lalpulsar.CreateTimestampVector(len(t6output))
    for i, time in enumerate(np.linspace(1000000000.0, 1000000540.0, 10)):
        gpstimes.data[i] = lal.LIGOTimeGPS(time)

    detector = lalpulsar.GetSiteInfo(det)

    # replicate coarse heterodyne in which no SSB/BSB delay is applied
    hetSSBdelay = lal.CreateREAL8Vector(len(t6output))
    hetBSBdelay = lal.CreateREAL8Vector(len(t6output))
    for i in range(len(t6output)):
        hetSSBdelay.data[i] = 0.0
        hetBSBdelay.data[i] = 0.0

    # get the heterodyne glitch phase (which should be zero)
    glphase = lalpulsar.HeterodynedPulsarGetGlitchPhase(
        parhet.PulsarParameters(), gpstimes, hetSSBdelay, hetBSBdelay)

    fullphase = lalpulsar.HeterodynedPulsarPhaseDifference(
        parinj.PulsarParameters(),
        parhet.PulsarParameters(),
        gpstimes,
        freqfactor,
        hetSSBdelay,
        1,  # the SSB delay should be updated compared to hetSSBdelay
        hetBSBdelay,
        1,  # the BSB delay should be updated compared to hetBSBdelay
        glphase,
        1,  # the glitch phase should be updated compared to glphase
        None,
        0,
        detector,
        edat,
        tdat,
        lalpulsar.TIMECORRECTION_TCB)

    # check output matches that from lalapps_heterodyne_pulsar
    assert_allclose(2.0 * np.pi * np.fmod(fullphase.data, 1.),
                    t6output,
                    rtol=1e-4)