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

Avoid having to set rate=None explitctly when passing timestamps in mock_ElectricalSeries #1894

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Modified `OptogeneticSeries` to allow 2D data, primarily in extensions of `OptogeneticSeries`. @rly [#1812](https://github.com/NeurodataWithoutBorders/pynwb/pull/1812)
- 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)
- Set rate default value inside `mock_ElectricalSeries` to avoid having to set `rate=None` explitctly when passing timestamps. @h-mayorquin [#1894](https://github.com/NeurodataWithoutBorders/pynwb/pull/1894)
h-mayorquin marked this conversation as resolved.
Show resolved Hide resolved
- 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 [#1875](https://github.com/NeurodataWithoutBorders/pynwb/pull/1875) and [#1883](https://github.com/NeurodataWithoutBorders/pynwb/pull/1883)

Expand Down
10 changes: 7 additions & 3 deletions src/pynwb/testing/mock/ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ def mock_electrodes(
def mock_ElectricalSeries(
name: Optional[str] = None,
description: str = "description",
data=None,
rate: float = 30000.0,
timestamps=None,
data: Optional[np.ndarray] = None,
rate: Optional[float] = None,
timestamps: Optional[np.ndarray] = None,
stephprince marked this conversation as resolved.
Show resolved Hide resolved
starting_time: Optional[float] = None,
electrodes: Optional[DynamicTableRegion] = None,
filtering: str = "filtering",
Expand All @@ -80,6 +80,10 @@ def mock_ElectricalSeries(
conversion: float = 1.0,
offset: float = 0.,
) -> ElectricalSeries:

# Set a default rate if timestamps are not provided
rate = 30_000.0 if (timestamps is None and rate is None) else rate

electrical_series = ElectricalSeries(
name=name or name_generator("ElectricalSeries"),
description=description,
Expand Down
Loading