def configuration(path_to_folder=None): config = load_config_file() control = controller.Controller(config) try: control.log({"start": get_date_time()}) yield control finally: if path_to_folder is not None: control.log({"end": get_date_time()}) save_config_file(path_to_folder)
self.domain = domain self.origin = origin self.coords_param = coords_param return def morph_on_shapemode_shape(self): self.voxelize_and_parameterize_shapemode_shape() self.morphed = cytoparam.morph_representation_on_shape( img=self.domain, param_img_coords=self.coords_param, representation=self.aggregated_parameterized_intensity) self.morphed = np.stack([self.domain, self.morphed]) return if __name__ == "__main__": config = general.load_config_file() control = controller.Controller(config) parser = argparse.ArgumentParser(description='Batch aggregation.') parser.add_argument('--csv', help='Path to the dataframe.', required=True) args = vars(parser.parse_args()) df = pd.read_csv(args['csv'], index_col=0) aggregator = Aggregator(control) for index, row in tqdm(df.iterrows(), total=len(df)): '''Concurrent processes inside. Do not use concurrent here.''' aggregator.execute(row)