Skip to content

Commit

Permalink
avoid regenerating instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
FaroutYLq committed Mar 30, 2024
1 parent 54d070b commit 7df344f
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions saltax/instructions/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 7df344f

Please sign in to comment.