Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Convert plans to use new parameter model #1353

Merged
merged 7 commits into from
May 16, 2024

Conversation

d-perl
Copy link
Contributor

@d-perl d-perl commented May 7, 2024

Fixes #1289, fixes #1278

Now based on main! Finishes off using the new parameters in all plans.

To test:

  1. Run tests

Copy link
Collaborator

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Thanks, a few comments but it's a bit hard to see the wood through the trees given it's based on two other PRs. Could we get those merged then rebase this?

Comment on lines -206 to -205
# XXX 1278 this effectively casts between unrelated types which doesn't have all
# attributes needed for downstream e.g. grid_width_microns
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should: Can you close #1278 as part of this PR too?

Comment on lines 175 to 177
SampleLocation(
parameters.experiment_params.sample_puck,
parameters.experiment_params.sample_pin,
params.sample_puck,
params.sample_pin,
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: This fits on one line now

params.detector_distance_mm
or (yield from bps.rd(composite.detector_motion.z.user_readback)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: I think this internal yield adds a little too much complexity, I would suggest we just find the det_distance first then call resolution

- Robot load plan now takes new params
- Robot load plan now gives new params to PinTipThenXrayCentre
- Tests & test param files updated to match
@d-perl d-perl force-pushed the 1289_finish_converting_plans_to_new_params branch from ec50d29 to 90f6c0b Compare May 14, 2024 14:11
@d-perl d-perl requested a review from DominicOram May 14, 2024 14:24
@d-perl d-perl added the needed_for_release Issues that must be complete before the next release label May 15, 2024
@d-perl d-perl requested a review from olliesilvester May 15, 2024 10:41
@d-perl d-perl force-pushed the 1289_finish_converting_plans_to_new_params branch from c74fb64 to b375995 Compare May 15, 2024 11:02
Copy link
Collaborator

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Thanks, some comments in code.

# attributes needed for downstream e.g. grid_width_microns
params_json = json.loads(parameters.json())
pin_centre_params = PinCentreThenXrayCentreInternalParameters(**params_json)
use_energy = params.demand_energy_ev or 1000 * (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: use_energy makes this sound to me like a boolean on whether you want to use the energy. energy_to_use is a little clearer?

Comment on lines 172 to 174
def pin_centre_then_xray_centre_params(self, *, energy_ev: float | None = None):
params = PinTipCentreThenXrayCentre(**self.dict())
if energy_ev is not None:
params.demand_energy_ev = energy_ev
return params
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should: As discussed, we don't need demand_energy_ev in PinTipCentreThenXrayCentre at all as the detector is already being armed with it.

@@ -0,0 +1,34 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should: This file isn't being used anyway, can we use it in a test or remove it?

Comment on lines -53 to 57
"tests/test_data/parameter_json_files/good_test_robot_load_params_no_energy.json"
"tests/test_data/new_parameter_json_files/good_test_robot_load_params_no_energy.json"
)
return RobotLoadThenCentreInternalParameters(**params)
return RobotLoadThenCentre(**params)


@pytest.fixture
def robot_load_then_centre_params():
params = raw_params_from_file(
"tests/test_data/parameter_json_files/good_test_robot_load_params.json"
"tests/test_data/new_parameter_json_files/good_test_robot_load_params.json"
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should: The old tests/test_data/parameter_json_files/good_test_robot_load_params.json and tests/test_data/parameter_json_files/good_test_robot_load_params_no_energy.json are no longer used, can we remove?

@d-perl d-perl force-pushed the 1289_finish_converting_plans_to_new_params branch from b375995 to d857fcf Compare May 15, 2024 14:46
Copy link
Collaborator

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Great, thank you

@d-perl d-perl merged commit 52d3ba5 into main May 16, 2024
6 checks passed
@d-perl d-perl deleted the 1289_finish_converting_plans_to_new_params branch May 16, 2024 08:30
olliesilvester pushed a commit to olliesilvester/mx-bluesky that referenced this pull request Aug 23, 2024
…Source/1289_finish_converting_plans_to_new_params

Convert plans to use new parameter model
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needed_for_release Issues that must be complete before the next release
Projects
None yet
2 participants