Skip to content

Commit 4ab2a6c

Browse files
author
Thinh Nguyen
committed
Merge branch 'main' of https://github.com/datajoint/element-array-ephys into main
2 parents b29b6b0 + 1fdbcf1 commit 4ab2a6c

File tree

3 files changed

+763
-14
lines changed

3 files changed

+763
-14
lines changed

element_array_ephys/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import datajoint as dj
22
import pathlib
3+
import uuid
4+
import hashlib
35

46

57
dj.config['enable_python_native_blobs'] = True
@@ -54,3 +56,14 @@ def find_root_directory(root_directories, full_path):
5456
except StopIteration:
5557
raise FileNotFoundError('No valid root directory found (from {})'
5658
' for {}'.format(root_directories, full_path))
59+
60+
61+
def dict_to_uuid(key):
62+
"""
63+
Given a dictionary `key`, returns a hash string as UUID
64+
"""
65+
hashed = hashlib.md5()
66+
for k, v in sorted(key.items()):
67+
hashed.update(str(k).encode())
68+
hashed.update(str(v).encode())
69+
return uuid.UUID(hex=hashed.hexdigest())

element_array_ephys/ephys.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
import re
44
import numpy as np
55
import inspect
6-
import uuid
7-
import hashlib
86
import importlib
97

108
from .readers import spikeglx, kilosort, openephys
11-
from . import probe, find_full_path, find_root_directory
9+
from . import probe, find_full_path, find_root_directory, dict_to_uuid
1210

1311
schema = dj.schema()
1412

@@ -481,8 +479,8 @@ class CuratedClustering(dj.Imported):
481479

482480
class Unit(dj.Part):
483481
definition = """
484-
-> master
485482
# Properties of a given unit from a round of clustering (and curation)
483+
-> master
486484
unit: int
487485
---
488486
-> probe.ElectrodeConfig.Electrode # electrode with highest waveform amplitude for this unit
@@ -746,13 +744,3 @@ def generate_electrode_config(probe_type: str, electrodes: list):
746744

747745
return electrode_config_key
748746

749-
750-
def dict_to_uuid(key):
751-
"""
752-
Given a dictionary `key`, returns a hash string as UUID
753-
"""
754-
hashed = hashlib.md5()
755-
for k, v in sorted(key.items()):
756-
hashed.update(str(k).encode())
757-
hashed.update(str(v).encode())
758-
return uuid.UUID(hex=hashed.hexdigest())

0 commit comments

Comments
 (0)