Ugly rename-copy-delete workaround for outpu files in scan_in_time_threshold
with tb.open_file(self.output_filename + '_interpreted.h5', "r+") as in_file: #
in_file.root.HistRelBCID._f_remove()
in_file.root.HistOcc._f_remove()
in_file.root.HistTot._f_remove()
the original _interpreted file is created by the standard threshold scan analysis from analysis.py and then several nodes are removed and replaced by new tables in the scan.analyze()
method. This requires an ugly workaround in the end to free up the space that was occupied by the nodes that were deleted:
os.rename(self.output_filename + '_interpreted.h5', self.output_filename + '_inter.h5')
copyfile(self.output_filename + '_inter.h5', self.output_filename + '_interpreted.h5')
os.remove(self.output_filename + '_inter.h5')
In the end, i guess the best solution is to move this analysis to analysis.py with a special case for 'in_time_threshold'scan', so nodes that are not needed are not even created in the first place.