Skip to content

Commit

Permalink
renamed context functions
Browse files Browse the repository at this point in the history
  • Loading branch information
FaroutYLq committed Apr 22, 2024
1 parent 1ca3c04 commit fdeb494
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions jobs/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
storage_to_patch = config.get("job", "storage_to_patch").split(",")
delete_records = config.getboolean("job", "delete_records")

# Determine context for processing
if package == "wfsim":
context_function = saltax.contexts.sxenonnt
elif package == "fuse":
scontext_function = saltax.contexts.fxenonnt
else:
raise ValueError("Invalid package name %s" % package)

# Determine whether to process events type plugins or just peak types
to_process_dtypes_ev = [
"peaklets",
Expand Down Expand Up @@ -83,7 +91,7 @@
print("Finished importing and config loading, now start to load context.")
print("Now starting %s context for run %d" % (saltax_mode, runid))
if rate is None:
st = saltax.contexts.sxenonnt(
st = context_function(
runid=runid,
saltax_mode=saltax_mode,
output_folder=output_folder,
Expand All @@ -93,7 +101,7 @@
simu_mode=simu_mode,
)
else:
st = saltax.contexts.sxenonnt(
st = context_function(
runid=runid,
saltax_mode=saltax_mode,
output_folder=output_folder,
Expand All @@ -107,7 +115,14 @@
for d in storage_to_patch:
st.storage.append(strax.DataDirectory(d, readonly=True))

if package == "fuse":
print("Making microphysics_summary.")
st.make(strrunid, "microphysics_summary", progress_bar=True)
print("Done with microphysics_summary.")
gc.collect()
print("Making raw_records.")
st.make(strrunid, "raw_records_simu", progress_bar=True)
print("Done with raw_records.")
gc.collect()
for dt in to_process_dtypes:
print("Making %s. " % dt)
Expand Down Expand Up @@ -136,7 +151,7 @@
)
print("Now starting data-only context for run %d" % (runid))
if rate is None:
st = saltax.contexts.sxenonnt(
st = context_function(
runid=runid,
saltax_mode="data",
output_folder=output_folder,
Expand All @@ -146,7 +161,7 @@
simu_mode=simu_mode,
)
else:
st = saltax.contexts.sxenonnt(
st = context_function(
runid=runid,
saltax_mode="data",
output_folder=output_folder,
Expand Down Expand Up @@ -185,7 +200,7 @@
print("====================")
print("Now starting simu-only context for run %d" % (runid))
if rate is None:
st = saltax.contexts.sxenonnt(
st = context_function(
runid=runid,
saltax_mode="simu",
output_folder=output_folder,
Expand All @@ -195,7 +210,7 @@
simu_mode=simu_mode,
)
else:
st = saltax.contexts.sxenonnt(
st = context_function(
runid=runid,
saltax_mode="simu",
output_folder=output_folder,
Expand Down

0 comments on commit fdeb494

Please sign in to comment.