diff --git a/grand/basis/signal.py b/grand/basis/signal.py index 063ae8b2..75877c19 100644 --- a/grand/basis/signal.py +++ b/grand/basis/signal.py @@ -52,7 +52,7 @@ def find_max_with_parabola_interp_3pt(x_trace, y_trace, idx_max): return x_max, y_max -def find_max_with_parabola_interp(x_trace, y_trace, idx_max, factor_hill=0.8): +def find_max_with_parabola_interp(x_trace, y_trace, idx_max, factor_hill=0.96): """Parabolic interpolation of the maximum with more than 3 points trace : all values >= 0 @@ -76,6 +76,7 @@ def find_max_with_parabola_interp(x_trace, y_trace, idx_max, factor_hill=0.8): :param factor_hill: :type factor_hill: """ + # y threshold mean around max (so 3 points) * factor_hill y_lim = (y_trace[idx_max - 1 : idx_max + 2].sum() / 3) * factor_hill logger.debug(f"y_lim={y_lim}") # 1 diff --git a/sim2root/CoREASRawRoot/CoreasToRawROOT.py b/sim2root/CoREASRawRoot/CoreasToRawROOT.py index 79a550f4..3d568b22 100644 --- a/sim2root/CoREASRawRoot/CoreasToRawROOT.py +++ b/sim2root/CoREASRawRoot/CoreasToRawROOT.py @@ -456,10 +456,10 @@ def CoreasToRawRoot(file, simID=None): # define time params: t_length = len(timestamp) - t_0 = timestamp[0] + t_length/2 + t_0 = timestamp[0] + t_length/2 * TimeBinSize t_pre = 800#ns - t_pre = t_length/2 - t_post = t_length/2 + t_pre = t_length/2 * TimeBinSize + t_post = t_length/2 * TimeBinSize # add to ROOT tree # in Zhaires converter: AntennaN[ant_ID] diff --git a/sim2root/CoREASRawRoot/CorsikaInfoFuncs.py b/sim2root/CoREASRawRoot/CorsikaInfoFuncs.py index a20fbf9e..21429982 100644 --- a/sim2root/CoREASRawRoot/CorsikaInfoFuncs.py +++ b/sim2root/CoREASRawRoot/CorsikaInfoFuncs.py @@ -273,23 +273,7 @@ def read_long(pathLongFile): TODO: fix hillas_parameter - something's not working yet """ with open(pathLongFile, mode="r") as file: - # create a temporary file to write the corrected contents - temp_file = io.StringIO() - - for line in file: - # use a regex to search for a minus sign that is not part of an exponent - if search(r"(?4}") if not dir_name.exists(): break - # If directories with serial number up to 1000 already created + # If directories with serial number up to 5000 already created else: - print("All directories with serial number up to 1000 already exist. Please clean up some directories!") + print("All directories with serial number up to 5000 already exist. Please clean up some directories!") exit(0) return dir_name @@ -843,7 +843,7 @@ def rename_all_files(clargs, path, start_event_number, end_event_number, run_num # Go through run output files for fn_start in ["run", "runshowersim", "runefieldsim"]: # Go through serial numbers in directory names to find a one that does not exist - for sn in range(1000): + for sn in range(5000): fn_in = Path(path, f"{fn_start}.root") # Proper name of the file fn_out = Path(path, f"{fn_start}_{run_number}_L{clargs.analysis_level}_{sn:0>4}.root") @@ -852,7 +852,7 @@ def rename_all_files(clargs, path, start_event_number, end_event_number, run_num fn_in.rename(fn_out) break else: - print(f"Could not find a free filename for {fn_in} until serial number 1000. Please clean up some files!") + print(f"Could not find a free filename for {fn_in} until serial number 5000. Please clean up some files!") exit(0) # Rename the event files @@ -863,7 +863,7 @@ def rename_event_files(clargs, path, start_event_number, end_event_number): # Go through event output files for fn_start in ["shower", "showersim", "efield"]: # Go through serial numbers in directory names to find a one that does not exist - for sn in range(1000): + for sn in range(5000): fn_in = Path(path, f"{fn_start}.root") # Proper name of the file fn_out = Path(path, f"{fn_start}_{start_event_number}-{end_event_number}_L{clargs.analysis_level}_{sn:0>4}.root") @@ -872,7 +872,7 @@ def rename_event_files(clargs, path, start_event_number, end_event_number): fn_in.rename(fn_out) break else: - print(f"Could not find a free filename for {fn_in} until serial number 1000. Please clean up some files!") + print(f"Could not find a free filename for {fn_in} until serial number 5s000. Please clean up some files!") exit(0) # Simple shifting of a single x,y,z trace