Skip to content

Commit

Permalink
changelog, ruff and test
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin committed Mar 30, 2024
1 parent e0aa6a9 commit d9eee7b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Support `stimulus_template` as optional predefined column in `IntracellularStimuliTable`. @stephprince [#1815](https://github.com/NeurodataWithoutBorders/pynwb/pull/1815)
- Support `NWBDataInterface` and `DynamicTable` in `NWBFile.stimulus`. @rly [#1842](https://github.com/NeurodataWithoutBorders/pynwb/pull/1842)
- Added support for python 3.12 and upgraded dependency versions. This also includes infrastructure updates for developers. @mavaylon1 [#1853](https://github.com/NeurodataWithoutBorders/pynwb/pull/1853)
- Added `mock_Units` for generating Units tables: @h-mayorquin [#1853](https://github.com/NeurodataWithoutBorders/pynwb/pull/1853)

### Bug fixes
- Fix bug with reading file with linked `TimeSeriesReferenceVectorData` @rly [#1865](https://github.com/NeurodataWithoutBorders/pynwb/pull/1865)
Expand Down
11 changes: 4 additions & 7 deletions src/pynwb/testing/mock/ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from ...ecephys import ElectricalSeries, ElectrodeGroup, SpikeEventSeries
from .device import mock_Device
from .utils import name_generator
from ...misc import Units


def mock_ElectrodeGroup(
Expand Down Expand Up @@ -121,11 +122,7 @@ def mock_SpikeEventSeries(
return spike_event_series


from pynwb.misc import Units
import numpy as np


def mock_Units(num_units: int = 10, max_spikes: int = 10, seed: Optional[int] = None):
def mock_Units(num_units: int = 10, max_spikes_per_unit: int = 10, seed: Optional[int] = None):

units_table = Units()
units_table.add_column(
Expand All @@ -136,8 +133,8 @@ def mock_Units(num_units: int = 10, max_spikes: int = 10, seed: Optional[int] =
seed = 0
rng = np.random.default_rng(seed=seed)

times = rng.random(size=(num_units, max_spikes)).cumsum(axis=1)
spikes_per_unit = rng.integers(1, max_spikes, size=num_units)
times = rng.random(size=(num_units, max_spikes_per_unit)).cumsum(axis=1)
spikes_per_unit = rng.integers(1, max_spikes_per_unit, size=num_units)

spike_times = []
for unit_index in range(num_units):
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
mock_ElectrodeTable,
mock_ElectricalSeries,
mock_SpikeEventSeries,
mock_Units,
)

from pynwb.testing.mock.icephys import (
Expand Down Expand Up @@ -82,6 +83,7 @@
mock_IntracellularElectrode,
mock_CurrentClampStimulusSeries,
mock_IntracellularRecordingsTable,
mock_Units,
]


Expand Down Expand Up @@ -119,3 +121,5 @@ def test_name_generator():

assert name_generator("TimeSeries") == "TimeSeries"
assert name_generator("TimeSeries") == "TimeSeries2"


0 comments on commit d9eee7b

Please sign in to comment.