11# 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) 5/5 /26, 11:36 PM. Copyright (c) The Contributors.
2+ # Last modified by David J Turner (djturner@umbc.edu) 5/10 /26, 7:14 PM. Copyright (c) The Contributors.
33
44import unittest
55
66from astropy .units import Quantity
77
8+ from xga .exceptions import NoProductAvailableError
89from xga .generate .ciao .phot import chandra_image_expmap
910from xga .generate .ciao .spec import specextract_spectrum
1011from xga .generate .sas .phot import evselect_image , eexpmap
@@ -36,7 +37,11 @@ def test_xmm_image_loading(self):
3637 search_distance = {'xmm' : Quantity (30 , 'arcmin' )}, load_profiles = False )
3738
3839 # Retrieve and verify
39- imgs = src .get_images (lo_en = Quantity (0.5 , 'keV' ), hi_en = Quantity (2.0 , 'keV' ), telescope = 'xmm' )
40+ try :
41+ imgs = src .get_images (lo_en = Quantity (0.5 , 'keV' ), hi_en = Quantity (2.0 , 'keV' ), telescope = 'xmm' )
42+ except NoProductAvailableError :
43+ self .fail ("NoProductAvailableError raised." )
44+
4045 if not isinstance (imgs , list ):
4146 imgs = [imgs ]
4247
@@ -60,7 +65,11 @@ def test_xmm_expmap_loading(self):
6065 search_distance = {'xmm' : Quantity (30 , 'arcmin' )}, load_profiles = False )
6166
6267 # Retrieve and verify
63- exps = src .get_expmaps (lo_en = Quantity (0.5 , 'keV' ), hi_en = Quantity (2.0 , 'keV' ), telescope = 'xmm' )
68+ try :
69+ exps = src .get_expmaps (lo_en = Quantity (0.5 , 'keV' ), hi_en = Quantity (2.0 , 'keV' ), telescope = 'xmm' )
70+ except NoProductAvailableError :
71+ self .fail ("NoProductAvailableError raised." )
72+
6473 if not isinstance (exps , list ):
6574 exps = [exps ]
6675
@@ -83,7 +92,11 @@ def test_xmm_spectrum_loading(self):
8392 search_distance = {'xmm' : Quantity (30 , 'arcmin' )}, load_profiles = False )
8493
8594 # Retrieve and verify
86- specs = src .get_spectra ('r500' , telescope = 'xmm' )
95+ try :
96+ specs = src .get_spectra ('r500' , telescope = 'xmm' )
97+ except NoProductAvailableError :
98+ self .fail ("NoProductAvailableError raised." )
99+
87100 if not isinstance (specs , list ):
88101 specs = [specs ]
89102
@@ -107,7 +120,11 @@ def test_erass_image_loading(self):
107120 search_distance = {'erass' : Quantity (3.6 , 'deg' )}, load_profiles = False )
108121
109122 # Retrieve and verify
110- imgs = src .get_images (lo_en = Quantity (0.5 , 'keV' ), hi_en = Quantity (2.0 , 'keV' ), telescope = 'erass' )
123+ try :
124+ imgs = src .get_images (lo_en = Quantity (0.5 , 'keV' ), hi_en = Quantity (2.0 , 'keV' ), telescope = 'erass' )
125+ except NoProductAvailableError :
126+ self .fail ("NoProductAvailableError raised." )
127+
111128 if not isinstance (imgs , list ):
112129 imgs = [imgs ]
113130
@@ -132,7 +149,11 @@ def test_erass_spectrum_loading(self):
132149 search_distance = {'erass' : Quantity (3.6 , 'deg' )}, load_profiles = False )
133150
134151 # Retrieve and verify
135- specs = src .get_spectra ('r500' , telescope = 'erass' )
152+ try :
153+ specs = src .get_spectra ('r500' , telescope = 'erass' )
154+ except NoProductAvailableError :
155+ self .fail ("NoProductAvailableError raised." )
156+
136157 if not isinstance (specs , list ):
137158 specs = [specs ]
138159
@@ -156,7 +177,11 @@ def test_chandra_image_loading(self):
156177 search_distance = {'chandra' : Quantity (10 , 'arcmin' )}, load_profiles = False )
157178
158179 # Retrieve and verify
159- imgs = src .get_images (lo_en = Quantity (0.5 , 'keV' ), hi_en = Quantity (2.0 , 'keV' ), telescope = 'chandra' )
180+ try :
181+ imgs = src .get_images (lo_en = Quantity (0.5 , 'keV' ), hi_en = Quantity (2.0 , 'keV' ), telescope = 'chandra' )
182+ except NoProductAvailableError :
183+ self .fail ("NoProductAvailableError raised." )
184+
160185 if not isinstance (imgs , list ):
161186 imgs = [imgs ]
162187
@@ -180,7 +205,11 @@ def test_chandra_spectrum_loading(self):
180205 search_distance = {'chandra' : Quantity (10 , 'arcmin' )}, load_profiles = False )
181206
182207 # Retrieve and verify
183- specs = src .get_spectra ('r500' , telescope = 'chandra' )
208+ try :
209+ specs = src .get_spectra ('r500' , telescope = 'chandra' )
210+ except NoProductAvailableError :
211+ self .fail ("NoProductAvailableError raised." )
212+
184213 if not isinstance (specs , list ):
185214 specs = [specs ]
186215
0 commit comments