示例#1
0
 def test_efsearch(self):
     evfile = self.dum
     main_efsearch([evfile, '-f', '9.85', '-F', '9.95', '-n', '64',
                    '--fit-candidates'])
     outfile = 'events_EF' + HEN_FILE_EXTENSION
     assert os.path.exists(outfile)
     plot_folding([outfile], ylog=True)
     efperiod = load_folding(outfile)
     assert np.isclose(efperiod.peaks[0], self.pulse_frequency,
                       atol=1/25.25)
     os.unlink(outfile)
示例#2
0
    def test_efsearch_deorbit_invalid(self):
        evfile = self.dum
        with pytest.warns(UserWarning) as record:
            ip = main_efsearch([
                evfile, '-f', '9.85', '-F', '9.95', '-n', '64',
                '--deorbit-par', "nonexistent.par"
            ])
        assert np.any(["Parameter file" in r.message.args[0] for r in record])

        outfile = 'events_EF' + HEN_FILE_EXTENSION
        assert os.path.exists(outfile)
        with pytest.warns(UserWarning) as record:
            plot_folding([outfile], ylog=True)
        assert np.any(["does not exist" in r.message.args[0] for r in record])
示例#3
0
 def test_zsearch(self):
     evfile = self.dum
     main_zsearch([evfile, '-f', '9.85', '-F', '9.95', '-n', '64',
                   '--fit-candidates', '--fit-frequency',
                   str(self.pulse_frequency),
                   '--dynstep', '5'])
     outfile = 'events_Z2n' + HEN_FILE_EXTENSION
     assert os.path.exists(outfile)
     plot_folding([outfile], ylog=True)
     efperiod = load_folding(outfile)
     assert np.isclose(efperiod.peaks[0], self.pulse_frequency,
                       atol=1/25.25)
     # Defaults to 2 harmonics
     assert efperiod.N == 2
     os.unlink(outfile)
示例#4
0
 def test_zsearch_fdots(self):
     evfile = self.dum
     main_zsearch([evfile, '-f', '9.85', '-F', '9.95', '-n', '64',
                   '--fdotmin', ' -0.1', '--fdotmax', '0.1',
                   '--fit-candidates', '--fit-frequency',
                   str(self.pulse_frequency)])
     outfile = 'events_Z2n' + HEN_FILE_EXTENSION
     assert os.path.exists(outfile)
     plot_folding([outfile], ylog=True, output_data_file='bla.qdp')
     efperiod = load_folding(outfile)
     assert np.isclose(efperiod.peaks[0], self.pulse_frequency,
                       atol=1/25.25)
     # Defaults to 2 harmonics
     assert len(efperiod.fdots) > 1
     assert efperiod.N == 2
示例#5
0
    def test_efsearch_deorbit(self):
        evfile = self.dum
        par = 'bububububu.par'
        with open(par, 'a') as fobj:
            print("BINARY BT", file=fobj)
            print("PB  1e20", file=fobj)
            print("A1  0", file=fobj)
            print("T0  56000", file=fobj)
            print("EPHEM  DE200", file=fobj)
            print("RAJ  00:55:01", file=fobj)
            print("DECJ 12:00:40.2", file=fobj)

        ip = main_zsearch([
            evfile, '-f', '9.85', '-F', '9.95', '-n', '64', '--deorbit-par',
            par
        ])

        outfile = 'events_Z2n' + HEN_FILE_EXTENSION
        assert os.path.exists(outfile)
        plot_folding([outfile], ylog=True)