From af141e81891828a002130d3d9a4d7766b045f1dd Mon Sep 17 00:00:00 2001 From: Johanna Jakob Date: Fri, 16 Aug 2024 12:39:11 -0500 Subject: [PATCH] Clean up a bit --- jobs/config.ini | 4 ++-- saltax/instructions/generator.py | 8 +++++--- saltax/plugins/f_raw_records.py | 3 --- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/jobs/config.ini b/jobs/config.ini index 39a5b8e..1a39563 100644 --- a/jobs/config.ini +++ b/jobs/config.ini @@ -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 diff --git a/saltax/instructions/generator.py b/saltax/instructions/generator.py index 3669248..ae7c281 100644 --- a/saltax/instructions/generator.py +++ b/saltax/instructions/generator.py @@ -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"] @@ -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)] @@ -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) @@ -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)) diff --git a/saltax/plugins/f_raw_records.py b/saltax/plugins/f_raw_records.py index 3674982..ebbb03b 100644 --- a/saltax/plugins/f_raw_records.py +++ b/saltax/plugins/f_raw_records.py @@ -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 @@ -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 @@ -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):