Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust no-transact pop hashing mechanism #1108

Merged
merged 3 commits into from
Sep 13, 2024
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ dj.FreeTable(dj.conn(), "common_session.session_group").drop()

### Infrastructure

- Disable populate transaction protection for long-populating tables #1066
- Disable populate transaction protection for long-populating tables #1066,
#1108
- Add docstrings to all public methods #1076
- Update DataJoint to 0.14.2 #1081

Expand Down
4 changes: 3 additions & 1 deletion src/spyglass/utils/dj_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from datajoint import FreeTable, Table
from datajoint.condition import make_condition
from datajoint.dependencies import unite_master_parts
from datajoint.hash import key_hash
from datajoint.user_tables import TableMeta
from datajoint.utils import get_master, to_camel_case
from networkx import (
Expand Down Expand Up @@ -601,7 +602,8 @@ def hash(self):
"""Return hash of all visited nodes."""
initial = hash_md5(b"")
for table in self.all_ft:
initial.update(table.fetch())
for row in table.fetch(as_dict=True):
initial.update(key_hash(row).encode("utf-8"))
return initial.hexdigest()

# ------------------------------- Add Nodes -------------------------------
Expand Down
80 changes: 0 additions & 80 deletions tests/common/test_session.py

This file was deleted.

4 changes: 3 additions & 1 deletion tests/spikesorting/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def pop_curation(spike_v1, pop_sort):
description="testing sort",
)

yield spike_v1.CurationV1().fetch("KEY", as_dict=True)[0]
yield (spike_v1.CurationV1() & {"parent_curation_id": -1}).fetch(
"KEY", as_dict=True
)[0]


@pytest.fixture(scope="session")
Expand Down
9 changes: 4 additions & 5 deletions tests/spikesorting/test_curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@ def test_curation_sort(spike_v1, pop_curation):
), "CurationV1.get_sorting unexpected shape"


def test_curation_sort_info(spike_v1, pop_curation):
def test_curation_sort_info(spike_v1, pop_curation, pop_curation_metric):
sort_info = spike_v1.CurationV1.get_sort_group_info(pop_curation)
sort_metric = spike_v1.CurationV1.get_sort_group_info(pop_curation_metric)

assert (
hash_sort_info(sort_info) == "be874e806a482ed2677fd0d0b449f965"
), "CurationV1.get_sort_group_info unexpected value"


def test_curation_metric(spike_v1, pop_curation_metric):
sort_info = spike_v1.CurationV1.get_sort_group_info(pop_curation_metric)
assert (
hash_sort_info(sort_info) == "48e437bc116900fe64e492d74595b56d"
hash_sort_info(sort_metric) == "48e437bc116900fe64e492d74595b56d"
), "CurationV1.get_sort_group_info unexpected value"
Loading