Skip to content
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
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
import os
import sys

from distutils.version import LooseVersion
from packaging.version import Version

with open("../../neo/version.py") as fp:
d = {}
exec(fp.read(), d)
neo_release = d['version']

neo_version = '.'.join(str(e) for e in LooseVersion(neo_release).version[:2])
neo_version = '.'.join((str(e) for e in Version(neo_release).release[:2]))


AUTHORS = 'Neo authors and contributors <neuralensemble@googlegroups.com>'
Expand Down
4 changes: 2 additions & 2 deletions neo/io/neomatlabio.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
"""

from datetime import datetime
from distutils import version
import re

import numpy as np
import quantities as pq

# check scipy
try:
from packaging.version import Version
import scipy.io
import scipy.version
except ImportError as err:
HAVE_SCIPY = False
SCIPY_ERR = err
else:
if version.LooseVersion(scipy.version.version) < '0.12.0':
if Version(scipy.version.version) < Version('0.12.0'):
HAVE_SCIPY = False
SCIPY_ERR = ImportError("your scipy version is too old to support "
+ "MatlabIO, you need at least 0.12.0. "
Expand Down
2 changes: 1 addition & 1 deletion neo/io/nixio.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import itertools
from uuid import uuid4
import warnings
from distutils.version import LooseVersion as Version
from packaging.version import Version
from itertools import chain

import quantities as pq
Expand Down
14 changes: 7 additions & 7 deletions neo/rawio/intanrawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import numpy as np
from collections import OrderedDict
from distutils.version import LooseVersion as V
from packaging.version import Version as V


class IntanRawIO(BaseRawIO):
Expand Down Expand Up @@ -428,20 +428,20 @@ def read_rhd(filename):

version = V('{major_version}.{minor_version}'.format(**global_info))

# the header size depend on the version :-(
# the header size depends on the version :-(
header = list(rhd_global_header_part1) # make a copy

if version >= '1.1':
if version >= V('1.1'):
header = header + rhd_global_header_v11
else:
global_info['num_temp_sensor_channels'] = 0

if version >= '1.3':
if version >= V('1.3'):
header = header + rhd_global_header_v13
else:
global_info['eval_board_mode'] = 0

if version >= '2.0':
if version >= V('2.0'):
header = header + rhd_global_header_v20
else:
global_info['reference_channel'] = ''
Expand All @@ -466,14 +466,14 @@ def read_rhd(filename):
sr = global_info['sampling_rate']

# construct the data block dtype and reorder channels
if version >= '2.0':
if version >= V('2.0'):
BLOCK_SIZE = 128
else:
BLOCK_SIZE = 60 # 256 channels

ordered_channels = []

if version >= '1.2':
if version >= V('1.2'):
data_dtype = [('timestamp', 'int32', BLOCK_SIZE)]
else:
data_dtype = [('timestamp', 'uint32', BLOCK_SIZE)]
Expand Down
18 changes: 10 additions & 8 deletions neo/rawio/neuralynxrawio/nlxheader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import datetime
import distutils.version
from packaging.version import Version
import os
import re
from collections import OrderedDict
Expand Down Expand Up @@ -189,7 +189,9 @@ def __init__(self, filename):
self['ApplicationName'] = 'Neuraview'
app_version = '2'

self['ApplicationVersion'] = distutils.version.LooseVersion(app_version)
if " Development" in app_version:
app_version = app_version.replace(" Development", ".dev0")
self['ApplicationVersion'] = Version(app_version)

# convert bit_to_microvolt
if 'bit_to_microVolt' in self:
Expand All @@ -215,22 +217,22 @@ def __init__(self, filename):
an = self['ApplicationName']
if an == 'Cheetah':
av = self['ApplicationVersion']
if av <= '2': # version 1 uses same as older versions
if av <= Version('2'): # version 1 uses same as older versions
hpd = NlxHeader.header_pattern_dicts['bv5.6.4']
elif av < '5':
elif av < Version('5'):
hpd = NlxHeader.header_pattern_dicts['bv5']
elif av <= '5.4.0':
elif av <= Version('5.4.0'):
hpd = NlxHeader.header_pattern_dicts['v5.4.0']
elif av <= '5.6.4':
elif av <= Version('5.6.4'):
hpd = NlxHeader.header_pattern_dicts['bv5.6.4']
else:
hpd = NlxHeader.header_pattern_dicts['def']
elif an == 'BML':
hpd = NlxHeader.header_pattern_dicts['bml']
av = "2"
av = Version("2")
elif an == 'Neuraview':
hpd = NlxHeader.header_pattern_dicts['neuraview2']
av = "2"
av = Version("2")
else:
an = "Unknown"
av = "NA"
Expand Down
4 changes: 2 additions & 2 deletions neo/test/iotest/test_blackrockio.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

# check scipy
try:
from distutils import version
from packaging.version import Version
import scipy.io
import scipy.version
except ImportError as err:
HAVE_SCIPY = False
SCIPY_ERR = err
else:
if version.LooseVersion(scipy.version.version) < '0.8':
if Version(scipy.version.version) < Version('0.8'):
HAVE_SCIPY = False
SCIPY_ERR = ImportError("your scipy version is too old to support " +
"MatlabIO, you need at least 0.8. " +
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
packaging
numpy>=1.16.1
quantities>=0.12.1
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import os

long_description = open("README.rst").read()
install_requires = ['numpy>=1.18.5',
install_requires = ['packaging',
'numpy>=1.18.5',
'quantities>=0.12.1']
extras_require = {
'igorproio': ['igor'],
Expand Down