Skip to content

Commit 45198c5

Browse files
author
David Turner
committed
Should have moved the tests over to using erass rather than erosita
Signed-off-by: David Turner <[email protected]>
1 parent d41fcb5 commit 45198c5

18 files changed

Lines changed: 201 additions & 153 deletions

tests/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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 ([email protected]) 4/27/26, 12:04 PM. Copyright (c) The Contributors.
2+
# Last modified by David J Turner ([email protected]) 5/5/26, 11:32 PM. Copyright (c) The Contributors.
33
import numpy as np
44
import pandas as pd
55
from astropy.units import Quantity
@@ -24,7 +24,7 @@ def get_test_source(telescope: str = 'all', shared: bool = True) -> GalaxyCluste
2424
"""
2525
A factory function to provide test sources. This is used to avoid instantiating them at import time.
2626
27-
:param str telescope: The telescope for which we want a source. Options are 'all', 'xmm', 'erosita'.
27+
:param str telescope: The telescope for which we want a source. Options are 'all', 'xmm', 'erass'.
2828
:param bool shared: Whether to return a shared (cached) instance or a fresh one.
2929
:return: The requested source.
3030
:rtype: GalaxyCluster
@@ -39,17 +39,17 @@ def get_test_source(telescope: str = 'all', shared: bool = True) -> GalaxyCluste
3939
if telescope == 'all':
4040
src = GalaxyCluster(SRC_INFO['ra'], SRC_INFO['dec'], SRC_INFO['z'], r500=Quantity(500, 'kpc'),
4141
name=SRC_INFO['name'], use_peak=False,
42-
search_distance={'erosita': Quantity(3.6, 'deg')},
42+
search_distance={'erass': Quantity(3.6, 'deg')},
4343
load_profiles=False)
4444
elif telescope == 'xmm':
4545
src = GalaxyCluster(SRC_INFO['ra'], SRC_INFO['dec'], SRC_INFO['z'], r500=Quantity(500, 'kpc'),
4646
name=SRC_INFO['name'], use_peak=False,
4747
telescope='xmm', load_profiles=False)
48-
elif telescope == 'erosita':
48+
elif telescope == 'erass' or telescope == 'erosita':
4949
src = GalaxyCluster(SRC_INFO['ra'], SRC_INFO['dec'], SRC_INFO['z'], r500=Quantity(500, 'kpc'),
5050
name=SRC_INFO['name'], use_peak=False,
51-
telescope='erosita',
52-
search_distance={'erosita': Quantity(3.6, 'deg')},
51+
telescope='erass',
52+
search_distance={'erass': Quantity(3.6, 'deg')},
5353
load_profiles=False)
5454
else:
5555
raise ValueError(f"Unknown mission name: {telescope}")

tests/test_data/config/xga.cfg

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ mos1_expmap = {obs_id}/images/obsid{obs_id}-instM1-subexpALL-en{lo_en}_{hi_en}ke
1818
mos2_expmap = {obs_id}/images/obsid{obs_id}-instM2-subexpALL-en{lo_en}_{hi_en}keV-expmap.fits
1919
region_file = tests/test_data/src_regs/xmm/{obs_id}.reg
2020

21-
[EROSITA_FILES]
22-
root_erosita_dir = tests/test_data/daxa_output/archives/xga_tests/processed_data/erosita_all_sky_de_dr1/
23-
clean_erosita_evts = {obs_id}/events/obsid{obs_id}-instTM1_TM2_TM3_TM4_TM5_TM6_TM7-subexpALL-en0.2_10.0keV-finalevents.fits
21+
[ERASS_FILES]
22+
root_erass_dir = tests/test_data/daxa_output/archives/xga_tests/processed_data/erosita_all_sky_de_dr1/
23+
clean_erass_evts = {obs_id}/events/obsid{obs_id}-instTM1_TM2_TM3_TM4_TM5_TM6_TM7-subexpALL-en0.2_10.0keV-finalevents.fits
2424
lo_en = ['0.5']
2525
hi_en = ['2.0']
26-
erosita_image = /this/is/optional/
27-
erosita_expmap = /this/is/optional/
26+
erass_image = /this/is/optional/
27+
erass_expmap = /this/is/optional/
2828
region_file = tests/test_data/src_regs/erosita/{obs_id}.reg
2929

3030
[CHANDRA_FILES]
@@ -37,4 +37,4 @@ lo_en = ['0.5', '0.5', '1.2', 2.0, '0.2']
3737
hi_en = ['7.0', '1.2', '2.0', '7.0', '0.4']
3838
acis_image = {obs_id}/images/obsid{obs_id}-instACIS-subexpE001-en{lo_en}_{hi_en}keV-image.fits
3939
acis_expmap = {obs_id}/images/obsid{obs_id}-instACIS-subexpE001-en{lo_en}_{hi_en}keV-expmap.fits
40-
region_file = tests/test_data/src_regs/chandra/{obs_id}.reg
40+
region_file = tests/test_data/src_regs/chandra/{obs_id}.reg

tests/test_generate/test_esass_lightcurve.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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 ([email protected]) 4/27/26, 5:17 PM. Copyright (c) The Contributors.
2+
# Last modified by David J Turner ([email protected]) 5/5/26, 11:38 PM. Copyright (c) The Contributors.
33

44
import unittest
55

@@ -12,7 +12,7 @@
1212
class TestEsassLcFuncs(unittest.TestCase):
1313
@classmethod
1414
def setUpClass(cls):
15-
cls.src = get_test_source('erosita')
15+
cls.src = get_test_source('erass')
1616

1717
@require_esass
1818
def test_srctool_lightcurve_combine_insts_f_combine_obs_f(self):
@@ -21,17 +21,17 @@ def test_srctool_lightcurve_combine_insts_f_combine_obs_f(self):
2121
"""
2222
srctool_lightcurve(self.src, 'r500', combine_tm=False, combine_obs=False)
2323

24-
lc = self.src.get_lightcurves('r500', telescope='erosita', inst='tm1')
25-
24+
lc = self.src.get_lightcurves('r500', telescope='erass', inst='tm1')
25+
2626
if isinstance(lc, list):
2727
for l in lc:
2828
assert isinstance(l, LightCurve)
29-
assert l.telescope == 'erosita'
29+
assert l.telescope == 'erass'
3030
assert l.obs_id != 'combined'
3131
assert l.instrument == 'tm1'
3232
else:
3333
assert isinstance(lc, LightCurve)
34-
assert lc.telescope == 'erosita'
34+
assert lc.telescope == 'erass'
3535
assert lc.obs_id != 'combined'
3636
assert lc.instrument == 'tm1'
3737

@@ -42,17 +42,17 @@ def test_srctool_lightcurve_combine_insts_t_combine_obs_f(self):
4242
"""
4343
srctool_lightcurve(self.src, 'r500', combine_tm=True, combine_obs=False)
4444

45-
lc = self.src.get_lightcurves('r500', telescope='erosita', inst='combined')
45+
lc = self.src.get_lightcurves('r500', telescope='erass', inst='combined')
4646

4747
if isinstance(lc, list):
4848
for l in lc:
4949
assert isinstance(l, LightCurve)
50-
assert l.telescope == 'erosita'
50+
assert l.telescope == 'erass'
5151
assert l.obs_id != 'combined'
5252
assert l.instrument == 'combined'
5353
else:
5454
assert isinstance(lc, LightCurve)
55-
assert lc.telescope == 'erosita'
55+
assert lc.telescope == 'erass'
5656
assert lc.obs_id != 'combined'
5757
assert lc.instrument == 'combined'
5858

@@ -64,10 +64,10 @@ def test_srctool_lightcurve_combine_insts_f_combine_obs_t(self):
6464
"""
6565
srctool_lightcurve(self.src, 'r500', combine_tm=False, combine_obs=True)
6666

67-
lc = self.src.get_combined_lightcurves('r500', telescope='erosita', inst='tm1')
67+
lc = self.src.get_combined_lightcurves('r500', telescope='erass', inst='tm1')
6868

6969
assert isinstance(lc, LightCurve)
70-
assert lc.telescope == 'erosita'
70+
assert lc.telescope == 'erass'
7171
assert lc.obs_id == 'combined'
7272
assert lc.instrument == 'tm1'
7373

@@ -78,17 +78,17 @@ def test_srctool_lightcurve_combine_insts_t_combine_obs_t(self):
7878
"""
7979
srctool_lightcurve(self.src, 'r500', combine_tm=True, combine_obs=True)
8080

81-
lc = self.src.get_combined_lightcurves('r500', telescope='erosita', inst='combined')
81+
lc = self.src.get_combined_lightcurves('r500', telescope='erass', inst='combined')
8282

8383
if isinstance(lc, list):
8484
for l in lc:
8585
assert isinstance(l, LightCurve)
86-
assert l.telescope == 'erosita'
86+
assert l.telescope == 'erass'
8787
assert l.obs_id == 'combined'
8888
assert l.instrument == 'combined'
8989
else:
9090
assert isinstance(lc, LightCurve)
91-
assert lc.telescope == 'erosita'
91+
assert lc.telescope == 'erass'
9292
assert lc.obs_id == 'combined'
9393
assert lc.instrument == 'combined'
9494

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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 ([email protected]) 4/27/26, 5:17 PM. Copyright (c) The Contributors.
2+
# Last modified by David J Turner ([email protected]) 5/5/26, 11:51 PM. Copyright (c) The Contributors.
33

44
import unittest
55

@@ -11,15 +11,15 @@
1111
class TestEsassMiscFuncs(unittest.TestCase):
1212
@classmethod
1313
def setUpClass(cls):
14-
cls.src = get_test_source('erosita')
14+
cls.src = get_test_source('erass')
1515

1616
@require_esass
1717
def test_evtool_combine_evts(self):
1818
evtool_combine_evts(self.src)
1919

20-
evtlist = self.src.get_products("combined_events", just_obj=False, telescope='erosita')[0][-1]
21-
assert evtlist.telescope == 'erosita'
22-
assert set(evtlist.obs_ids) == set(self.src.obs_ids['erosita'])
20+
evtlist = self.src.get_products("combined_events", just_obj=False, telescope='erass')[0][-1]
21+
assert evtlist.telescope == 'erass'
22+
assert set(evtlist.obs_ids) == set(self.src.obs_ids['erass'])
2323

2424
if __name__ == "__main__":
2525
unittest.main()

tests/test_generate/test_esass_phot.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
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 ([email protected]) 4/29/26, 9:39 AM. Copyright (c) The Contributors.
2+
# Last modified by David J Turner ([email protected]) 5/5/26, 11:35 PM. Copyright (c) The Contributors.
33

44
import unittest
55

66
from astropy.units import Quantity
7+
78
from xga.generate.esass.phot import evtool_image, expmap
89
from xga.samples import ClusterSample
9-
1010
from .. import get_test_source, CLUSTER_SMP
1111
from ..utils import require_esass
1212

1313

1414
class TestEsassPhotFuncs(unittest.TestCase):
1515
@classmethod
1616
def setUpClass(cls):
17-
cls.src = get_test_source('erosita')
17+
cls.src = get_test_source('erass')
1818

1919
@require_esass
2020
def test_evtool_image(self):
2121
evtool_image(self.src, Quantity(0.4, 'keV'), Quantity(3, 'keV'))
2222

23-
im = self.src.get_images(lo_en=Quantity(0.4, 'keV'), hi_en=Quantity(3, 'keV'),
24-
telescope='erosita')[0]
23+
im = self.src.get_images(lo_en=Quantity(0.4, 'keV'), hi_en=Quantity(3, 'keV'),
24+
telescope='erass')[0]
2525
if isinstance(im, list):
2626
for i in im:
27-
assert i.telescope == 'erosita'
27+
assert i.telescope == 'erass'
2828
assert i.energy_bounds[0] == Quantity(0.4, 'keV')
2929
assert i.energy_bounds[1] == Quantity(3, 'keV')
3030
else:
31-
assert im.telescope == 'erosita'
31+
assert im.telescope == 'erass'
3232
assert im.energy_bounds[0] == Quantity(0.4, 'keV')
3333
assert im.energy_bounds[1] == Quantity(3, 'keV')
3434

3535
@require_esass
3636
def test_evtool_image_combined_obs(self):
3737
evtool_image(self.src, Quantity(0.5, 'keV'), Quantity(3, 'keV'), combine_obs=True)
3838

39-
im = self.src.get_combined_images(lo_en=Quantity(0.5, 'keV'), hi_en=Quantity(3, 'keV'),
40-
telescope='erosita')
39+
im = self.src.get_combined_images(lo_en=Quantity(0.5, 'keV'), hi_en=Quantity(3, 'keV'),
40+
telescope='erass')
4141

42-
assert im.telescope == 'erosita'
42+
assert im.telescope == 'erass'
4343
assert im.energy_bounds[0] == Quantity(0.5, 'keV')
4444
assert im.energy_bounds[1] == Quantity(3, 'keV')
4545

4646
@require_esass
4747
def test_expmap(self):
4848
expmap(self.src, Quantity(0.4, 'keV'), Quantity(3, 'keV'))
4949

50-
exp = self.src.get_expmaps(lo_en=Quantity(0.4, 'keV'), hi_en=Quantity(3, 'keV'),
51-
telescope='erosita')
50+
exp = self.src.get_expmaps(lo_en=Quantity(0.4, 'keV'), hi_en=Quantity(3, 'keV'),
51+
telescope='erass')
5252

5353
for e in exp:
54-
assert e.telescope == 'erosita'
54+
assert e.telescope == 'erass'
5555
assert e.energy_bounds[0] == Quantity(0.4, 'keV')
5656
assert e.energy_bounds[1] == Quantity(3, 'keV')
5757

5858
@require_esass
5959
def test_expmap_combined_obs(self):
6060
expmap(self.src, Quantity(0.5, 'keV'), Quantity(3, 'keV'), combine_obs=True)
6161

62-
exp = self.src.get_combined_expmaps(lo_en=Quantity(0.5, 'keV'), hi_en=Quantity(3, 'keV'),
63-
telescope='erosita')
62+
exp = self.src.get_combined_expmaps(lo_en=Quantity(0.5, 'keV'), hi_en=Quantity(3, 'keV'),
63+
telescope='erass')
6464

65-
assert exp.telescope == 'erosita'
65+
assert exp.telescope == 'erass'
6666
assert exp.energy_bounds[0] == Quantity(0.5, 'keV')
6767
assert exp.energy_bounds[1] == Quantity(3, 'keV')
68-
68+
6969
@require_esass
7070
def test_evtool_image_w_sample_w_odd_telescopes(self):
7171
"""
7272
There was an old bug that occured when product generation functions were run with samples
7373
with sources that didn't all have the same telescopes. So this is testing that this bug has
7474
been fixed!
7575
"""
76-
test_smp = ClusterSample(CLUSTER_SMP["ra"].values, CLUSTER_SMP["dec"].values,
77-
CLUSTER_SMP["z"].values, CLUSTER_SMP["name"].values,
76+
test_smp = ClusterSample(CLUSTER_SMP["ra"].values, CLUSTER_SMP["dec"].values,
77+
CLUSTER_SMP["z"].values, CLUSTER_SMP["name"].values,
7878
r500=Quantity(CLUSTER_SMP["r500"].values, 'kpc'), use_peak=False,
79-
search_distance={'erosita': Quantity(3.6, 'deg')})
79+
search_distance={'erass': Quantity(3.6, 'deg')})
8080

81-
test_smp[0].disassociate_obs('erosita')
81+
test_smp[0].disassociate_obs('erass')
8282
evtool_image(test_smp)
8383

8484
if __name__ == "__main__":

tests/test_generate/test_esass_spec.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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 ([email protected]) 4/27/26, 5:17 PM. Copyright (c) The Contributors.
2+
# Last modified by David J Turner ([email protected]) 5/5/26, 11:34 PM. Copyright (c) The Contributors.
33

44
import unittest
55

@@ -12,7 +12,7 @@
1212
class TestEsassSpecFuncs(unittest.TestCase):
1313
@classmethod
1414
def setUpClass(cls):
15-
cls.src = get_test_source('erosita')
15+
cls.src = get_test_source('erass')
1616

1717
@require_esass
1818
def test_srctool_spectrum_combine_insts_f_combine_obs_f(self):
@@ -21,9 +21,9 @@ def test_srctool_spectrum_combine_insts_f_combine_obs_f(self):
2121
"""
2222
srctool_spectrum(self.src, 'r500', combine_tm=False, combine_obs=False)
2323

24-
spec = self.src.get_spectra('r500', telescope='erosita', inst='tm1', obs_id='227093')
24+
spec = self.src.get_spectra('r500', telescope='erass', inst='tm1', obs_id='227093')
2525
assert isinstance(spec, Spectrum)
26-
assert spec.telescope == 'erosita'
26+
assert spec.telescope == 'erass'
2727
assert spec.obs_id != 'combined'
2828
assert spec.instrument == 'tm1'
2929

@@ -34,11 +34,11 @@ def test_srctool_spectrum_combine_insts_t_combine_obs_f(self):
3434
"""
3535
srctool_spectrum(self.src, 'r500', combine_tm=True, combine_obs=False)
3636

37-
spec = self.src.get_spectra('r500', telescope='erosita', inst='combined',
37+
spec = self.src.get_spectra('r500', telescope='erass', inst='combined',
3838
obs_id='227093')
3939

4040
assert isinstance(spec, Spectrum)
41-
assert spec.telescope == 'erosita'
41+
assert spec.telescope == 'erass'
4242
assert spec.obs_id != 'combined'
4343
assert spec.instrument == 'combined'
4444

@@ -49,10 +49,10 @@ def test_srctool_spectrum_combine_insts_f_combine_obs_t(self):
4949
"""
5050
srctool_spectrum(self.src, 'r500', combine_tm=False, combine_obs=True)
5151

52-
spec = self.src.get_combined_spectra('r500', telescope='erosita', inst='tm1')
52+
spec = self.src.get_combined_spectra('r500', telescope='erass', inst='tm1')
5353

5454
assert isinstance(spec, Spectrum)
55-
assert spec.telescope == 'erosita'
55+
assert spec.telescope == 'erass'
5656
assert spec.obs_id == 'combined'
5757
assert spec.instrument == 'tm1'
5858

@@ -63,13 +63,13 @@ def test_srctool_spectrum_combine_insts_t_combine_obs_t(self):
6363
"""
6464
srctool_spectrum(self.src, 'r500', combine_tm=True, combine_obs=True)
6565

66-
spec = self.src.get_combined_spectra('r500', telescope='erosita', inst='combined')
66+
spec = self.src.get_combined_spectra('r500', telescope='erass', inst='combined')
6767

6868
if isinstance(spec, list):
6969
spec = spec[0]
7070

7171
assert isinstance(spec, Spectrum)
72-
assert spec.telescope == 'erosita'
72+
assert spec.telescope == 'erass'
7373
assert spec.obs_id == 'combined'
7474
assert spec.instrument == 'combined'
7575

tests/test_generate/test_sas_phot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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 ([email protected]) 4/28/26, 11:56 AM. Copyright (c) The Contributors.
2+
# Last modified by David J Turner ([email protected]) 5/5/26, 11:56 PM. Copyright (c) The Contributors.
33

44
import unittest
55

@@ -19,7 +19,7 @@ def setUpClass(cls):
1919
cls.src = get_test_source('xmm')
2020

2121
# Additionally, grab one that we know DOESN'T have any XMM
22-
cls.no_xmm_src = get_test_source('erosita')
22+
cls.no_xmm_src = get_test_source('erass')
2323

2424
@require_sas
2525
def test_evselect_image_no_tel_error(self):

0 commit comments

Comments
 (0)