Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly pass parameters through all of Hyperion's UDC parameters #746

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

olliesilvester
Copy link
Contributor

@olliesilvester olliesilvester commented Jan 14, 2025

  • Fixes GPU processing not working with gda.mx.hyperion.xrc.compare_cpu_and_gpu=true #738 by giving our Hyperion parameters the WithHyperionUDCFeatures component and making sure Hyperion's different parameter models implement the correct version of detector_parameters

  • Removes the definition of detector_parameters from the model components in common. This:

    1. Forces top level-parameter models to implement detector_parameters, since the common components are abstract without their own definitions. This part was discussed with @rtuck99
    2. Allows the Hyperion plans which run prior to grid_detect to contain their own definition of detector_params, rather than using the one which was defined in GridCommon
  • Clearer distinction between Hyperion's plans which run before and after grid_detect (and so can have SpecifiedGrid in their parameters)

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 98.48485% with 1 line in your changes missing coverage. Please review.

Project coverage is 86.99%. Comparing base (967bc4e) to head (dbc2371).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #746      +/-   ##
==========================================
+ Coverage   86.97%   86.99%   +0.01%     
==========================================
  Files         101      101              
  Lines        6931     6941      +10     
==========================================
+ Hits         6028     6038      +10     
  Misses        903      903              
Components Coverage Δ
i24 SSX 72.69% <ø> (ø)
hyperion 96.53% <98.07%> (+<0.01%) ⬆️
other 96.59% <100.00%> (+<0.01%) ⬆️

@olliesilvester
Copy link
Contributor Author

Also see #747 which ideally should be fixed before next release



class HyperionRobotLoadThenCentre(RobotLoadThenCentre, WithHyperionUDCFeatures):
thawing_time: float = Field(default=HardwareConstants.THAWING_TIME)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thawing_time is also in RobotLoadThenCentre
tip_offset_um is also in GridCommon

): ...


class HyperionGridScanWithEdgeDetect(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be used anywhere?

thawing_time: float = Field(default=HardwareConstants.THAWING_TIME)
tip_offset_um: float = Field(default=HardwareConstants.TIP_OFFSET_UM)

def robot_load_params(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these methods have annotations? That way tooling can help more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be properties?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes to annotations!

I'll make them properties as that's probably more consistent with the other params

Copy link
Contributor

@rtuck99 rtuck99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with above changes

@olliesilvester
Copy link
Contributor Author

I will address these first thing tomorrow

Also, in robot_load_then_xray_centre, we create the detector params

detector_params = yield from fill_in_energy_if_not_supplied(
       composite.dcm, parameters.detector_params
   )

This uses the GridCommon definition of DetectorParams, which doesn't allow us to set dev_shm. I will update this PR to also fix that + a test to prove it

@@ -101,7 +106,7 @@ def activity_gated_start(self, doc: RunStart):
)
mx_bluesky_parameters = doc.get("mx_bluesky_parameters")
assert isinstance(mx_bluesky_parameters, str)
self.params = GridCommon.model_validate_json(mx_bluesky_parameters)
self.params = self.param_type.model_validate_json(mx_bluesky_parameters)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because GridCommon is now abstract, we need to use an implemented version of this model here. Since the type is bound to GridCommon, I don't think this will affect generalisability.

Similar change done in nexus_callback.py

)


class RobotLoadThenCentre(GridCommon):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with @rtuck99 - we're so far off any non-hyperion beamlines doing anything other than a grid scan, it's probably good to get rid of some of the common parameters like this one

@@ -45,7 +45,7 @@ dependencies = [
"daq-config-server >= 0.1.1",
"ophyd == 1.9.0",
"ophyd-async >= 0.8a5",
"bluesky >= 1.13.0a4",
"bluesky >= 1.13",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alpha releases were causing linting issues with set_mock_value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GPU processing not working with gda.mx.hyperion.xrc.compare_cpu_and_gpu=true
2 participants