Skip to content

Commit 91d0d3a

Browse files
committed
Move import h5py check at module level
1 parent d935a06 commit 91d0d3a

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

neo/rawio/biocamrawio.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
_spike_channel_dtype, _event_channel_dtype)
1212

1313
import numpy as np
14-
from copy import deepcopy
14+
15+
try:
16+
import h5py
17+
HAVE_H5PY = True
18+
except ImportError:
19+
HAVE_H5PY = False
1520

1621

1722
class BiocamRawIO(BaseRawIO):
@@ -42,11 +47,6 @@ def _source_name(self):
4247
return self.filename
4348

4449
def _parse_header(self):
45-
try:
46-
import h5py
47-
HAVE_H5PY = True
48-
except ImportError:
49-
HAVE_H5PY = False
5050
assert HAVE_H5PY, 'h5py is not installed'
5151
self._header_dict = open_biocam_file_header(self.filename, self._mea_pitch, self._verbose)
5252
self._num_channels = self._header_dict["num_channels"]
@@ -125,11 +125,6 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop,
125125
def open_biocam_file_header(filename, mea_pitch, verbose=False):
126126
"""Open a Biocam hdf5 file, read and return the recording info, pick te correct method to access raw data,
127127
and return this to the caller."""
128-
try:
129-
import h5py
130-
HAVE_H5PY = True
131-
except ImportError:
132-
HAVE_H5PY = False
133128
assert HAVE_H5PY, 'h5py is not installed'
134129

135130
rf = h5py.File(filename, 'r')

0 commit comments

Comments
 (0)