Skip to content

Commit 16c9288

Browse files
author
David Turner
committed
Really smashing up the _make_spec_cmd_info and _spec_cmds functions to figure out why combined spec are being deleted.
1 parent 368f34f commit 16c9288

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

xga/generate/esass/spec.py

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

44
import os
55
from copy import deepcopy, copy
@@ -337,21 +337,28 @@ def _make_spec_cmd_info(cur_evt_list: EventList):
337337
# We make sure to remove the 'merged spectra' output of srctool - which is identical to the
338338
# instrument one if we generate for one spectrum at a time. Though only if the user hasn't actually
339339
# ASKED for the merged spectrum
340+
print('TM combo', combine_tm)
341+
340342
if combine_tm:
341-
cmd_str = ";".join([s_cmd_str, rename_spec, rename_rmf, rename_arf, remove_all_but_merged_cmd])
343+
# cmd_str = ";".join([s_cmd_str, rename_spec, rename_rmf, rename_arf, remove_all_but_merged_cmd])
344+
cmd_str = ";".join([s_cmd_str, rename_spec, rename_rmf, rename_arf])
342345
else:
343-
cmd_str = ";".join([s_cmd_str, rename_spec, rename_rmf, rename_arf, remove_merged_cmd])
346+
# cmd_str = ";".join([s_cmd_str, rename_spec, rename_rmf, rename_arf, remove_merged_cmd])
347+
cmd_str = ";".join([s_cmd_str, rename_spec, rename_rmf, rename_arf])
344348

345349
# This currently ensures that there is a ';' divider between these two chunks of commands - hopefully
346350
# we'll neaten it up at some point
347351
cmd_str += ';'
348352

349353
# Removing the 'merged spectra' output of srctool, for the background spectra in this case
350354
if combine_tm:
355+
# cmd_str += ";".join([sb_cmd_str, rename_b_spec, rename_b_rmf, rename_b_arf,
356+
# remove_all_but_merged_cmd])
351357
cmd_str += ";".join([sb_cmd_str, rename_b_spec, rename_b_rmf, rename_b_arf,
352-
remove_all_but_merged_cmd])
358+
])
353359
else:
354-
cmd_str += ";".join([sb_cmd_str, rename_b_spec, rename_b_rmf, rename_b_arf, remove_merged_cmd])
360+
# cmd_str += ";".join([sb_cmd_str, rename_b_spec, rename_b_rmf, rename_b_arf, remove_merged_cmd])
361+
cmd_str += ";".join([sb_cmd_str, rename_b_spec, rename_b_rmf, rename_b_arf])
355362

356363
# If the user wants to group the spectrum, then this command should be added
357364
if group_spec:
@@ -503,6 +510,7 @@ def _make_spec_cmd_info(cur_evt_list: EventList):
503510
back_sp_cmd += " writeinsts={i}"
504511
pnt_sp_cmd += " writeinsts={i}"
505512

513+
# TODO SORT THIS SHIT OUT?!
506514
# You can't control the whole names of srctool outputs, so this renames it to the XGA format
507515
rename_cmd = 'mv srctoolout_{i_no}??_{type}* {nn}'
508516
# Having a string to remove the 'merged' spectra that srctool outputs, even when you only request one instrument
@@ -515,9 +523,7 @@ def _make_spec_cmd_info(cur_evt_list: EventList):
515523
remove_merged_dr1_8 = 'rm *srctoolout_8*'
516524
remove_merged_dr1_9 = 'rm *srctoolout_9*'
517525
# We also set up a command that will remove all spectra BUT the combined one
518-
# TODO SORT THIS SHIT OUT?!
519-
# remove_all_but_merged_cmd = "rm *srctoolout_*"
520-
remove_all_but_merged_cmd = ""
526+
remove_all_but_merged_cmd = "rm *srctoolout_*"
521527

522528
# Grouping the spectra will be done using the HEASoft tool 'ftgrouppha' - we make sure to remove the original
523529
# ungrouped file. I think maybe that approach is safer than turning clobber on and just having the original

0 commit comments

Comments
 (0)