Skip to content

Commit 5eb28c1

Browse files
committed
remove support of files with v<1.5 and lazy_ops
1 parent dd7c5a1 commit 5eb28c1

2 files changed

Lines changed: 8 additions & 29 deletions

File tree

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ dependencies = [
2626
"joblib",
2727
"scipy",
2828
"elephant",
29-
"lazy_ops",
30-
"zarr<3.0",
3129
"MEAutility"
3230
]
3331

src/MEArec/tools.py

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import scipy.signal as ss
1313
import yaml
1414
from joblib import Parallel, delayed
15-
from lazy_ops import DatasetView
1615
from packaging.version import parse
1716
from quantities import Quantity
1817

@@ -353,22 +352,18 @@ def load_recordings(
353352
f = h5py.File(str(recordings), "r")
354353
mearec_version = f.attrs.get("mearec_version", "1.4.0")
355354

356-
if parse(mearec_version) >= parse("1.5.0"):
355+
if parse(mearec_version) < parse("1.5.0"):
357356
# version after 1.5.0 is (n_samples, n_channel) inside the h5 file
358-
need_transpose = False
359-
else:
360-
# version 1.4.0 and before is (n_channel, n_samples) inside the h5 file
361-
print(
362-
"Warning: MEArec file created with version <1.5. This could result in lower efficiency. To upgrade"
363-
"your file to the new format use: mr.convert_recording_to_new_version(filename)"
357+
raise Exception(
358+
"MEArec file created with version <1.5 and not supported anymore. To upgrade"
359+
"your file to the new format, install MEArec version 1.5 or higher (<1.10.0) and use: "
360+
"`mr.convert_recording_to_new_version(filename)`"
364361
)
365-
need_transpose = True
366362

367363
rec_dict, info = load_recordings_from_file(
368364
f,
369365
return_h5_objects=return_h5_objects,
370366
load=load,
371-
need_transpose=need_transpose,
372367
load_waveforms=load_waveforms,
373368
)
374369

@@ -386,7 +381,7 @@ def load_recordings(
386381
return recgen
387382

388383

389-
def load_recordings_from_file(f, path="", return_h5_objects=True, load=None, need_transpose=False, load_waveforms=True):
384+
def load_recordings_from_file(f, path="", return_h5_objects=True, load=None, load_waveforms=True):
390385
"""
391386
Load generated recordings from file.
392387
@@ -403,10 +398,6 @@ def load_recordings_from_file(f, path="", return_h5_objects=True, load=None, nee
403398
'timestamps', 'spike_traces', 'templates'))
404399
load_waveforms : bool
405400
If True waveforms are loaded to spiketrains
406-
verbose : bool
407-
If True output is verbose
408-
check_suffix : bool
409-
If True, hdf5 suffix is checked
410401
411402
Returns
412403
-------
@@ -447,27 +438,17 @@ def load_recordings_from_file(f, path="", return_h5_objects=True, load=None, nee
447438
rec_dict["channel_positions"] = np.array(f.get(path + "channel_positions"))
448439
if f.get(path + "recordings") is not None and "recordings" in load:
449440
if return_h5_objects:
450-
if need_transpose:
451-
rec_dict["recordings"] = DatasetView(f.get(path + "recordings")).lazy_transpose()
452-
else:
453-
rec_dict["recordings"] = f.get(path + "recordings")
441+
rec_dict["recordings"] = f.get(path + "recordings")
454442
else:
455443
arr = np.array(f.get(path + "recordings"))
456-
if need_transpose:
457-
arr = arr.T
458444
rec_dict["recordings"] = arr
459445
if "gain_to_uV" in f.get(path + "recordings").attrs:
460446
rec_dict["gain_to_uV"] = f.get(path + "recordings").attrs["gain_to_uV"]
461447
if f.get(path + "spike_traces") is not None and "spike_traces" in load:
462448
if return_h5_objects:
463-
if need_transpose:
464-
rec_dict["spike_traces"] = DatasetView(f.get(path + "spike_traces")).lazy_transpose()
465-
else:
466-
rec_dict["spike_traces"] = f.get(path + "spike_traces")
449+
rec_dict["spike_traces"] = f.get(path + "spike_traces")
467450
else:
468451
arr = np.array(f.get(path + "spike_traces"))
469-
if need_transpose:
470-
arr = arr.T
471452
rec_dict["spike_traces"] = arr
472453
if f.get(path + "templates") is not None and "templates" in load:
473454
if return_h5_objects:

0 commit comments

Comments
 (0)