Skip to content

Add type hints and tests to analysis package #43

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

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

joschaschmiedt
Copy link

@joschaschmiedt joschaschmiedt commented Apr 3, 2025

While exploring the API of the analysis package, I saw that there is an implicit abstraction of the Continuous and Spikes classes. I made that abstraction explicit (adding ContinuousAbstract and SpikesAbstract interfaces) and added type hints throughout the analysis package.

I've also added test datasets for the binary, open-ephys and NWB data formats as well as test cases for reading those data in. While doing so I fixed potential bugs

  • There was a typo on a float64 dtype (see ecd427b)
  • Reading in the Spikes from the open-ephys format test dataset causes a reshaping error (see test_spike_data in test_openephys_format).
  • The BinaryRecording contained a call to the non-existent function create_channel_map

If you find any of this useful, feel free to merge and modify my suggestions.

Here's the complete CHANGELOG:

  • Dropped support for Python < 3.9
  • Refactoring without new functionality or API changes
    • The Continuous and Spike classes of the three formats now have an explicit interface
      (i.e. abstract parent class) and have been renamed to BinaryContinuous, BinarySpike etc.
    • The metadata of Continuous and Spike in the analysis package now are typed dataclasses
      instead of dict objects . This makes accessing metadata more reliable.
    • Type hints have been added to the analysis package.
    • Automated tests for reading Binary, NWB and OpenEphys data formats have been added (incl. GitHub action)
    • Added a RecordingFormat enum for the three formats
    • Added a JSON schema for validating oebin files
    • Added a uv.lock file for reproducible development environments.
  • BinaryContinuous and BinarySpike now have __str__ methods to give an overview over
    their contents.

@jsiegle
Copy link
Member

jsiegle commented Apr 4, 2025

Thanks for this! Let us know when you're finished making changes and we will test it out.

@joschaschmiedt joschaschmiedt changed the title Add type hints and tests Draft: Add type hints and tests Apr 7, 2025
@joschaschmiedt joschaschmiedt changed the title Draft: Add type hints and tests Add type hints and tests analysis package Apr 9, 2025
@joschaschmiedt
Copy link
Author

@jsiegle, I think I'm done with changes from my side. I'd be happy if you could test it out.

@joschaschmiedt joschaschmiedt changed the title Add type hints and tests analysis package Add type hints and tests to analysis package Apr 9, 2025
@jsiegle
Copy link
Member

jsiegle commented Apr 10, 2025

Thanks, we should be able to take a closer look at this next week.

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