Skip to content

Commit 5bdbff7

Browse files
author
David Turner
committed
Fixed issue #1492 (hopefully) by modifying the 'parse_spectrum' internal function of the BaseSource._existing_xga_products method.
1 parent e678115 commit 5bdbff7

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

xga/sources/base.py

Lines changed: 15 additions & 6 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 (djturner@umbc.edu) 12/12/2025, 10:53. Copyright (c) The Contributors
2+
# Last modified by David J Turner (djturner@umbc.edu) 29/01/2026, 14:51. Copyright (c) The Contributors
33

44
import gc
55
import os
@@ -1304,6 +1304,9 @@ def parse_spectrum(row: pd.Series, combined_obs: bool):
13041304
inst = 'combined'
13051305

13061306
src_name = row['src_name']
1307+
# Spectral files are named with '+' replaced with 'x', as having the plus
1308+
# symbol in the same can be misinterpreted by some XMM-SAS tools
1309+
no_plus_src_name = src_name.replace('+', 'x')
13071310

13081311
# we will take the info key from the filename, instead of the actual info key in the
13091312
# inventory. This is because annular spectrum need to be read in, and their info key
@@ -1356,9 +1359,9 @@ def parse_spectrum(row: pd.Series, combined_obs: bool):
13561359
if combined_obs:
13571360
indent_no = row['file_name'].split('_')[0]
13581361
# The info key actually needs to be used here
1359-
prod_gen_path = cur_d + indent_no + f'_{inst}_' + str(src_name) + '_' + info_key
1362+
prod_gen_path = cur_d + indent_no + f'_{inst}_' + str(no_plus_src_name) + '_' + info_key
13601363
else:
1361-
prod_gen_path = cur_d + obs_id + '_' + inst + '_' + str(src_name) + '_' + info_key
1364+
prod_gen_path = cur_d + obs_id + f'_{inst}_' + str(no_plus_src_name) + '_' + info_key
13621365

13631366
spec = prod_gen_path + '_spec.fits'
13641367
arf = prod_gen_path + '.arf'
@@ -1373,7 +1376,7 @@ def parse_spectrum(row: pd.Series, combined_obs: bool):
13731376
if os.path.exists(prod_gen_path + '.rmf'):
13741377
rmf = prod_gen_path + '.rmf'
13751378
else:
1376-
rmf = cur_d + obs_id + '_' + inst + '_' + str(src_name) + '_universal.rmf'
1379+
rmf = cur_d + obs_id + '_' + inst + '_' + str(no_plus_src_name) + '_universal.rmf'
13771380
back_rmf = ''
13781381
back_arf = ''
13791382

@@ -3771,8 +3774,14 @@ def get_lightcurves(self, outer_radius: Union[str, Quantity] = None, obs_id: str
37713774
def get_combined_lightcurves(self, outer_radius: Union[str, Quantity] = None,
37723775
inner_radius: Union[str, Quantity] = None, lo_en: Quantity = None,
37733776
hi_en: Quantity = None, time_bin_size: Quantity = None,
3774-
pattern: Union[dict, str] = "default", telescope: str = None,
3775-
inst: str = None) \
3777+
pattern: Union[dict, str] = "default", telescope: str = None) -> Union[LightCurve, List[LightCurve]]:
3778+
raise NoProductAvailableError("The corrected version of get_combined_lightcurves is not yet available.")
3779+
3780+
def get_aggregate_lightcurves(self, outer_radius: Union[str, Quantity] = None,
3781+
inner_radius: Union[str, Quantity] = None, lo_en: Quantity = None,
3782+
hi_en: Quantity = None, time_bin_size: Quantity = None,
3783+
pattern: Union[dict, str] = "default", telescope: str = None,
3784+
inst: str = None) \
37763785
-> Union[AggregateLightCurve, List[AggregateLightCurve]]:
37773786
"""
37783787
A method to retrieve XGA AggregateLightCurve objects (i.e. lightcurves for this object that were generated at

0 commit comments

Comments
 (0)