Skip to content
Snippets Groups Projects
Commit 3a061f62 authored by Cribellier, Antoine's avatar Cribellier, Antoine
Browse files

Added TODO + docstring of do_batch + correct input for delete_recordings()

parent a74fff85
No related branches found
No related tags found
1 merge request!7Improved architecture, documentation and flexibility, added working tests for preprocessing of images
......@@ -275,7 +275,14 @@ class BatchProcessing:
yaml.safe_dump(process_dict, yaml_file, encoding='utf-8', allow_unicode=True)
def do_batch(self, fn_name: str, **kwargs) -> None:
def do_batch(self, fn_name: str, **kwargs: Dict[str, any]) -> None:
"""
Args:
fn_name: Name of the function to run the batch on (e.g. 'track2d', 'crop', 'analyse_dlc', 'fit_skeleton')
**kwargs: A dictionary with the process parameters
"""
start = time.time()
step_frame = 1 if 'step_frame' not in kwargs.keys() else kwargs['step_frame']
......@@ -394,7 +401,9 @@ class BatchProcessing:
img.close()
if will_delete_rec:
self.delete_recordings(rec_dates, self.recordings.get_paths)
rec_names_to_del = {camn: recording.get(camn).get_names() for camn in range(1, self.nb_cam + 1)}
rec_paths_to_del = {camn: recording.get(camn).get_paths() for camn in range(1, self.nb_cam + 1)}
self.delete_recordings(rec_names_to_del, rec_paths_to_del)
elif fn_name == 'stitch':
stitch_all_images(image_names, image_paths, save_paths, self.main_camn)
......@@ -648,13 +657,8 @@ class BatchProcessing:
if __name__ == '__main__':
# TODO update loading BatchProcessing from path
img_process = BatchProcessing()
#path = 'G:'
#img_process.cam_paths = {1: os.path.join(path, 'test'), 2: os.path.join(path, 'test'), 3: os.path.join(path, 'test')}
#img_process.cam_save_paths = {1: os.path.join(path, 'test', '_Process'), 2: os.path.join(path, 'test', '_Process'), 3: os.path.join(path, 'test', '_Process')}
#img_process.cam_paths = {1: 'F:\\Photron1', 2: 'Y:\\', 3: 'Z:\\'}
#img_process.cam_save_paths = {1: 'F:\\Photron1\\_Process', 2: 'Y:\\_Process', 3: 'Z:\\_Process'}
img_process.cam_paths = {1: '/media/user/MosquitoEscape_Photron1/Photron1',
2: '/media/user/MosquitoEscape_Photron2/Photron2',
3: '/media/user/MosquitoEscape_Photron3/Photron3'}
......@@ -662,9 +666,6 @@ if __name__ == '__main__':
2: '/media/user/MosquitoEscape_Photron2/Photron2/_Process',
3: '/media/user/MosquitoEscape_Photron3/Photron3/_Process'}
#img_process.cam_paths = {1: 'F:\\Photron1'}
#img_process.cam_save_paths = {1: 'F:\\Photron1\\_Process'}
img_process.init_paths_names()
rec_names_to_process = {}
for i in range(1, img_process.nb_cam + 1):
......
......@@ -21,6 +21,8 @@ def test_batch_processing_images_preprocessing() -> None:
#gen_dlt(3, img_size, xyz_path, xy_path, dlt_path)
img_process = BatchProcessing()
# TODO update loading BatchProcessing from path
img_process.cam_paths = {1: '/media/user/MosquitoLanding_Photron3_Backup/Photron1/_MatingKinematics',
2: '/media/user/MosquitoLanding_Photron3_Backup/Photron2/_MatingKinematics',
3: '/media/user/MosquitoLanding_Photron3_Backup/Photron3/_MatingKinematics'}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment