def test_bb_disperse(bbsignal, j1713_profile, ism): """ Test disperse function with baseband signal. """ tobs = make_quant(0.05, 's') period = make_quant(5, 'ms') psr = Pulsar(period, 10, profiles=j1713_profile, name='J1746-0118') psr.make_pulses(bbsignal, tobs) ism.disperse(bbsignal, 10) assert (bbsignal.dm.value == 10)
def test_pulsar(j1713_profile): """ Test pulsar class. """ # initialize pulsar with profile psr1 = Pulsar(1.0, 1.0, profiles=j1713_profile, name="J1713+0747") # initialize pulsar without profile psr2 = Pulsar(1.0, 1.0, profiles=None, name="J1713+0747") # Check functions and properties psr_names = psr1.__repr__() # check properties assert (psr1.period.value == 1.0) assert (psr1.Smean.value == 1.0) assert (psr1.name == "J1713+0747") assert (psr1.Profiles == j1713_profile)
def pulsar(): """ Fixture pulsar class """ F0 = 186.49408124993144 period = make_quant(1.0 / F0, 's') return Pulsar(period, 10, name='J1746-0118')
def pulsar(): """ Fixture pulsar class """ period = make_quant(5, 'ms') return Pulsar(period, 10, name='J1746-0118')
def test_makepulses(fbsignal, fbsignal_nofold, bbsignal, j1713_profile): """ Test make_pulses function. """ # Define a pulsar psr1 = Pulsar(1.0, 1.0, profiles=j1713_profile, name="J1713+0747") # Test making pulses with a filterbank signal tobs = 2.0 psr1.make_pulses(fbsignal, tobs) assert (psr1.ref_freq.value == 1400.0) # Make pulses with sublen of None fbsignal._sublen = None psr1.make_pulses(fbsignal, tobs) # Make pulses without folded signal psr1.make_pulses(fbsignal_nofold, tobs) # Test making pulses with Baseband signal psr1.make_pulses(bbsignal, tobs) # Test error message with pytest.raises(NotImplementedError): fbsignal._sigtype = "badsignal" psr1.make_pulses(fbsignal, tobs)
def test_nullpulses(fbsignal, fbsignal_nofold, ism, j1713_profile): """ Test pulse nulling function. """ # Define a pulsar psr1 = Pulsar(1.0, 1.0, profiles=j1713_profile, name="J1713+0747") # Test making pulses with a filterbank signal tobs = 3.0 psr1.make_pulses(fbsignal, tobs) dm = 10.0 ism.disperse(fbsignal, dm) # Null the pulses psr1.null(fbsignal, 0.34) # now check with no fold for a dispersed signal psr1.make_pulses(fbsignal_nofold, tobs) psr1.null(fbsignal_nofold, 0.34) # Check error with pytest.raises(NotImplementedError): psr1.null(fbsignal, 0.34, length=1.0)