-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest_sn_class.py
43 lines (31 loc) · 1.09 KB
/
test_sn_class.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
import unittest
import piscola
import matplotlib.pyplot as plt
import warnings
class TestPiscola(unittest.TestCase):
def test_plot(self):
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
sn = piscola.call_sn("data/03D1au.dat")
plt.ion()
sn.plot_lcs()
def test_fit_and_outputs(self):
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
sn = piscola.call_sn("data/03D1au.dat")
sn.fit()
plt.ion()
sn.plot_fits()
sn.export_fits()
sn.export_restframe_lcs()
def test_save_and_load(self):
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
sn = piscola.call_sn("data/03D1au.dat")
sn.save()
outfile = "03D1au.pisco"
_ = piscola.load_sn(outfile)
os.remove(outfile) # clean directory
if __name__ == "__main__":
unittest.main()