Skip to content

Commit

Permalink
Clean up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Johanna Jakob committed Aug 16, 2024
1 parent f5e7d0b commit af141e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions jobs/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ corrections_version=global_v15
generator_name = ambe
recoil = 0
simu_mode = all
rate = 10
en_range = 0.2,15.0
rate = 20
en_range = 0.2,50
process_data = False
process_simu = True
skip_records = False
Expand Down
8 changes: 5 additions & 3 deletions saltax/instructions/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def instr_file_name(
def fill_fuse_instruction_i(i, cluster_i, selected_ambe,times_offset):
instr_i = np.zeros(len(selected_ambe), dtype=FUSE_DTYPE)
instr_i["t"] = times_offset[i] + selected_ambe["t"]
instr_i["eventid"] = i + 1
instr_i["eventid"] = selected_ambe["eventid"]
instr_i["x"] = selected_ambe["x"]
instr_i["y"] = selected_ambe["y"]
instr_i["z"] = selected_ambe["z"]
Expand All @@ -253,7 +253,7 @@ def fill_fuse_instruction_i(i, cluster_i, selected_ambe,times_offset):
instr_i["e_field"] = selected_ambe["e_field"]
instr_i["ed"] = selected_ambe["ed"]
instr_i["nestid"] = selected_ambe["nestid"]
instr_i["cluster_id"] = cluster_i + np.arange(1, 1 + len(selected_ambe))#selected_ambe["cluster_id"]
instr_i["cluster_id"] = cluster_i + np.arange(1, 1 + len(selected_ambe))

# Filter out 0 amplitudes
instr_i = instr_i[(instr_i["photons"] > 0) | (instr_i["electrons"] > 0)]
Expand Down Expand Up @@ -413,6 +413,8 @@ def generator_ambe(
# assign instructions
if instructions_type == 'fuse':
instr = np.zeros(0, dtype=FUSE_DTYPE)
# Sort here just to be sure. Should be irrelevant as long as cluster_id is strictly increasing with time in fill_fuse_instruction_i
ambe_event_numbers = np.sort(ambe_event_numbers)
cluster_id = 0
if instructions_type == 'wfsim':
instr = np.zeros(0, dtype=wfsim.instruction_dtype)
Expand All @@ -430,7 +432,7 @@ def generator_ambe(
elif instructions_type == 'wfsim':
instr_i = fill_wfsim_instruction_i(i, selected_ambe, times_offset)
else:
raise ValueError(f'Instruction type {instructions_type} is not known.')
raise ValueError(f'Instruction type {instructions_type} is not known. Must be either "fuse" or "wfsim".')

# concatenate instr
instr = np.concatenate((instr, instr_i))
Expand Down
3 changes: 0 additions & 3 deletions saltax/plugins/f_raw_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def compute(self, raw_records, start, end):
chunk_data = chunk_data.to_records(index=False)
data = np.zeros(len(chunk_data), dtype=self.dtype)
strax.copy_to_buffer(chunk_data, data, "_bring_data_into_correct_format")

self.source_done = source_done

# Stick rigorously with raw_records time range
Expand Down Expand Up @@ -194,7 +193,6 @@ def output_chunk(self, chunk_start, chunk_end):
# Load the csv file
log.warning(f"Loaded detector simulation instructions from a csv file in {self.input_type} format!")
instructions = self._load_csv_file()
print(f"Loaded detector simulation instructions from a csv file in {self.input_type} format!")

if self.input_type == "wfsim":
# Translate the wfsim instructions to the fuse format
Expand All @@ -210,7 +208,6 @@ def output_chunk(self, chunk_start, chunk_end):
chunk_end - self.ns_no_instruction_before_chunk_end,
)

log.warning(f"We have the following list of keys: {list(instructions.keys())}")
# See if we have any instructions after the chunk end
mask_next = instructions["t"] > chunk_end
if np.any(mask_next):
Expand Down

0 comments on commit af141e8

Please sign in to comment.