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

[MNT] - Update checking of scipy version for updates #19

Merged
merged 2 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 9 additions & 2 deletions convnwb/timestamps/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def match_pulses(sync_behav, sync_neural, n_pulses, start_offset=None):
results due to recording pause at the start.
"""

from scipy import __version__ as scipy_version

isi_sb = np.diff(sync_behav)
isi_sn = np.diff(sync_neural)

Expand All @@ -164,8 +166,13 @@ def match_pulses(sync_behav, sync_neural, n_pulses, start_offset=None):
elif isi_sn[ixn + 1] == isi_sb[ixb + 1]:
ixis += [ixb - ixn]

# Find mode of index offsets
ixis_mode = stats.mode(ixis)[0][0]
# Find mode of index offsets - with a special check for scipy version
version_vals = scipy_version.split('.')
# Old version - prior to `keep_dims` being adding in 1.9
if int(version_vals[0]) == 1 and int(version_vals[1]) < 9:
ixis_mode = stats.mode(ixis)[0][0]
else:
ixis_mode = stats.mode(ixis, keepdims=True).mode[0]

# Select sync vectors
if start_offset is not None:
Expand Down
2 changes: 1 addition & 1 deletion optional-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pynwb
matplotlib
scikit-learn
pandas
scipy <= 1.10
scipy
h5py