Skip to content

Improved support for saving/loading Groups in NeoMatlabIO #1386

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

Merged
merged 13 commits into from
Feb 2, 2024

Conversation

apdavison
Copy link
Member

Replaces #1360. NeoMatlabIO now supports all Neo object types, including ImageSequence, ChannelView and RegionOfInterest.

zm711 and others added 8 commits December 5, 2023 14:38
This is done by saving references to objects inside groups, on the assumption that those objects are already stored somewhere within segments.
This assumption may not always be true, so probably we should only save references for objects that would otherwise be duplicated.
Implement support for saving/loading Groups in NeoMatlabIO.
@apdavison apdavison added this to the 0.13.0 milestone Jan 30, 2024
@apdavison apdavison requested a review from zm711 January 30, 2024 09:57
Copy link
Contributor

@zm711 zm711 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some initial comments @apdavison, I'll test this when I get to lab in a couple hours and reread again.

Comment on lines +248 to +250
"your scipy version is too old to support "
+ "MatlabIO, you need at least 0.12.0. "
+ "You have %s" % scipy.version.version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"your scipy version is too old to support "
+ "MatlabIO, you need at least 0.12.0. "
+ "You have %s" % scipy.version.version
f"your scipy version is too old to support "
+ f"MatlabIO, you need at least 0.12.0. "
+ f"You have {scipy.version.version}"

I'm drafting a PR for after the release to convert everything to f-strings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea.

Copy link
Contributor

@zm711 zm711 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another round of comments.



def get_classname_from_container_name(container_name, struct):
if container_name == "regionsofinterest":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why the container_name is regions, but all of the sub types are just region (no s). Just so I can know in the future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The container can contain multiple items, so it has a plural name, each item is a singular region.

Comment on lines +318 to +319
epoch_duration_range=[0.5, 3.0],
# this should be multiplied by pq.s, no?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
epoch_duration_range=[0.5, 3.0],
# this should be multiplied by pq.s, no?
epoch_duration_range=[0.5, 3.0], # this is multiplied by pq.s when generating the epoch below.

I think we can edit this because the durations are loaded up and mulitplied by pq.s in the epoch generation below. Just so people don't get confused.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really relevant to this PR, we should perhaps have a project-wide comment cleanup

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I think the Black hitting things makes things tricky to review since it highlights all the lines. But you're right. We can do this later. It's not pressing.

@zm711
Copy link
Contributor

zm711 commented Jan 30, 2024

Thanks @apdavison , I just want to do a test on my end where I write a file and I open it in matlab to see what it looks like. Then I'll approve.

@zm711
Copy link
Contributor

zm711 commented Jan 30, 2024

I have checked writing test_write_read_single_spike locally and opening with Matlab. All values are correctly populated.
I have checked writing test_write_read_random_blocks locally and opening with Matlab as well. It produced values for segment and group containers. Thanks @apdavison.

@zm711 zm711 linked an issue Jan 30, 2024 that may be closed by this pull request
@alejoe91 alejoe91 merged commit 03a04f7 into NeuralEnsemble:master Feb 2, 2024
@apdavison apdavison deleted the matlabio branch February 2, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NeoMatlabIO doesn't save groups and imagesequences to .mat
3 participants