added file switch as single operation
This commit is contained in:
@@ -52,8 +52,7 @@ def accumulate(_accumulator_host, accumulator_port): #TODO: accumulator_host is
|
||||
if run_name != run_name_before:
|
||||
run_name_before = run_name
|
||||
fname_output = f"{OUTPUT_DIR_NAME}/{detector}/{run_name}.dap"
|
||||
output_dap.close()
|
||||
output_dap.open(fname_output)
|
||||
output_dap.switch(fname_output)
|
||||
|
||||
res_is_good_frame = results.get("is_good_frame", -1)
|
||||
res_is_hit_frame = results.get("is_hit_frame", False)
|
||||
@@ -70,6 +69,10 @@ class FileHandler:
|
||||
def __init__(self):
|
||||
self.file = None
|
||||
|
||||
def switch(self, fname):
|
||||
self.close()
|
||||
self.open(fname)
|
||||
|
||||
def open(self, fname):
|
||||
dname = os.path.dirname(fname)
|
||||
os.makedirs(dname, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user