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

Rotation scan improvements from testing#915

Merged
DominicOram merged 33 commits into
mainfrom
905_851_rotation_scan_improvements
Oct 23, 2023
Merged

Rotation scan improvements from testing#915
DominicOram merged 33 commits into
mainfrom
905_851_rotation_scan_improvements

Conversation

@d-perl

@d-perl d-perl commented Oct 3, 2023

Copy link
Copy Markdown
Contributor

Fixes #905 and fixes #851

Mostly changes made on the beamline as part of testing, of which most are ISPyB deposition fixes and one hack of OAV snapshot paths - issue to fix here (DiamondLightSource/mx-bluesky#328)

Also includes no longer adding wavelength as external parameter and instead calculating it from energy as I didn't want to find it in GDA to send...

To test:

  1. Run tests

@d-perl
d-perl requested a review from DominicOram October 3, 2023 16:35
@codecov

codecov Bot commented Oct 3, 2023

Copy link
Copy Markdown

Codecov Report

Merging #915 (a19eba6) into main (892f52b) will increase coverage by 0.22%.
Report is 2 commits behind head on main.
The diff coverage is 97.56%.

@@            Coverage Diff             @@
##             main     DiamondLightSource/hyperion#915      +/-   ##
==========================================
+ Coverage   93.32%   93.55%   +0.22%     
==========================================
  Files          53       54       +1     
  Lines        2562     2590      +28     
==========================================
+ Hits         2391     2423      +32     
+ Misses        171      167       -4     
Files Coverage Δ
src/hyperion/device_setup_plans/check_topup.py 92.68% <ø> (ø)
...erion/experiment_plans/flyscan_xray_centre_plan.py 92.05% <100.00%> (+0.05%) ⬆️
...ernal_interaction/callbacks/ispyb_callback_base.py 92.45% <100.00%> (+0.14%) ⬆️
..._interaction/callbacks/rotation/zocalo_callback.py 100.00% <100.00%> (ø)
...rion/external_interaction/ispyb/ispyb_dataclass.py 100.00% <100.00%> (ø)
...erion/external_interaction/ispyb/store_in_ispyb.py 97.28% <100.00%> (+0.04%) ⬆️
...hyperion/external_interaction/nexus/nexus_utils.py 100.00% <ø> (ø)
...hyperion/external_interaction/nexus/write_nexus.py 100.00% <100.00%> (ø)
src/hyperion/log.py 100.00% <100.00%> (ø)
src/hyperion/utils/utils.py 100.00% <100.00%> (ø)
... and 1 more

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@DominicOram DominicOram left a comment

Copy link
Copy Markdown
Collaborator

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. But otherwise works well

# TODO: Check topup gate
hyperion.log.LOGGER.info("Setting fgs params")
yield from set_flyscan_params(fgs_motors, parameters.experiment_params)
hyperion.log.LOGGER.info("Set params")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should: I think this log is overkill

def append_to_comment(self, comment: str):
self._append_to_comment(self.ispyb_ids[0], comment)

def start(self, doc: dict):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should: I think a test on this would be good

def start(self, doc: dict):
LOGGER.info("Zocalo handler received start document.")
if doc.get("subplan_name") == "rotation_scan_main":
if self.run_uid is None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Must: This is all about making sure the isypb deposition happens before zocalo triggers, right? I think we need a very explicit test that confirms this, otherwise we'll end up accidentally hitting it again

Comment on lines +37 to +118
# All MX collection fields:
# [
# "id",
# "parentid",
# "visitid",
# "sampleid",
# "detectorid",
# "positionid",
# "apertureid",
# "datacollectionnumber",
# "starttime",
# "endtime",
# "runstatus",
# "axisstart",
# "axisend",
# "axisrange",
# "overlap",
# "nimages",
# "startimagenumber",
# "npasses",
# "exptime",
# "imgdir",
# "imgprefix",
# "imgsuffix",
# "imgcontainersubpath",
# "filetemplate",
# "wavelength",
# "resolution",
# "detectordistance",
# "xbeam",
# "ybeam",
# "comments",
# "slitgapvertical",
# "slitgaphorizontal",
# "transmission",
# "synchrotronmode",
# "xtalsnapshot1",
# "xtalsnapshot2",
# "xtalsnapshot3",
# "xtalsnapshot4",
# "rotationaxis",
# "phistart",
# "kappastart",
# "omegastart",
# "resolutionatcorner",
# "detector2theta",
# "undulatorgap1",
# "undulatorgap2",
# "undulatorgap3",
# "beamsizeatsamplex",
# "beamsizeatsampley",
# "avgtemperature",
# "actualcenteringposition",
# "beamshape",
# "focalspotsizeatsamplex",
# "focalspotsizeatsampley",
# "polarisation",
# "flux",
# "processeddatafile",
# "datfile",
# "magnification",
# "totalabsorbeddose",
# "binning",
# "particlediameter",
# "boxsizectf",
# "minresolution",
# "mindefocus",
# "maxdefocus",
# "defocusstepsize",
# "amountastigmatism",
# "extractsize",
# "bgradius",
# "voltage",
# "objaperture",
# "c1aperture",
# "c2aperture",
# "c3aperture",
# "c1lens",
# "c2lens",
# "c3lens",
# ]
#

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Must: Remove this please

Comment thread src/hyperion/unit_tests/test_utils.py Outdated
Comment on lines +9 to +20
def test_ev_to_a_converter():
for i in range(len(test_energies)):
assert convert_eV_to_angstrom(test_energies[i]) == pytest.approx(
test_wavelengths[i]
)


def test_a_to_ev_converter():
for i in range(len(test_wavelengths)):
assert convert_angstrom_to_eV(test_wavelengths[i]) == pytest.approx(
test_energies[i]
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: It's nicer to use paramterize as it's more obvious which one has failed if only one has

@d-perl
d-perl requested a review from DominicOram October 23, 2023 15:51

@DominicOram DominicOram left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great, thank you!

@DominicOram
DominicOram merged commit db72199 into main Oct 23, 2023
@DominicOram
DominicOram deleted the 905_851_rotation_scan_improvements branch October 23, 2023 16:12
@DominicOram DominicOram changed the title 905 851 rotation scan improvements Rotation scan improvements from testing Oct 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issues identified during rotation scan testing Don't use both wavelength and energy

2 participants