Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into main
  • Loading branch information
kabilar committed Sep 17, 2021
2 parents 6472c19 + 1fdbcf1 commit a0f49d2
Show file tree
Hide file tree
Showing 4 changed files with 765 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ ARG PKG_NAME
ARG PKG_VERSION

FROM datajoint/${IMAGE}:py${PY_VER}-${DISTRO}
COPY --chown=dja:anaconda ./requirements.txt ./setup.py \
COPY --chown=anaconda:anaconda ./requirements.txt ./setup.py \
/main/
COPY --chown=dja:anaconda ./${PKG_NAME} /main/${PKG_NAME}
COPY --chown=anaconda:anaconda ./${PKG_NAME} /main/${PKG_NAME}
RUN \
cd /main && \
pip install . && \
Expand Down
13 changes: 13 additions & 0 deletions element_array_ephys/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import datajoint as dj
import pathlib
import uuid
import hashlib


dj.config['enable_python_native_blobs'] = True
Expand Down Expand Up @@ -54,3 +56,14 @@ def find_root_directory(root_directories, full_path):
except StopIteration:
raise FileNotFoundError('No valid root directory found (from {})'
' for {}'.format(root_directories, full_path))


def dict_to_uuid(key):
"""
Given a dictionary `key`, returns a hash string as UUID
"""
hashed = hashlib.md5()
for k, v in sorted(key.items()):
hashed.update(str(k).encode())
hashed.update(str(v).encode())
return uuid.UUID(hex=hashed.hexdigest())
16 changes: 2 additions & 14 deletions element_array_ephys/ephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import re
import numpy as np
import inspect
import uuid
import hashlib
import importlib

from .readers import spikeglx, kilosort, openephys
from . import probe, find_full_path, find_root_directory
from . import probe, find_full_path, find_root_directory, dict_to_uuid

schema = dj.schema()

Expand Down Expand Up @@ -481,8 +479,8 @@ class CuratedClustering(dj.Imported):

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

return electrode_config_key


def dict_to_uuid(key):
"""
Given a dictionary `key`, returns a hash string as UUID
"""
hashed = hashlib.md5()
for k, v in sorted(key.items()):
hashed.update(str(k).encode())
hashed.update(str(v).encode())
return uuid.UUID(hex=hashed.hexdigest())
Loading

0 comments on commit a0f49d2

Please sign in to comment.