Source code for pymepix.post_processing
from tqdm import tqdm
from pymepix.processing.rawfilesampler import RawFileSampler
[docs]
class ProgressBar(tqdm):
gui_bar_fun = None
[docs]
def update_to(self, progress):
self.gui_bar_fun(self.n)
return self.update(progress - self.n)
[docs]
def updateProgressBar(progress):
pass
[docs]
def run_post_processing(
input_file_name,
output_file,
number_processes,
timewalk_file,
cent_timewalk_file,
camera_generation=3,
progress_callback=updateProgressBar,
clustering_args={},
dbscan_clustering=True,
**kwargs,
):
with ProgressBar(total=1.0, dynamic_ncols=True) as progress_bar:
progress_bar.gui_bar_fun = progress_callback
file_sampler = RawFileSampler(
input_file_name,
output_file,
number_processes,
timewalk_file,
cent_timewalk_file,
progress_bar.update_to,
camera_generation,
clustering_args,
dbscan_clustering,
**kwargs,
)
file_sampler.run()