Skip to content

Conversation

@nattse
Copy link
Contributor

@nattse nattse commented May 3, 2023

If there are no filtered files, pd.read_hdf(glob.glob('/some/path/*filtered.h5')[0]) will raise an IndexError as a result of indexing the empty list returned by glob, which will precede/prevent read_hdf from raising the expected FileNotFoundError. I cannot think of any way that glob will return a list of length > 0 but the contents lead to a nonexistent .h5 file

nattse added 2 commits May 3, 2023 04:51
If there are no filtered files, `pd.read_hdf(glob.glob('/some/path/*filtered.h5')[0])` will raise an IndexError as a result of indexing the empty list returned by glob, which will prevent read_hdf from raising the expected FileNotFoundError. I cannot think of any way that glob will return a list of length > 0 but the contents lead to a nonexistent .h5 file
If df_cam1 and df_cam2 have different lengths (i.e. video frames don't perfectly match), np.reshape will fail at attempting to fit df_cam2 to a df_cam1-sized array
@nattse
Copy link
Contributor Author

nattse commented May 3, 2023

Second commit addresses #2205.

If videos from camera-1 and camera-2 differ in length, the resulting .h5 tracking files will also differ in length. Original code reads both camera .h5 files and attempts to reshape them according to camera-1 array size, resulting in a ValueError when camera-2 data is not of the same size. However, any difference in video length is already addressed in triangulation.py, which creates a 3d.h5 file that contains as many frames as the shortest video. Therefore, we can slice both 2D tracking arrays according to the 3d.h5 data size and then reshape, knowing that their sizes will match.

Example of my own run-in with this issue below; camera-1 video had 3575 frames and camera-2 video had 3576 frames.
valueerror

@jeylau
Copy link
Contributor

jeylau commented May 4, 2023

Really great catch @nattse, thank you so much for troubleshooting this one!

@jeylau jeylau self-requested a review May 4, 2023 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants