Skip to content

Commit

Permalink
[FIX] Move Function/logic from mxcubeweb to mxcubecore level
Browse files Browse the repository at this point in the history
  • Loading branch information
FLorial Jean Baptiste committed Apr 26, 2024
1 parent 08056ce commit 54143a6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
14 changes: 14 additions & 0 deletions mxcubecore/HardwareObjects/EMBLFlexHarvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,17 @@ def _do_load(self, sample=None):
self._loaded_sample = loaded_sample

return self._set_loaded_sample_and_prepare(loaded_sample, previous_sample)

def harvest_and_mount_sample(self, xtal_uuid: str, sampleID: str) -> bool:
"""
return (Bool) : wether the crystal has been Harvest then mount
"""
try:
self._harvester_hwo.harvest_crystal(xtal_uuid)
self._harvester_hwo._wait_sample_transfer_ready(None)

self._do_load(sampleID)
except Exception:
logging.getLogger("user_level_log").exception("Could not Harvest Crystal")
return "Could not Harvest Crystal"
11 changes: 9 additions & 2 deletions mxcubecore/HardwareObjects/Harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,14 @@ def harvest_crystal(self, crystal_uuid: str) -> str:
Args (str) : Crystal uuid
"""
return self._execute_cmd_exporter("harvestCrystal", crystal_uuid, command=True)
try:
self._execute_cmd_exporter("harvestCrystal", crystal_uuid, command=True)
return "Crystal Harvested properly"
except Exception:
logging.getLogger("user_level_log").warning(
f"Warning: Could not harvest sample: {crystal_uuid}"
)
return "Could not Harvest Crystal"

def transfer_sample(self) -> None:
"""Transfer the current Harvested Crystal"""
Expand Down Expand Up @@ -518,7 +525,7 @@ def queue_harvest_sample(
except (ValueError, IndexError):
current_queue_index = None

wait_before_load = False if self.get_room_temperature_mode() else True
wait_before_load = not self.get_room_temperature_mode()
if sample_uuid in ["undefined", "", None]:
sample_uuid = current_queue[data_model.loc_str]["code"]

Expand Down
2 changes: 1 addition & 1 deletion mxcubecore/HardwareObjects/HarvesterMaintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def validate_calibration(self) -> bool:
calibrated_motor_offset["phiz"],
)

self._harvester.calibration_state(False)
self._harvester.set_calibration_state(False)
except Exception:
logging.getLogger("user_level_log").exception(
"Pin Calibration / validation Failed"
Expand Down

0 comments on commit 54143a6

Please sign in to comment.