Skip to content

Commit 8461307

Browse files
committed
Re-added profile and combined directory creation to the utils.py. For issue #1430
1 parent 89cac11 commit 8461307

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

xga/utils.py

Lines changed: 18 additions & 1 deletion
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, 14:19. Copyright (c) The Contributors
2+
# Last modified by David J Turner (turne540@msu.edu) 25/08/2025, 14:45. Copyright (c) The Contributors
33

44
import json
55
import os
@@ -841,4 +841,21 @@ def check_telescope_choices(telescope: Union[str, List[str]]) -> List[str]:
841841
# here usable in the rest of the current module
842842
CENSUS = CENSUS['xmm']
843843
BLACKLIST = BLACKLIST['xmm']
844+
845+
# The multi-mission branch has different behaviours for the creation of output directories, and this chunk of
846+
# code was removed, so it must be reinstated for XMM-only XGA
847+
# Make a storage directory where specific source name directories will then be created, there profile objects
848+
# created for those sources will be saved
849+
if not os.path.exists(OUTPUT + "profiles"):
850+
os.makedirs(OUTPUT + "profiles")
851+
852+
# Also making a storage directory specifically for products which are combinations of different ObsIDs
853+
# and instruments
854+
if not os.path.exists(OUTPUT + "combined"):
855+
os.makedirs(OUTPUT + "combined")
856+
857+
# And create an inventory file for that directory
858+
if not os.path.exists(OUTPUT + "combined/inventory.csv"):
859+
with open(OUTPUT + "combined/inventory.csv", 'w') as inven:
860+
inven.writelines(["file_name,obs_ids,insts,info_key,src_name,type"])
844861
# ------------------------------------------------------------------------------------------

xga/xspec/fit/profile.py

Lines changed: 2 additions & 2 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) 27/03/2025, 11:43. Copyright (c) The Contributors
2+
# Last modified by David J Turner (turne540@msu.edu) 25/08/2025, 14:45. Copyright (c) The Contributors
33

44
from inspect import signature, Parameter
55
from random import randint
@@ -12,7 +12,7 @@
1212
from ..fitconfgen import _gen_fit_conf, FIT_FUNC_ARGS
1313
from ..run import xspec_call
1414
from ... import NUM_CORES
15-
from ...exceptions import ModelNotAssociatedError, XGADeveloperError
15+
from ...exceptions import ModelNotAssociatedError, XGADeveloperError, FitConfNotAssociatedError
1616
from ...products import Spectrum
1717
from ...samples.base import BaseSample
1818
from ...sas import spectrum_set, cross_arf

0 commit comments

Comments
 (0)