9
9
from ..obsbandpass import ObsBandpass
10
10
from ..observation import Observation
11
11
from ..reddening import Extinction
12
+ from ..refs import getref , setref
12
13
from ..spectrum import BlackBody , FileSourceSpectrum , MergeWaveSets , MERGETHRESH
13
14
15
+ orig_graphtable = None
16
+ orig_comptable = None
17
+
14
18
15
19
@use_cdbs
16
20
def test_merge_wave_sets ():
@@ -28,18 +32,35 @@ def test_merge_wave_sets():
28
32
29
33
30
34
@use_cdbs
31
- def test_qso_countrate ( ):
35
+ class TestQSOCountrate ( object ):
32
36
"""
33
37
Extinction curve waveset should not be merged into composite spectrum
34
38
when applied. See https://github.com/spacetelescope/pysynphot/issues/44 .
35
39
"""
36
- bp = ObsBandpass ('acs,hrc,f850lp' )
40
+ @classmethod
41
+ def setup_class (cls ):
42
+ global orig_graphtable , orig_comptable
43
+ cfg = getref ()
44
+ orig_graphtable = cfg ['graphtable' ]
45
+ orig_comptable = cfg ['comptable' ]
46
+
47
+ # Answers computed using specified tables
48
+ mtab = os .path .join (os .environ ['PYSYN_CDBS' ], 'mtab' )
49
+ setref (graphtable = os .path .join (mtab , '14l1632sm_tmg.fits' ),
50
+ comptable = os .path .join (mtab , 'OLD_FILES' , '16n1832tm_tmc.fits' ))
51
+
52
+ def test_countrate (self ):
53
+ bp = ObsBandpass ('acs,hrc,f850lp' )
54
+
55
+ fname = get_pkg_data_filename (os .path .join ('data' , 'qso_template.fits' ))
56
+ qso = FileSourceSpectrum (fname )
57
+ sp_ext = qso * Extinction (1.0 , 'mwavg' )
58
+ sp = sp_ext .renorm (20 , 'vegamag' , ObsBandpass ('johnson,v' ), force = True )
37
59
38
- fname = get_pkg_data_filename (os .path .join ('data' , 'qso_template.fits' ))
39
- qso = FileSourceSpectrum (fname )
40
- sp_ext = qso * Extinction (1.0 , 'mwavg' )
41
- sp = sp_ext .renorm (20 , 'vegamag' , ObsBandpass ('johnson,v' ), force = True )
60
+ obs = Observation (sp , bp , force = 'taper' )
61
+ c = obs .countrate ()
62
+ np .testing .assert_allclose (c , 2.3554364232173565e-05 )
42
63
43
- obs = Observation ( sp , bp , force = 'taper' )
44
- c = obs . countrate ()
45
- np . testing . assert_allclose ( c , 2.3554364232173565e-05 )
64
+ @ classmethod
65
+ def teardown_class ( cls ):
66
+ setref ( graphtable = orig_graphtable , comptable = orig_comptable )
0 commit comments