Skip to content

Commit

Permalink
Ensured that espfilt will not run on ObsID-inst-subexp combos that it…
Browse files Browse the repository at this point in the history
… has already run on. Indirectly for issue #69

Signed-off-by: David Turner <turne540@msu.edu>
  • Loading branch information
DavidT3 committed Sep 3, 2024
1 parent 7bb46af commit 5798ce5
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions daxa/process/xmm/clean.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This code is a part of the Democratising Archival X-ray Astronomy (DAXA) module.
# Last modified by David J Turner (turne540@msu.edu) 02/09/2024, 21:37. Copyright (c) The Contributors
# Last modified by David J Turner (turne540@msu.edu) 03/09/2024, 12:19. Copyright (c) The Contributors
import os
from random import randint
from typing import Union, Tuple
Expand Down Expand Up @@ -333,30 +333,30 @@ def espfilt(obs_archive: Archive, method: str = 'histogram', with_smoothing: Uni
final_paths = [evt_path, gti_path, hist_path]

# If it doesn't already exist then we will create commands to generate it
# TODO Need to decide which file to check for here to see whether the command has already been run
# Make the temporary directory (it shouldn't already exist but doing this to be safe)
if not os.path.exists(temp_dir):
os.makedirs(temp_dir)

# Format the blank command string defined near the top of this function - in this case the
# configuration needs to change depending on the instrument and user configuration
if inst == 'PN':
with_oot = 'yes'
rs = range_scale['pn']
else:
with_oot = 'no'
rs = range_scale['mos']

cmd = ef_cmd.format(d=temp_dir, ccf=ccf_path, ef=evt_list_file, woot=with_oot, oot=oot_evt_list_file,
me=method, ws=with_smoothing, s=smooth_factor, wb=with_binning, bs=bin_size,
r=ratio, el=filter_lo_en, eh=filter_hi_en, rs=rs, asi=allowed_sigma, gls=gauss_fit_lims,
gti=gti_path, hist=hist_path, allev=evt_path, ogti=og_gti_name, ohist=og_hist_name,
oallev=og_evt_name)

# Now store the bash command, the path, and extra info in the dictionaries
miss_cmds[miss.name][val_id] = cmd
miss_final_paths[miss.name][val_id] = final_paths
miss_extras[miss.name][val_id] = {'gti_path': gti_path, 'hist_path': hist_path}
if val_id not in obs_archive.process_success[miss.name]['cleaned_event_lists']
# Make the temporary directory (it shouldn't already exist but doing this to be safe)
if not os.path.exists(temp_dir):
os.makedirs(temp_dir)

# Format the blank command string defined near the top of this function - in this case the
# configuration needs to change depending on the instrument and user configuration
if inst == 'PN':
with_oot = 'yes'
rs = range_scale['pn']
else:
with_oot = 'no'
rs = range_scale['mos']

cmd = ef_cmd.format(d=temp_dir, ccf=ccf_path, ef=evt_list_file, woot=with_oot, oot=oot_evt_list_file,
me=method, ws=with_smoothing, s=smooth_factor, wb=with_binning, bs=bin_size,
r=ratio, el=filter_lo_en, eh=filter_hi_en, rs=rs, asi=allowed_sigma,
gls=gauss_fit_lims, gti=gti_path, hist=hist_path, allev=evt_path, ogti=og_gti_name,
ohist=og_hist_name, oallev=og_evt_name)

# Now store the bash command, the path, and extra info in the dictionaries
miss_cmds[miss.name][val_id] = cmd
miss_final_paths[miss.name][val_id] = final_paths
miss_extras[miss.name][val_id] = {'gti_path': gti_path, 'hist_path': hist_path}

# This is just used for populating a progress bar during the process run
process_message = 'Finding PN/MOS soft-proton flares'
Expand Down

0 comments on commit 5798ce5

Please sign in to comment.