Skip to content

Commit

Permalink
Merge pull request #90 from DiamondLightSource/sample_image_auto_score
Browse files Browse the repository at this point in the history
Sample image auto score
  • Loading branch information
KarlLevik committed Jan 7, 2020
2 parents 309816b + 725ea6e commit 10d174a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ addons:
mariadb: 10.3

before_install:
- wget https://github.com/DiamondLightSource/ispyb-database/releases/download/v1.9.1/ispyb-database-1.9.1.tar.gz
- tar xvfz ispyb-database-1.9.1.tar.gz
- wget https://github.com/DiamondLightSource/ispyb-database/releases/download/v1.10.2/ispyb-database-1.10.2.tar.gz
- tar xvfz ispyb-database-1.10.2.tar.gz
- mysql_upgrade -u root
- mysql -u root -e "CREATE DATABASE ispybtest; SET GLOBAL log_bin_trust_function_creators=ON;"
- mysql -u root -D ispybtest < schema/tables.sql
Expand Down
16 changes: 16 additions & 0 deletions ispyb/sp/mxprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,19 @@ def upsert_job_image_sweep(self, values):
return self.get_connection().call_sp_write(
procname="upsert_processing_job_image_sweep", args=values
)

def upsert_sample_image_auto_score(
self, image_full_path, schema_name, score_class, probability
):
"""Store new or update existing automatic score for a sample image.
:param image_full_path: The full path to the sample image
:param schema_name: The name of the scoring schema, e.g. MARCO
:param score_class: A string that describes the thing we're scoring, e.g. crystal, clear, precipitant, other
:param probability: A float indicating the probability that the image contains the score_class
:return: Nothing.
"""
self.get_connection().call_sp_write(
procname="upsert_sample_image_auto_score",
args=[image_full_path, schema_name, score_class, probability],
)
8 changes: 8 additions & 0 deletions tests/test_mxprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,11 @@ def test_post_processing(testdb):
id = mxprocessing.upsert_run_blob(list(params.values()))
assert id is not None
assert id > 0


def test_sample_image_scoring(testdb):
mxprocessing = testdb.mx_processing

mxprocessing.upsert_sample_image_auto_score(
"/dls/i03/data/2016/cm1234-5/something.jpg", "MARCO", "crystal", 0.65
)

0 comments on commit 10d174a

Please sign in to comment.