Skip to content

Commit 10d61db

Browse files
author
David Turner
committed
Re-added eSASS version determination
1 parent 7219422 commit 10d61db

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

xga/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
2-
# Last modified by David J Turner (turne540@msu.edu) 16/07/2025, 12:25. Copyright (c) The Contributors
2+
# Last modified by David J Turner (turne540@msu.edu) 09/12/2025, 15:20. Copyright (c) The Contributors
33
from . import _version
44
__version__ = _version.get_versions()['version']
55

66
from .utils import (xga_conf, CENSUS, OUTPUT, NUM_CORES, XGA_EXTRACT, BASE_XSPEC_SCRIPT, MODEL_PARS,
7-
MODEL_UNITS, ABUND_TABLES, XSPEC_FIT_METHOD, COUNTRATE_CONV_SCRIPT, NHC, BLACKLIST, HY_MASS, MEAN_MOL_WEIGHT,
8-
SAS_VERSION, XSPEC_VERSION, SAS_AVAIL, DEFAULT_COSMO, TELESCOPES, USABLE, DEFAULT_TELE_SEARCH_DIST, COMBINED_INSTS,
9-
eSASS_AVAIL, SRC_REGION_COLOURS, check_telescope_choices, PRETTY_TELESCOPE_NAMES, CIAO_AVAIL, CIAO_VERSION, CALDB_AVAIL,
10-
CALDB_VERSION, ESASS_VERSION, RAD_MATCH_PRECISION)
7+
MODEL_UNITS, ABUND_TABLES, XSPEC_FIT_METHOD, COUNTRATE_CONV_SCRIPT, NHC, BLACKLIST, HY_MASS, MEAN_MOL_WEIGHT,
8+
SAS_VERSION, XSPEC_VERSION, SAS_AVAIL, DEFAULT_COSMO, TELESCOPES, USABLE, DEFAULT_TELE_SEARCH_DIST, COMBINED_INSTS,
9+
ESASS_AVAIL, SRC_REGION_COLOURS, check_telescope_choices, PRETTY_TELESCOPE_NAMES, CIAO_AVAIL, CIAO_VERSION, CALDB_AVAIL,
10+
CALDB_VERSION, ESASS_VERSION, RAD_MATCH_PRECISION)

xga/generate/esass/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
2-
# Last modified by David J Turner (turne540@msu.edu) 08/07/2025, 10:05. Copyright (c) The Contributors
2+
# Last modified by David J Turner (turne540@msu.edu) 09/12/2025, 15:20. Copyright (c) The Contributors
33

44
from functools import wraps
55
from multiprocessing.dummy import Pool
@@ -9,7 +9,7 @@
99
from tqdm import tqdm
1010

1111
from ..common import execute_cmd
12-
from ... import eSASS_AVAIL
12+
from ... import ESASS_AVAIL
1313
from ...exceptions import eSASSNotFoundError, ProductGenerationError
1414
from ...products import BaseProduct, AnnularSpectra
1515
from ...samples.base import BaseSample
@@ -27,7 +27,7 @@ def esass_call(esass_func):
2727
@wraps(esass_func)
2828
def wrapper(*args, **kwargs):
2929
# Checking eSASS is installed and available on the system
30-
if not eSASS_AVAIL:
30+
if not ESASS_AVAIL:
3131
raise eSASSNotFoundError("No eSASS installation has been found on this machine.")
3232

3333
# The first argument of all of these eSASS functions will be the source object (or a list of),

xga/utils.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
2-
# Last modified by David J Turner (turne540@msu.edu) 25/08/2025, 15:50. Copyright (c) The Contributors
2+
# Last modified by David J Turner (turne540@msu.edu) 09/12/2025, 15:20. Copyright (c) The Contributors
33

44
import json
55
import os
@@ -16,11 +16,10 @@
1616
import pkg_resources
1717
from astropy.constants import m_p, m_e
1818
from astropy.cosmology import LambdaCDM
19+
from astropy.io import fits
1920
from astropy.units import Quantity, def_unit, add_enabled_units
2021
from astropy.wcs import WCS
21-
from astropy.io import fits
2222
from fitsio import FITSHDR
23-
from fitsio import read_header
2423
from tqdm import tqdm
2524

2625
from .exceptions import XGAConfigError, InvalidTelescopeError, NoTelescopeDataError
@@ -853,15 +852,25 @@ def check_telescope_choices(telescope: Union[str, List[str]]) -> List[str]:
853852

854853
# --- eROSITA ---
855854
ESASS_VERSION = None
856-
eSASS_AVAIL = False
855+
ESASS_AVAIL = False
857856
if ('erosita' in USABLE and USABLE['erosita']) or ('erass' in USABLE and USABLE['erass']):
858-
# TODO will have to handle the whole eSASS4DR1 and the original eSASS release thing at some point... sigh
857+
# Run the 'which' command for evtool, one of the eSASS tasks
858+
which_evtool = shutil.which("evtool")
859+
859860
# This checks for an installation of eSASS
860-
if shutil.which("evtool") is None:
861+
if which_evtool is None:
861862
warn("No eSASS installation detected on system, as such all functions in xga.generate.esass will not work.",
862863
stacklevel=2)
863864
else:
864-
eSASS_AVAIL = True
865+
ESASS_AVAIL = True
866+
if 'ESASS4EDR' in which_evtool.upper():
867+
ESASS_VERSION = 'ESASS4EDR'
868+
elif 'ESASS4DR1' in which_evtool.upper():
869+
ESASS_VERSION = 'ESASS4DR1'
870+
else:
871+
warn(
872+
"Unknown eSASS installation detected on system, as such some functions in xga.generate.esass may not work.",
873+
stacklevel=2)
865874
# ---------------
866875

867876
# --- Chandra ---

0 commit comments

Comments
 (0)