Skip to content
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

Micromed segments #1589

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

samuelgarcia
Copy link
Contributor

@samuelgarcia samuelgarcia commented Oct 25, 2024

I though that micromed was mono segment but apparently it can be multi segment.
Here the implementation.

This include a test that need theses two files to be merge in gin https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/pulls/143

@samuelgarcia samuelgarcia marked this pull request as ready for review October 29, 2024 08:38
@zm711
Copy link
Contributor

zm711 commented Dec 13, 2024

@samuelgarcia do you think this is ready to go after getting the test files? Or do we want a milestone of 0.15.0 (for after next release).

@samuelgarcia
Copy link
Contributor Author

I think this is ready to go.
Let me check again.

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.

I think we should do a bit of a rewrite of this RawIO in general. Some of the variable naming is hard to follow and this low level seeking is also not super easy to follow. We should add some more comments to what is happening at the steps. But that can always be a future PR.

# "TRONCA" zone define segments
zname2, pos, length = zones["TRONCA"]
f.seek(pos)
max_segments = 100
Copy link
Contributor

Choose a reason for hiding this comment

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

where does this 100 come from. We probably need a comment for any magic number.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this magic number come from other implemtation in matlab. Maybe this should be exposed, I guess this is to avoid infinite while on some dataset.

max_segments = 100
self.info_segments = []
for i in range(max_segments):
seg_start = int(np.frombuffer(f.read(4), dtype="u4")[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. Could we get a comment for why we are reading 4 at a time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

4 is 4bytes for "u4"

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I meant why are you doing 'u4'? why not some other size for reading. How do you know reading u4 gets us what we need instead of some other size? If we do a comment then we know that either 1) this size is documented or 2) you are doing this empirically.

neo/rawio/micromedrawio.py Outdated Show resolved Hide resolved
}

# "TRONCA" zone define segments
zname2, pos, length = zones["TRONCA"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Light recommendation to have better name for pos :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

outch it was already everywhere

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not crucial here :) But if any micromed issues come up I will send them your way.

@zm711 zm711 added this to the 0.14.0 milestone Jan 7, 2025
samuelgarcia and others added 2 commits January 8, 2025 13:34
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
@zm711
Copy link
Contributor

zm711 commented Jan 10, 2025

To move forward with this I think you need to merge main into this branch to fix the CI/RTD builds. Then we can really see how the tests are doing :)

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.

3 participants