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

Add mock units table #1875

Merged
merged 11 commits into from
Apr 1, 2024
Merged

Conversation

h-mayorquin
Copy link
Contributor

@h-mayorquin h-mayorquin commented Mar 27, 2024

Motivation

Add a quick method to create mock units table
Is this something that would be of interest or useful to have?

How to test the behavior?

Should we have tests for the mock methods?

from pynwb.testing.mock.ecephys import mock_Units


units_table = mock_Units()
units_table.to_dataframe()

Produces the following output.

id unit_name spike_times
0 unit_0 [0.6369616873214543, 0.9067484010853246, 0.9477219250215193]
1 unit_1 [0.8158535541215322, 0.8185920542916802, 1.6759963308792496, 1.709581906184714, 2.439237352614658]
2 unit_2 [0.028319671145462966, 0.1526029476450269, 0.8232273623386572]
3 unit_3 [0.6884467305709401, 1.0773681545500438, 1.212464659572455]
4 unit_4 [0.5715298307297609, 0.8933992218057031, 1.4876992520053998, 1.825610477512533, 2.2172294780406943, 3.1075038300454865, 3.3346614235788663, 3.9578485682649087, 4.041863911847294]
5 unit_5 [0.7870983074886834, 1.0264677504816355, 1.9029519812923392, 1.9615200160975337, 2.297637076643194, 2.447916543538033, 2.89825591018732, 3.694580180474614]
6 unit_6 [0.4045518398215282, 0.6030648843307835]
7 unit_7 [0.6291081515397092, 1.5562627046075765, 1.9966398593233605, 2.9512303530140978, 3.4511261667017448, 3.8763547915508205, 4.496568243566198, 5.491664748801522, 6.440608423739287]
8 unit_8 [0.7577288453082914, 1.2551515407959104, 1.784463700992681, 2.5702494017064885, 2.9849052510621594, 3.7193888228508887, 4.430531700840638, 5.3625913874540165, 5.477524020734922]
9 unit_9 [0.9274239286245599, 1.8953501185492063, 1.9100564235145756]

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Have you checked our Contributing document?
  • Have you ensured the PR clearly describes the problem and the solution?
  • Is your contribution compliant with our coding style? This can be checked running flake8 from the source directory.
  • Have you checked to ensure that there aren't other open Pull Requests for the same change?
  • Have you included the relevant issue number using "Fix #XXX" notation where XXX is the issue number? By including "Fix #XXX" you allow GitHub to close issue #XXX when the PR is merged.

@oruebel
Copy link
Contributor

oruebel commented Mar 27, 2024

Should we have tests for the mock methods?

Since pynwb.testing is part of the main pynwb package (not just the test harness), I do think that having at least a basic set of unit tests that generate a mock instance and then check that the contents are as expected would be very useful, in particular since downstream testing depends on it. Also, to keep our test coverage up.

@oruebel
Copy link
Contributor

oruebel commented Mar 27, 2024

Should we have tests for the mock methods?

Correction of my previous comment. Tests for the mock classes are here https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/tests/unit/test_mock.py

@h-mayorquin
Copy link
Contributor Author

Thanks @oruebel. I will take care of this.

Copy link

codecov bot commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.81%. Comparing base (faa8884) to head (18d55b1).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1875   +/-   ##
=======================================
  Coverage   91.81%   91.81%           
=======================================
  Files          27       27           
  Lines        2627     2627           
  Branches      688      688           
=======================================
  Hits         2412     2412           
  Misses        142      142           
  Partials       73       73           
Flag Coverage Δ
integration 72.47% <ø> (ø)
unit 83.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@h-mayorquin h-mayorquin marked this pull request as ready for review March 31, 2024 16:24
@bendichter bendichter self-requested a review March 31, 2024 23:57
@rly rly merged commit af63c5f into NeurodataWithoutBorders:dev Apr 1, 2024
23 of 24 checks passed
@rly
Copy link
Contributor

rly commented Apr 1, 2024

Thank you for the contribution, @h-mayorquin !

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.

4 participants