Skip to content

Commit 5f3244a

Browse files
Add db components from ispyb for processing outputs (#706)
Currently just adds all the ispyb tables into the murfey database. Separating out the databases was too hard as sqlmodel does not support subclassing, and splitting files causes a circular import. --------- Co-authored-by: Dan Hatton <daniel.hatton@diamond.ac.uk>
1 parent 70d5cdb commit 5f3244a

File tree

6 files changed

+334
-6
lines changed

6 files changed

+334
-6
lines changed

src/murfey/cli/create_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ def run():
77
parser = argparse.ArgumentParser(
88
description="Generate the necessary tables for the Murfey database"
99
)
10-
1110
parser.add_argument(
1211
"--no-clear",
1312
dest="clear",
@@ -22,4 +21,5 @@ def run():
2221

2322
if args.clear:
2423
clear(url())
24+
2525
setup(url())

src/murfey/server/api/workflow.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ async def request_spa_preprocessing(
479479
db.add(feedback_params)
480480
movie = Movie(
481481
murfey_id=murfey_ids[0],
482+
data_collection_id=detached_ids[1],
482483
path=proc_file.path,
483484
image_number=proc_file.image_number,
484485
tag=proc_file.tag,
@@ -731,6 +732,17 @@ async def request_tomography_preprocessing(
731732
0
732733
].eer_fractionation_file
733734

735+
movie = Movie(
736+
murfey_id=murfey_ids[0],
737+
data_collection_id=dcid,
738+
path=proc_file.path,
739+
image_number=proc_file.image_number,
740+
tag=proc_file.tag,
741+
)
742+
db.add(movie)
743+
db.commit()
744+
db.close()
745+
734746
zocalo_message: dict = {
735747
"recipes": [recipe_name],
736748
"parameters": {

src/murfey/server/feedback.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,7 @@ def _flush_tomography_preprocessing(message: dict, _db):
14291429
p.parent.mkdir(parents=True)
14301430
movie = db.Movie(
14311431
murfey_id=murfey_ids[0],
1432+
data_collection_id=detached_ids[1],
14321433
path=f.file_path,
14331434
image_number=f.image_number,
14341435
tag=f.tag,
@@ -1818,8 +1819,8 @@ def _save_bfactor(message: dict, _db):
18181819
"ispyb_command": "insert_particle_classification"
18191820
},
18201821
"program_id": message["program_id"],
1821-
"bfactor_fit_intercept": str(bfactor_fitting[1]),
1822-
"bfactor_fit_linear": str(bfactor_fitting[0]),
1822+
"bfactor_fit_intercept": str(float(bfactor_fitting[1])),
1823+
"bfactor_fit_linear": str(float(bfactor_fitting[0])),
18231824
},
18241825
new_connection=True,
18251826
)

0 commit comments

Comments
 (0)