From b8038d0e40a05b8b08e3aac33cb3196ad136286f Mon Sep 17 00:00:00 2001 From: bartulem Date: Sat, 31 Aug 2024 19:07:23 -0400 Subject: [PATCH] v0.3.12 sort video files by name before concatenation & get precise IPI start frame --- README.md | 2 +- setup.py | 2 +- src/file_manipulation.py | 6 +++--- src/synchronize_files.py | 4 ++-- src/usv_playpen_gui.py | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cd5a4ea..8fd6f85 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# usv-playpen v0.3.11 +# usv-playpen v0.3.12
diff --git a/setup.py b/setup.py index 5f409c6..28b5abd 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='usv-playpen', - version='0.3.11', + version='0.3.12', author='@bartulem', author_email='mimica.bartul@gmail.com', classifiers=[ diff --git a/src/file_manipulation.py b/src/file_manipulation.py index e83068d..aaf4347 100644 --- a/src/file_manipulation.py +++ b/src/file_manipulation.py @@ -554,8 +554,8 @@ def concatenate_audio_files(self): for audio_file_type in self.input_parameter_dict['concatenate_audio_files']['concat_dirs']: - all_audio_files = glob.glob(f"{self.root_directory}{os.sep}audio{os.sep}{audio_file_type}{os.sep}" - f"*.{self.input_parameter_dict['concatenate_audio_files']['audio_format']}") + all_audio_files = sorted(glob.glob(f"{self.root_directory}{os.sep}audio{os.sep}{audio_file_type}{os.sep}" + f"*.{self.input_parameter_dict['concatenate_audio_files']['audio_format']}")) if len(all_audio_files) > 1: @@ -621,7 +621,7 @@ def concatenate_video_files(self): vid_name = f"{self.input_parameter_dict['concatenate_video_files']['concatenated_video_name']}_{sub_directory.split('.')[-1]}" vid_extension = self.input_parameter_dict['concatenate_video_files']['video_extension'] - all_video_files = glob.glob(f"{current_working_dir}{os.sep}*.{vid_extension}") + all_video_files = sorted(glob.glob(f"{current_working_dir}{os.sep}*.{vid_extension}")) if len(all_video_files) > 1: diff --git a/src/synchronize_files.py b/src/synchronize_files.py index 654c656..04ba561 100644 --- a/src/synchronize_files.py +++ b/src/synchronize_files.py @@ -539,11 +539,11 @@ def find_video_sync_trains(self, camera_fps, total_frame_number): if even_event_durations.sum() > odd_event_durations.sum(): ipi_durations_frames = even_event_durations - 1 if type(ipi_start_frames) is int: - temp_ipi_start_frames = np.array(significant_events[::2]) + 1 + temp_ipi_start_frames = np.array(significant_events[::2]) + 2 else: ipi_durations_frames = odd_event_durations - 1 if type(ipi_start_frames) is int: - temp_ipi_start_frames = np.array(significant_events[1::2]) + 1 + temp_ipi_start_frames = np.array(significant_events[1::2]) + 2 # compute IPI durations in milliseconds ipi_durations_ms = np.round(ipi_durations_frames * (1000 / camera_fps[sync_cam_idx])) diff --git a/src/usv_playpen_gui.py b/src/usv_playpen_gui.py index e9facdf..b5b8cb1 100644 --- a/src/usv_playpen_gui.py +++ b/src/usv_playpen_gui.py @@ -49,7 +49,7 @@ my_app_id = 'mycompany.myproduct.subproduct.version' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(my_app_id) -app_name = 'USV Playpen v0.3.11' +app_name = 'USV Playpen v0.3.12' experimenter_id = 'bartulem' cup_directory_name = 'Bartul' email_list_global = '' @@ -451,7 +451,7 @@ def record_two(self): 'display': '2', 'total_mic_number': '24', 'total_device_num': '2', 'used_mics': '0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23', 'cpu_priority': 'high', - 'cpu_affinity': '5'} + 'cpu_affinity': '6'} row_start_position_label = 5 row_start_position_line_edit = 120