-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update load_motion_info
to load legacy motion folders
#3772
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know Sam prefers bool check over doing try/except (at least he seems to). What if we flipped the logic and checked for the legacy files and if all legacy files are present we load legacy. If not we load the current format and let the current format raise the IOError if its neither type. try/except are expensive if the except is used. This is probably the simplest version, but just wanted to raise the point.
Otherwise this looks fine to me.
EDIT: error appears to be related to building scipy. Not this PR.
Good point @zm711 Got rid of try-except :) |
Looks good to me. You want to do another PR to figure out the scipy build issue? And do we have any way to test? Or do we not have a way to generate (simulated) legacy motion? |
temporal_bins_s = [np.load(folder / "temporal_bins.npy")] | ||
displacement = [np.load(folder / "motion.npy")] | ||
|
||
motion = Motion(displacement=displacement, temporal_bins_s=temporal_bins_s, spatial_bins_um=spatial_bins_um) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
motion = Motion(displacement=displacement, temporal_bins_s=temporal_bins_s, spatial_bins_um=spatial_bins_um) | |
motion = Motion(displacement=displacement, temporal_bins_s=[temporal_bins_s], spatial_bins_um=[spatial_bins_um]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
He already made them lists above. Do they have to be nested lists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No :) I'm ok making the list later if it's better readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, let's leave it as is!
When we added the
Motion.load
to theload_motion_info
, we forgot to handle back-compatibility.This PR just tries to load a legacy motion in case the
Motion.load
fails.