diff --git a/.travis.yml b/.travis.yml index de340f6e..083715fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/ispyb/sp/mxprocessing.py b/ispyb/sp/mxprocessing.py index 93753c3c..7f45f34a 100644 --- a/ispyb/sp/mxprocessing.py +++ b/ispyb/sp/mxprocessing.py @@ -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], + ) diff --git a/tests/test_mxprocessing.py b/tests/test_mxprocessing.py index 6f1f8c40..f211ec3c 100644 --- a/tests/test_mxprocessing.py +++ b/tests/test_mxprocessing.py @@ -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 + )