1- import unittest
1+ # This code is part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
2+ # Last modified by David J Turner (djturner@umbc.edu) 4/27/26, 10:28 AM. Copyright (c) The Contributors.
23
3- from astropy .units import Quantity
4- import os
4+ import os
55import sys
6+ import unittest
67
7- import xga
8- from xga .sources import GalaxyCluster
98from xga .generate .esass .lightcurve import srctool_lightcurve
109from xga .products .lightcurve import LightCurve
11-
10+ from .. utils import require_esass
1211
1312sys .path .insert (0 , os .path .abspath (os .path .join (os .path .dirname (__file__ ), '..' )))
1413
15- from .. import SRC_ALL_TELS
14+ from .. import get_test_source
15+
16+ class TestEsassLcFuncs (unittest .TestCase ):
17+ @classmethod
18+ def setUpClass (cls ):
19+ cls .src = get_test_source ('erosita' )
1620
17- class TestEsassLcFuncs ( unittest . TestCase ):
21+ @ require_esass
1822 def test_srctool_lightcurve_combine_insts_f_combine_obs_f (self ):
1923 """
2024 Testing srctool_lightcurve with the arguments combine_insts=False and combine_obs=False
2125 """
22- srctool_lightcurve (SRC_ALL_TELS , 'r500' , combine_tm = False , combine_obs = False )
26+ srctool_lightcurve (self . src , 'r500' , combine_tm = False , combine_obs = False )
2327
24- lc = SRC_ALL_TELS .get_lightcurves ('r500' , telescope = 'erosita' , inst = 'tm1' )
28+ lc = self . src .get_lightcurves ('r500' , telescope = 'erosita' , inst = 'tm1' )
2529
2630 if isinstance (lc , list ):
2731 for l in lc :
@@ -35,13 +39,14 @@ def test_srctool_lightcurve_combine_insts_f_combine_obs_f(self):
3539 assert lc .obs_id != 'combined'
3640 assert lc .instrument == 'tm1'
3741
42+ @require_esass
3843 def test_srctool_lightcurve_combine_insts_t_combine_obs_f (self ):
3944 """
4045 Testing srctool_lightcurve with the arguments combine_insts=True and combine_obs=False
4146 """
42- srctool_lightcurve (SRC_ALL_TELS , 'r500' , combine_tm = True , combine_obs = False )
47+ srctool_lightcurve (self . src , 'r500' , combine_tm = True , combine_obs = False )
4348
44- lc = SRC_ALL_TELS .get_lightcurves ('r500' , telescope = 'erosita' , inst = 'combined' )
49+ lc = self . src .get_lightcurves ('r500' , telescope = 'erosita' , inst = 'combined' )
4550
4651 if isinstance (lc , list ):
4752 for l in lc :
@@ -56,26 +61,28 @@ def test_srctool_lightcurve_combine_insts_t_combine_obs_f(self):
5661 assert lc .instrument == 'combined'
5762
5863
64+ @require_esass
5965 def test_srctool_lightcurve_combine_insts_f_combine_obs_t (self ):
6066 """
6167 Testing srctool_lightcurve with the arguments combine_insts=False and combine_obs=True
6268 """
63- srctool_lightcurve (SRC_ALL_TELS , 'r500' , combine_tm = False , combine_obs = True )
69+ srctool_lightcurve (self . src , 'r500' , combine_tm = False , combine_obs = True )
6470
65- lc = SRC_ALL_TELS .get_combined_lightcurves ('r500' , telescope = 'erosita' , inst = 'tm1' )
71+ lc = self . src .get_combined_lightcurves ('r500' , telescope = 'erosita' , inst = 'tm1' )
6672
6773 assert isinstance (lc , LightCurve )
6874 assert lc .telescope == 'erosita'
6975 assert lc .obs_id == 'combined'
7076 assert lc .instrument == 'tm1'
7177
78+ @require_esass
7279 def test_srctool_lightcurve_combine_insts_t_combine_obs_t (self ):
7380 """
7481 Testing srctool_lightcurve with the arguments combine_insts=True and combine_obs=True
7582 """
76- srctool_lightcurve (SRC_ALL_TELS , 'r500' , combine_tm = True , combine_obs = True )
83+ srctool_lightcurve (self . src , 'r500' , combine_tm = True , combine_obs = True )
7784
78- lc = SRC_ALL_TELS .get_combined_lightcurves ('r500' , telescope = 'erosita' , inst = 'combined' )
85+ lc = self . src .get_combined_lightcurves ('r500' , telescope = 'erosita' , inst = 'combined' )
7986
8087 if isinstance (lc , list ):
8188 for l in lc :
@@ -87,4 +94,6 @@ def test_srctool_lightcurve_combine_insts_t_combine_obs_t(self):
8794 assert isinstance (lc , LightCurve )
8895 assert lc .telescope == 'erosita'
8996 assert lc .obs_id == 'combined'
90- assert lc .instrument == 'combined'
97+ assert lc .instrument == 'combined'
98+
99+
0 commit comments