Skip to content

Commit 423a2ab

Browse files
committed
Merged recent changes from 'main' branch
2 parents baf1c50 + 1c5667d commit 423a2ab

File tree

20 files changed

+251
-399
lines changed

20 files changed

+251
-399
lines changed

.bumpclient.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.bumpversion]
2-
current_version = "0.16.0"
2+
current_version = "0.16.1"
33
commit = true
44
tag = false
55

.bumpversion.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.bumpversion]
2-
current_version = "0.16.0"
2+
current_version = "0.16.1"
33
commit = true
44
tag = true
55

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires = [
77

88
[project]
99
name = "murfey"
10-
version = "0.16.0"
10+
version = "0.16.1"
1111
description = "Client-Server architecture hauling Cryo-EM data"
1212
readme = "README.md"
1313
keywords = [

src/murfey/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from __future__ import annotations
22

3-
__version__ = "0.16.0"
4-
__supported_client_version__ = "0.16.0"
3+
__version__ = "0.16.1"
4+
__supported_client_version__ = "0.16.1"

src/murfey/client/contexts/spa.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def _position_analysis(
570570
grid_square = _grid_square_from_file(transferred_file)
571571
grid_square_metadata_file = _grid_square_metadata_file(
572572
transferred_file,
573-
machine_config["data_directories"],
573+
[Path(p) for p in machine_config["data_directories"]],
574574
environment.visit,
575575
grid_square,
576576
)
@@ -921,6 +921,7 @@ def _register_processing_job(
921921
)
922922
msg: Dict[str, Any] = {
923923
"tag": tag,
924+
"source": tag,
924925
"recipe": "ispyb-relion",
925926
"parameters": {
926927
"acquisition_software": parameters["acquisition_software"],

src/murfey/client/contexts/spa_metadata.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import requests
66
import xmltodict
7-
from PIL import Image
87

98
from murfey.client.context import Context
109
from murfey.client.contexts.spa import _get_grid_square_atlas_positions, _get_source
@@ -85,17 +84,9 @@ def post_transfer(
8584
atlas_original_pixel_size = atlas_xml_data["MicroscopeImage"][
8685
"SpatialScale"
8786
]["pixelSize"]["x"]["numericValue"]
88-
readout_width = float(
89-
atlas_xml_data["MicroscopeImage"]["SpatialScale"]["pixelSize"]["x"][
90-
"numericValue"
91-
]
92-
)
9387

9488
# need to calculate the pixel size of the downscaled image
95-
atlas_im = Image.open(atlas_xml_path.with_suffix(".jpg"))
96-
atlas_pixel_size = atlas_original_pixel_size * (
97-
readout_width / atlas_im.width
98-
)
89+
atlas_pixel_size = atlas_original_pixel_size * 7.8
9990

10091
source = _get_source(
10192
visitless_path.parent / "Images-Disc1" / visitless_path.name,

src/murfey/client/contexts/tomo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ def _add_tilt(
375375
proc_url,
376376
{
377377
"tag": tilt_series,
378+
"source": str(self._basepath),
378379
"recipe": "em-tomo-preprocess",
379380
"experiment_type": "tomography",
380381
},
@@ -385,6 +386,7 @@ def _add_tilt(
385386
proc_url,
386387
{
387388
"tag": tilt_series,
389+
"source": str(self._basepath),
388390
"recipe": "em-tomo-align",
389391
"experiment_type": "tomography",
390392
},
@@ -396,6 +398,7 @@ def _add_tilt(
396398
proc_url,
397399
json={
398400
"tag": tilt_series,
401+
"source": str(self._basepath),
399402
"recipe": "em-tomo-preprocess",
400403
"experiment_type": "tomography",
401404
},
@@ -404,6 +407,7 @@ def _add_tilt(
404407
proc_url,
405408
json={
406409
"tag": tilt_series,
410+
"source": str(self._basepath),
407411
"recipe": "em-tomo-align",
408412
"experiment_type": "tomography",
409413
},

src/murfey/client/multigrid_control.py

Lines changed: 80 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -366,16 +366,9 @@ def _start_dc(self, json, from_form: bool = False):
366366
f"{self._environment.url.geturl()}/clients/{self._environment.client_id}/tomography_processing_parameters",
367367
json=json,
368368
)
369+
369370
source = Path(json["source"])
370-
self._environment.listeners["data_collection_group_ids"] = {
371-
context._flush_data_collections
372-
}
373-
self._environment.listeners["data_collection_ids"] = {
374-
context._flush_processing_job
375-
}
376-
self._environment.listeners["autoproc_program_ids"] = {
377-
context._flush_preprocess
378-
}
371+
379372
self._environment.id_tag_registry["data_collection_group"].append(
380373
str(source)
381374
)
@@ -386,12 +379,85 @@ def _start_dc(self, json, from_form: bool = False):
386379
"tag": str(source),
387380
}
388381
requests.post(url, json=dcg_data)
382+
383+
data = {
384+
"voltage": json["voltage"],
385+
"pixel_size_on_image": json["pixel_size_on_image"],
386+
"experiment_type": json["experiment_type"],
387+
"image_size_x": json["image_size_x"],
388+
"image_size_y": json["image_size_y"],
389+
"file_extension": json["file_extension"],
390+
"acquisition_software": json["acquisition_software"],
391+
"image_directory": str(self._environment.default_destinations[source]),
392+
"tag": json["tilt_series_tag"],
393+
"source": str(source),
394+
"magnification": json["magnification"],
395+
"total_exposed_dose": json.get("total_exposed_dose"),
396+
"c2aperture": json.get("c2aperture"),
397+
"exposure_time": json.get("exposure_time"),
398+
"slit_width": json.get("slit_width"),
399+
"phase_plate": json.get("phase_plate", False),
400+
}
401+
capture_post(
402+
f"{str(self._environment.url.geturl())}/visits/{str(self._environment.visit)}/{self._environment.murfey_session}/start_data_collection",
403+
json=data,
404+
)
405+
for recipe in ("em-tomo-preprocess", "em-tomo-align"):
406+
capture_post(
407+
f"{str(self._environment.url.geturl())}/visits/{str(self._environment.visit)}/{self._environment.murfey_session}/register_processing_job",
408+
json={
409+
"tag": json["tilt_series_tag"],
410+
"source": str(source),
411+
"recipe": recipe,
412+
},
413+
)
414+
log.info("Registering tomography processing parameters")
415+
if self._environment.data_collection_parameters.get("num_eer_frames"):
416+
eer_response = requests.post(
417+
f"{str(self._environment.url.geturl())}/visits/{self._environment.visit}/{self._environment.murfey_session}/eer_fractionation_file",
418+
json={
419+
"num_frames": self._environment.data_collection_parameters[
420+
"num_eer_frames"
421+
],
422+
"fractionation": self._environment.data_collection_parameters[
423+
"eer_fractionation"
424+
],
425+
"dose_per_frame": self._environment.data_collection_parameters[
426+
"dose_per_frame"
427+
],
428+
"fractionation_file_name": "eer_fractionation_tomo.txt",
429+
},
430+
)
431+
eer_fractionation_file = eer_response.json()["eer_fractionation_file"]
432+
json.update({"eer_fractionation_file": eer_fractionation_file})
433+
requests.post(
434+
f"{self._environment.url.geturl()}/sessions/{self._environment.murfey_session}/tomography_preprocessing_parameters",
435+
json=json,
436+
)
437+
context._flush_data_collections()
438+
context._flush_processing_jobs()
439+
capture_post(
440+
f"{self._environment.url.geturl()}/visits/{self._environment.visit}/{self._environment.murfey_session}/flush_tomography_processing",
441+
json={"rsync_source": str(source)},
442+
)
443+
log.info("tomography processing flushed")
444+
389445
elif isinstance(context, SPAContext) or isinstance(context, SPAModularContext):
390446
url = f"{str(self._environment.url.geturl())}/visits/{str(self._environment.visit)}/{self.session_id}/register_data_collection_group"
391447
dcg_data = {
392448
"experiment_type": "single particle",
393449
"experiment_type_id": 37,
394450
"tag": str(source),
451+
"atlas": (
452+
str(self._environment.samples[source].atlas)
453+
if self._environment.samples.get(source)
454+
else ""
455+
),
456+
"sample": (
457+
self._environment.samples[source].sample
458+
if self._environment.samples.get(source)
459+
else None
460+
),
395461
}
396462
capture_post(url, json=dcg_data)
397463
if from_form:
@@ -428,7 +494,11 @@ def _start_dc(self, json, from_form: bool = False):
428494
):
429495
capture_post(
430496
f"{str(self._environment.url.geturl())}/visits/{str(self._environment.visit)}/{self.session_id}/register_processing_job",
431-
json={"tag": str(source), "recipe": recipe},
497+
json={
498+
"tag": str(source),
499+
"source": str(source),
500+
"recipe": recipe,
501+
},
432502
)
433503
log.info(f"Posting SPA processing parameters: {json}")
434504
response = capture_post(

src/murfey/client/tui/app.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,11 @@ def _start_dc(self, json, from_form: bool = False):
516516
for recipe in ("em-tomo-preprocess", "em-tomo-align"):
517517
capture_post(
518518
f"{str(self._url.geturl())}/visits/{str(self._visit)}/{self._environment.murfey_session}/register_processing_job",
519-
json={"tag": json["tilt_series_tag"], "recipe": recipe},
519+
json={
520+
"tag": json["tilt_series_tag"],
521+
"source": str(source),
522+
"recipe": recipe,
523+
},
520524
)
521525
log.info("Registering tomography processing parameters")
522526
if self.app._environment.data_collection_parameters.get("num_eer_frames"):
@@ -600,7 +604,11 @@ def _start_dc(self, json, from_form: bool = False):
600604
):
601605
capture_post(
602606
f"{str(self._url.geturl())}/visits/{str(self._visit)}/{self._environment.murfey_session}/register_processing_job",
603-
json={"tag": str(source), "recipe": recipe},
607+
json={
608+
"tag": str(source),
609+
"source": str(source),
610+
"recipe": recipe,
611+
},
604612
)
605613
log.info(f"Posting SPA processing parameters: {json}")
606614
response = capture_post(

src/murfey/client/tui/screens.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,11 @@ def on_button_pressed(self, event: Button.Pressed):
717717
if self._switch_status:
718718
self.app.install_screen(
719719
DirectorySelection(
720-
[p for p in machine_data.get("data_directories", []) if p.exists()]
720+
[
721+
p
722+
for p in machine_data.get("data_directories", [])
723+
if Path(p).exists()
724+
]
721725
),
722726
"directory-select",
723727
)

0 commit comments

Comments
 (0)