From 7df344f3df7ed66307433682b217a016870d1113 Mon Sep 17 00:00:00 2001 From: Lanqing Yuan Date: Sat, 30 Mar 2024 01:26:37 -0500 Subject: [PATCH] avoid regenerating instructions --- saltax/instructions/generator.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/saltax/instructions/generator.py b/saltax/instructions/generator.py index 6920430..3814d83 100644 --- a/saltax/instructions/generator.py +++ b/saltax/instructions/generator.py @@ -145,10 +145,10 @@ def get_run_start_end(runid): return unix_time_start_ns, unix_time_end_ns -def instr_file_name(runid, instr, recoil, generator_name, mode, rate=1e9/SALT_TIME_INTERVAL, +def instr_file_name(runid, recoil, generator_name, mode, rate=1e9/SALT_TIME_INTERVAL, base_dir=BASE_DIR): """ - Generate the instruction file name and then save the csv instructions. + Generate the instruction file name based on the runid, recoil, generator_name, mode, and rate. :param runid: run number in integer :param instr: instructions in numpy array :param recoil: NEST recoil type @@ -166,14 +166,6 @@ def instr_file_name(runid, instr, recoil, generator_name, mode, rate=1e9/SALT_TI runid = str(runid).zfill(6) filename = BASE_DIR + runid + "-" + str(recoil) + "-" + \ generator_name + "-" + mode + "-" + str(rate) + ".csv" - - # if the file already exists, we don't want to overwrite it - if not os.path.exists(filename): - pd.DataFrame(instr).to_csv(filename, index=False) - else: - print("Instruction file already exists at: %s" % (filename)) - - print("Instruction file at: %s" % (filename)) return filename