-
Notifications
You must be signed in to change notification settings - Fork 5
Initial VMXm FGS plan #942
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main DiamondLightSource/hyperion#942 +/- ##
==========================================
- Coverage 93.32% 90.38% -2.94%
==========================================
Files 54 55 +1
Lines 2591 2747 +156
==========================================
+ Hits 2418 2483 +65
- Misses 173 264 +91 ☔ View full report in Codecov by Sentry. |
@@ -92,7 +92,7 @@ if [[ $START == 1 ]]; then | |||
exit 1 | |||
fi | |||
|
|||
ISPYB_CONFIG_PATH="/dls_sw/dasc/mariadb/credentials/ispyb-artemis-${BEAMLINE}.cfg" | |||
ISPYB_CONFIG_PATH="/dls_sw/dasc/mariadb/credentials/ispyb-artemis-i03.cfg" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need input from ispyb team to fix?
src/hyperion/external_interaction/callbacks/xray_centre/callback_collection.py
Outdated
Show resolved
Hide resolved
src/hyperion/external_interaction/callbacks/xray_centre/nexus_callback.py
Outdated
Show resolved
Hide resolved
992927a
to
9072827
Compare
9072827
to
a27463b
Compare
eiger_params = EigerDetector( | ||
"Eiger 16M", (detector_pixels.height, detector_pixels.width), "Si", 46051, 0 | ||
"Eiger 9M", (detector_pixels.height, detector_pixels.width), "CdTe", 2418770, 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely needs fixing before merge - this would break i03 if merged as-is
# FIXME - HACK - plans commented out here because VMXm complains about no | ||
# aperture_scatterguard which is needed for some plans. | ||
# Need a way to either mark plans as being relevant only on some beamlines, or | ||
# generally allow hyperion to *start* even if some plans reference nonexistent | ||
# devices (and then fail at runtime if that plan is actually used). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per code comment - definitely needs fixing before merge.
@@ -32,7 +32,7 @@ def deploy(self, url): | |||
deploy_repo.git.checkout(self.latest_version_str) | |||
|
|||
print("Setting permissions") | |||
groups_to_give_permission = ["i03_staff", "gda2", "dls_dasc"] | |||
groups_to_give_permission = ["i02-1_staff", "gda2", "dls_dasc"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix this before merge. But don't just add vmxm/i03 to the list as that would give i03 permissions on vmxm and vice-versa.
Probably f"{beamline}_staff"
would work, check that group exists for all supported beamlines.
elif args.beamline == "i03": | ||
return f"/dls_sw/{args.beamline}/software/bluesky" | ||
elif args.beamline == "i02-1": | ||
return f"/dls_sw/{args.beamline}/software/bluesky" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this, it doesn't do anything, it's obsolete.
@@ -0,0 +1,225 @@ | |||
from __future__ import annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this whole file: there's obviously a lot of duplication, but also a lot of instrument-specific functionality.
Probably spin out an issue to come up with the right set of abstractions.
Also probably shouldn't be called _xray_centre_plan
on VMXm, as it doesn't actually do xray centring at all - it does real data collections! So just vmxm_fast_grid_scan
maybe. Will also need updating in GDA if changed.
self.params.hyperion_params.ispyb_params.undulator_gap = doc["data"].get( | ||
"undulator_gap", 0.0 | ||
) | ||
self.params.hyperion_params.ispyb_params.synchrotron_mode = doc["data"].get( | ||
"synchrotron_machine_status_synchrotron_mode", None | ||
) | ||
self.params.hyperion_params.ispyb_params.slit_gap_size_x = doc["data"].get( | ||
"s4_slit_gaps_xgap", 0.0 | ||
) | ||
self.params.hyperion_params.ispyb_params.slit_gap_size_y = doc["data"].get( | ||
"s4_slit_gaps_ygap", 0.0 | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think write an issue in hyperion to think harder about this.
Conceptually, I don't think the ispyb_callback
class should "know" about instrument-specific things like s4_slits
, which either don't exist or don't make sense for other beamlines. I think it should be getting this list of parameters from some beamline-specific configuration or parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in the short term, I think this will work for both i03 and VMXm - even if it will end up putting nonsense values into VMXm's ispyb entries.
Cast to a list to pass it to Bluesky.preprocessors.subs_decorator().""" | ||
Cast to a list to pass it to Bluesky.preprocessors.subs_decorator(). | ||
|
||
Note: specific to i03.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have this kind of comment (or an equivalent naming standard) throughout hyperion so that we can easily tell what is beamline specific, and what is being kept generic.
Maybe create an issue to come up with this standard and then retroactively apply it where we know there is instrument-specific code.
|
||
nexus_handler: GridscanNexusFileCallback | ||
ispyb_handler: GridscanISPyBCallback | ||
zocalo_handler: XrayCentreZocaloCallback | ||
|
||
@classmethod | ||
def from_params(cls, parameters: InternalParameters): | ||
nexus_handler = GridscanNexusFileCallback() | ||
nexus_handler = GridscanNexusFileCallback(create_i03_goniometer_axes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still feels like we should be passing this from "higher up" the call chain. But probably fine for now. Possibly create an issue to think about where this comes from.
|
||
|
||
class Gridscan2DNexusFileCallback(CallbackBase): | ||
"""Similar to above, but for a 2D gridscan""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the duplication with the class above shouldn't block merging in the short term, but let's write an issue to improve this in the longer term.
chi: float = 0, | ||
phi: float = 0, | ||
) -> Goniometer: | ||
"""Returns a Nexgen 'Goniometer' object with the dependency chain of I03's Smargon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Returns a Nexgen 'Goniometer' object with the dependency chain of I03's Smargon | |
"""Returns a Nexgen 'Goniometer' object with the dependency chain of VMXm's axes |
Comment is obviously wrong!
LOGGER.info("Creating ispyb entry.") | ||
self.ispyb_ids = self.ispyb.begin_deposition() | ||
LOGGER.info(f"Recieved ISPYB IDs: {self.ispyb_ids}") | ||
LOGGER.info("Creating ispyb entry.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this part is no longer within the if statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I recall correctly, VMXm only uses the READ_HARDWARE
plan so they need to create the ispyb entry on that event - otherwise they won't get an entry at all. For i03
, we need to check whether this is right.
It feels like a bit of a hack anyway to have this ispyb stuff listening on a specific type of message - but I think David or Dom have been doing some work to pull the ispyb interactions into an ophyd device? If that's the case then this may go away.
|
||
|
||
@dataclass(frozen=True, order=True) | ||
class VmxmFastGridScanCallbackCollection(AbstractPlanCallbackCollection): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this would be nicer if it was called something like FastGridScanNoZocaloCallBackCollection
, and then has the goniometer axes creation as a parameter? Then it isn't specific to VMXm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment of the equivalent bit of code for i03
:
Still feels like we should be passing this from "higher up" the call chain. But probably fine for now. Possibly create an issue to think about where this comes from.
So yes I agree with you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't put too much effort into this though, because I think David (or Dom?) is looking at pulling all or most of these callbacks into ophyd devices which would then make this obsolete anyway.
Things we need to change before we merge: (You wrote all this stuff in the comments anyway, this is mainly for me)
Other things which aren't as urgent but we should still do at some point:
|
First pass at a FGS plan for VMXm - to test and refine on the beamline.
Based largely on existing FGS plan with references to the following devices removed:
ap_sg
flux
s4_slits
undulator
xbpm
Attenuator
replaced withVmxmAttenuator
Nothing has been done about either shutter - understand that the fast shutter is being controlled by motion program, and that slow shutter can be controlled by GDA prior to calling into hyperion? This assumption might be wrong, check it on the beamline.
Needs DiamondLightSource/dodal#211