Skip to content

Commit 9ab0fdd

Browse files
committed
Tomo params depend on dcg_id
1 parent 1afadc3 commit 9ab0fdd

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/murfey/workflows/tomo/picking.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from logging import getLogger
2+
from typing import Tuple
23

34
import numpy as np
45
from sqlalchemy import func
@@ -21,7 +22,7 @@
2122
logger = getLogger("murfey.workflows.tomo.feedback")
2223

2324

24-
def _pj_id_tomo_classification(app_id: int, recipe: str, _db) -> int:
25+
def _ids_tomo_classification(app_id: int, recipe: str, _db) -> Tuple[int, int]:
2526
dcg_id = (
2627
_db.exec(
2728
select(AutoProcProgram, ProcessingJob, DataCollection)
@@ -42,13 +43,15 @@ def _pj_id_tomo_classification(app_id: int, recipe: str, _db) -> int:
4243
.one()[0]
4344
.id
4445
)
45-
return pj_id
46+
return dcg_id, pj_id
4647

4748

4849
def _register_picked_tomogram_use_diameter(message: dict, _db: Session):
4950
"""Received picked particles from the tomogram autopick service"""
5051
# Add this message to the table of seen messages
51-
pj_id = _pj_id_tomo_classification(message["program_id"], "em-tomo-class2d", _db)
52+
dcg_id, pj_id = _ids_tomo_classification(
53+
message["program_id"], "em-tomo-class2d", _db
54+
)
5255

5356
pick_params = TomogramPicks(
5457
pj_id=pj_id,
@@ -78,7 +81,7 @@ def _register_picked_tomogram_use_diameter(message: dict, _db: Session):
7881
]
7982
tomo_params = _db.exec(
8083
select(TomographyProcessingParameters).where(
81-
TomographyProcessingParameters.pj_id == pj_id
84+
TomographyProcessingParameters.dcg_id == dcg_id
8285
)
8386
).one()
8487

tests/workflows/tomo/test_tomo_picking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_picked_tomogram_not_run_class2d(
2020
mock_pjid, mock_transport, murfey_db_session: Session, tmp_path
2121
):
2222
"""Run the picker feedback with less particles than needed for classification"""
23-
mock_pjid.return_value = 1
23+
mock_pjid.return_value = [2, 1]
2424

2525
# Insert table dependencies
2626
dcg_entry: DataCollectionGroup = get_or_create_db_entry(
@@ -89,7 +89,7 @@ def test_picked_tomogram_run_class2d(
8989
mock_pjid, mock_transport, murfey_db_session: Session, tmp_path
9090
):
9191
"""Run the picker feedback with less particles than needed for classification"""
92-
mock_pjid.return_value = 1
92+
mock_pjid.return_value = [2, 1]
9393

9494
# Insert table dependencies
9595
dcg_entry: DataCollectionGroup = get_or_create_db_entry(

0 commit comments

Comments
 (0)