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

IntanRawIO: Update support of rhs files #1457

Merged
merged 17 commits into from
May 7, 2024

Conversation

zm711
Copy link
Contributor

@zm711 zm711 commented Apr 6, 2024

This will be adding support for RHX rhs files with a separate header for rhs files. We haven't officially update RHS support since RHS 1.0 and we are on 3.x so this may take a bit of work. We will add tests files soon so that we can properly test this.

TODOS

  • Add support for supply and aux channels in RHS Turns out that there isn't any from newest docs!
  • Add support for one-file-per-signal
  • Add support for one-file-per-channel
  • Add test files for new formats
  • Add access to digital channels like we did for rhd
  • Try to understand the stim channels to see if we need to make updates
  • Add channel_number_dict for one-file-per-signal
  • Add analog-out in the one-file-per-channel-dict function

Neuroconv provenance catalystneuro/neuroconv#789

@zm711 zm711 self-assigned this Apr 6, 2024
neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
neo/rawio/intanrawio.py Show resolved Hide resolved
neo/rawio/intanrawio.py Show resolved Hide resolved
neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

@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 accidentally removed these booleans during one of my commits

neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

@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.

Missing one more file test folder the rhs--fps

neo/test/iotest/test_intanio.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

@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.

Bad-copy paste of the test files on my part. I think this should fix the testing portion at last.

neo/test/iotest/test_intanio.py Outdated Show resolved Hide resolved
neo/test/rawiotest/test_intanrawio.py Outdated Show resolved Hide resolved
neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
Copy link
Contributor

@h-mayorquin h-mayorquin left a comment

Choose a reason for hiding this comment

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

This in general looks good for me. We are replicating the structure that we did for #1402. I would go further for the aproach of segregating the two options (as in the suggestion of having two create_one_file_per_signal_dict insead of one) but these are already in the realm of weak personal preference.

The tests are failing, let's see what's going on and I will read it again but I think this mostly works.

neo/rawio/intanrawio.py Show resolved Hide resolved
@@ -822,13 +914,37 @@ def read_rhd(filename, file_format: str):
]


def create_one_file_per_signal_dict(dirname):
"""Function for One File Per Signal Type"""
def create_one_file_per_signal_dict(dirname, rhs: bool = False):
Copy link
Contributor

Choose a reason for hiding this comment

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

Personal preference so your milleagea might vary, I rather have two functions here instead of mixing the two of them with keywords. I prefer code duplication rather than cyclomatic complexity and given that these are almost dictionaries / configurations I don't think that duplication is a cognitive burden.

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 that might be fair for this. Mainly because we update the rhd a bit more often than the rhs. So splitting so that we can update the one without breaking the other is a good idea. I would say let's keep this in draft and I will work on that.

neo/rawio/intanrawio.py Show resolved Hide resolved
@zm711
Copy link
Contributor Author

zm711 commented May 3, 2024

The test is failing due to timestamp issue.... That means the test file could be corrupt. Not sure how since this is a test file generated from Intan's simulator. Since it is a binary file I can just read it myself and see if I can figure out what is going on. I think for me what I would say is:

  1. let me fully separate out rhs and rhd for this. I agree with you that trying to squish them together might be trying to hack too much. Some duplication is probably a good idea so we can adapt and adjust one without needing to worry about the other.
  2. Figure out why timestamps are messed up (they really shouldn't be).

@zm711 zm711 added this to the 0.14.0 milestone May 3, 2024
@h-mayorquin
Copy link
Contributor

The test is failing due to timestamp issue.... That means the test file could be corrupt. Not sure how since this is a test file generated from Intan's simulator. Since it is a binary file I can just read it myself and see if I can figure out what is going on. I think for me what I would say is:

  1. let me fully separate out rhs and rhd for this. I agree with you that trying to squish them together might be trying to hack too much. Some duplication is probably a good idea so we can adapt and adjust one without needing to worry about the other.
  2. Figure out why timestamps are messed up (they really shouldn't be).

Sounds good, let me know if you need to upload something again.

Copy link
Contributor Author

@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.

The number of times I've mistyped these test files is outrageous....

neo/test/iotest/test_intanio.py Outdated Show resolved Hide resolved
neo/test/rawiotest/test_intanrawio.py Outdated Show resolved Hide resolved
neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
neo/rawio/intanrawio.py Outdated Show resolved Hide resolved
@zm711 zm711 marked this pull request as ready for review May 6, 2024 10:49
@zm711
Copy link
Contributor Author

zm711 commented May 6, 2024

@samuelgarcia @alejoe91

This is actually ready for review now. Tests are passing (barring the retest happening right now which should pass). With this PR we now support all formats of Intan (rhd and rhs, traditional + headerless binary formats). If you think it would be beneficial for this release feel free to review now. Otherwise we can wait. @h-mayorquin said he would do another read-over later. So we can either merge sooner and then fix up or wait and tidy more now.

I would prefer squashing this one. I had some fights with typos in the paths to the test files, so there are a lot of junk commits.

@alejoe91
Copy link
Contributor

alejoe91 commented May 6, 2024

Thanks @zm711

This looks good to me! @h-mayorquin if you want to take another look, otherwise we can squash and merge and include this in the release :)

@h-mayorquin
Copy link
Contributor

I took a second look, it looks good to me.

@zm711 zm711 modified the milestones: 0.14.0, 0.13.1 May 6, 2024
@zm711
Copy link
Contributor Author

zm711 commented May 6, 2024

Thanks @h-mayorquin!

@apdavison apdavison merged commit 4e57cc1 into NeuralEnsemble:master May 7, 2024
3 checks passed
@zm711 zm711 deleted the intan-rhs branch May 7, 2024 09:12
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.

4 participants