Skip to content

Commit

Permalink
New method insert_subsample_for_image_full_path and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlLevik committed Jan 14, 2021
1 parent 7089f0b commit 1518465
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ispyb/sp/xtalimaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,38 @@ def upsert_sample_image_auto_score(
args=[image_full_path, schema_name, score_class, probability],
)

def insert_subsample_for_image_full_path(
self,
image_full_path,
source,
position1x,
position1y,
position2x=None,
position2y=None,
):
"""Store new subsample for a given sample image.
:param image_full_path: The full path to the sample image
:param source: manual or auto
:param position1x:
:param position1y:
:param position2x:
:param position2y:
"""
id = None
return self.get_connection().call_sp_write(
procname="insert_subsample_for_image_full_path",
args=[
id,
image_full_path,
source,
position1x,
position1y,
position2x,
position2y,
],
)

def retrieve_container_for_barcode(self, barcode):
"""Retrieve info about the container indetified by the give barcode."""
return self.get_connection().call_sp_retrieve(
Expand Down
18 changes: 18 additions & 0 deletions tests/test_xtalimaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,21 @@ def test_xtal_imaging(testdb):

assert cid2 is not None
assert cid2 == 34874

ssid = xtalimaging.insert_subsample_for_image_full_path(
image_full_path=si_full_path,
source="auto",
position1x=3.04,
position1y=6.13,
)
assert ssid is not None

ssid2 = xtalimaging.insert_subsample_for_image_full_path(
image_full_path=si_full_path,
source="auto",
position1x=3.04,
position1y=6.13,
position2x=4.5,
position2y=7.8,
)
assert ssid2 is not None

0 comments on commit 1518465

Please sign in to comment.