-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
156 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,32 @@ | ||
PSRJ J0534+2200 | ||
RAJ 05:34:31.973 8.1267817736559476629e-4895 | ||
DECJ +22:00:52.06 3.1242079228685550361e-4884 | ||
F0 11.183908501919459511 0 0 | ||
F1 -1.5607051596431583974e-11 0 0 | ||
F2 1.2164543201957172106e-21 0 0 | ||
PEPOCH 59650 | ||
POSEPOCH 54760 4.2026289288901168828e-4933 | ||
DMEPOCH 54760 | ||
START 58066.177875391477251 1 | ||
FINISH 58116.307778270281737 1 | ||
TZRMJD 58088.399365291575503 | ||
TZRFRQ 1000 | ||
TZRSITE bat | ||
TRES 39.799 | ||
EPHVER 5 | ||
CLK TT(TAI) | ||
MODE 1 | ||
UNITS TCB | ||
TIMEEPH IF99 | ||
DILATEFREQ Y | ||
PLANET_SHAPIRO Y | ||
T2CMETHOD IAU2000B | ||
NE_SW 4.000 | ||
CORRECT_TROPOSPHERE N | ||
EPHEM DE405 | ||
NITS 1 | ||
NTOA 249 | ||
CHI2R 1.5028 241 | ||
JUMP freq 999 1001 -0.0008124159772934 1 | ||
JUMP freq 1999 2001 -1.4639986440894e-05 1 | ||
JUMP NAME LE -0.00088 1 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
from tatpulsar.pulse import barycor | ||
import unittest | ||
|
||
from tatpulsar.pulse import * | ||
from tatpulsar.data import Profile | ||
help(Profile) | ||
class TestAlias(unittest.TestCase): | ||
def test_alias(self): | ||
try: | ||
from tatpulsar.pulse import barycor | ||
except Exception as e: | ||
self.fail(f"Failed to call the function via alias, error: {e}") | ||
self.assertTrue(callable(barycor), "Failed: barycor is not a function") | ||
|
||
# Test readpar Class | ||
from tatpulsar.utils import readpar | ||
self.assertTrue(callable(readpar), "Failed: readpar is not a function") | ||
|
||
# Test Profile class | ||
from tatpulsar.data import Profile | ||
self.assertTrue(callable(Profile), "Failed: readpar is not a function") | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import unittest | ||
import numpy as np | ||
from tatpulsar.utils.gti import gti_intersection, gti_union | ||
|
||
class TestGtiMethods(unittest.TestCase): | ||
def test_gti_intersection(self): | ||
gti1 = [[1, 3], [4, 6]] | ||
gti2 = [[2, 5]] | ||
result = gti_intersection(gti1, gti2) | ||
expected_result = [[2, 3], [4, 5]] | ||
self.assertEqual(result, expected_result, "Failed: gti_intersection is not working as expected") | ||
|
||
# Test if the GTIs are array | ||
gti1 = np.array([[1, 3], [4, 6]]) | ||
gti2 = np.array([[2, 5]]) | ||
result = gti_intersection(gti1, gti2) | ||
expected_result = [[2, 3], [4, 5]] | ||
self.assertEqual(result, expected_result, "Failed: gti_intersection is not working as expected") | ||
|
||
# Test if the GTIs is 1d list | ||
gti1 = [1, 3] | ||
gti2 = [2, 5] | ||
result = gti_intersection(gti1, gti2) | ||
expected_result = [[2, 3]] | ||
self.assertEqual(result, expected_result, "Failed: gti_intersection is not working as expected") | ||
|
||
def test_gti_union(self): | ||
gti1 = [[1, 3], [4, 6]] | ||
gti2 = [[2, 5]] | ||
result = gti_union(gti1, gti2) | ||
expected_result = [[1, 6]] | ||
self.assertEqual(result, expected_result, "Failed: gti_union is not working as expected") | ||
|
||
# Test if the GTIs are array | ||
gti1 = np.array([[1, 3], [4, 6]]) | ||
gti2 = np.array([[2, 5]]) | ||
result = gti_union(gti1, gti2) | ||
expected_result = [[1, 6]] | ||
self.assertEqual(result, expected_result, "Failed: gti_union is not working as expected") | ||
|
||
# Test if the GTIs is 1d list | ||
gti1 = [1, 3] | ||
gti2 = [2, 5] | ||
result = gti_union(gti1, gti2) | ||
expected_result = [[1, 5]] | ||
self.assertEqual(result, expected_result, "Failed: gti_intersection is not working as expected") | ||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import unittest | ||
import numpy as np | ||
from tatpulsar.utils import readpar | ||
|
||
class TestReadpar(unittest.TestCase): | ||
def test_readpar(self): | ||
eph = readpar("./tests/data/Vela.par") | ||
par_to_test = ['F0', "F1", "F2", "PEPOCH"] | ||
value_to_varify = [11.183908501919459511, -1.5607051596431583974e-11, 1.2164543201957172106e-21, | ||
59650] | ||
|
||
for par, val in zip(par_to_test, value_to_varify): | ||
print(par, getattr(eph, par).value, val) | ||
try: | ||
np.testing.assert_array_almost_equal(getattr(eph, par).value, val) | ||
except Exception as e: | ||
self.fail(f"{e}: The Ephemeris reading is incorrect") | ||
|