Skip to content

Commit

Permalink
Merge branch '684_serial-detector-params' into 151_work-on-i24-gui
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Jan 10, 2025
2 parents fb109c2 + 0c2e164 commit 4c617bd
Show file tree
Hide file tree
Showing 153 changed files with 2,792 additions and 1,924 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,6 @@ edm_serial/
**/parameters/fixed_target/*/*.map
# idea project files
.idea/

# Generated PlantUML diagrams
docs/developer/hyperion/reference/param_hierarchy.puml
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
"sphinx_design",
# For markdown
"myst_parser",
# For plantUML diagrams
"plantweb.directive",
]

myst_enable_extensions = [
Expand Down
109 changes: 109 additions & 0 deletions docs/developer/hyperion/reference/gridscan.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
@startuml
title Gridscan Parameter Relationships

class DiffractionExperiment
class DiffractionExperimentWithSample
class GridCommon {
grid_width_um
exposure_time_s
}
class GridScanWithEdgeDetect {
box_size_um
}
class HyperionGridCommon {
enable_dev_shm
}
class HyperionThreeDGridScan {
x_step_size_um
y_step_size_um
z_step_size_um
y2_start_um
z2_start_um
--
grid_1_spec
grid_2_spec
scan_indices
scan_spec
scan_points
scan_points_first_grid
scan_points_second_grid
num_images
FGS_Params
panda_FGS_Params
}
class MxBlueSkyParameters
class SpecifiedGrid
class XyzStarts {
x_start_um
y_start_um
z_start_um
}
class OptionalXYZStarts {
x_start_um
y_start_um
z_start_um
}
class RotationScanPerSweep

MxBlueSkyParameters <|-- DiffractionExperiment
DiffractionExperiment <|-- DiffractionExperimentWithSample
DiffractionExperimentWithSample <|-- GridCommon
GridCommon <|-- GridScanWithEdgeDetect
GridCommon <|-- HyperionGridCommon
HyperionGridCommon <|-- HyperionThreeDGridScan
SpecifiedGrid <|-- HyperionThreeDGridScan
XyzStarts <|-- SpecifiedGrid
OptionalXYZStarts <|-- RotationScanPerSweep
class GridParamUpdate {
x_start_um
y_start_um
y2_start_um
z_start_um
z2_start_um
x_steps
y_steps
z_steps
x_step_size_um
y_step_size_um
z_step_size_um
}

class GridDetectionCallback {
get_grid_parameters() -> GridParamUpdate
}

GridDetectionCallback --> GridParamUpdate : generates from event. Adds 0.5 to get box-centres
GridParamUpdate --> HyperionThreeDGridScan : combines with GridScanWithEdgeDetect

class experiment_plans {
grid_detect_then_xray_centre()
flyscan_xray_centre_no_move()
create_parameters_for_flyscan_xray_centre(GridScanWithEdgeDetect, GridParamUpdate) -> HyperionThreeDGridScan
}

class AbstractExperimentBase
class AbstractExperimentWithBeamParams
class GridScanParamsCommon {
x_steps
y_steps
z_steps
x_step_size_mm
y_step_size_mm
z_step_size_mm
x_start_mm
y1_start_mm
y2_start_mm
z1_start_mm
z2_start_mm
}
class PandAGridScanParams
class ZebraGridScanParams

AbstractExperimentBase <|-- AbstractExperimentWithBeamParams
AbstractExperimentWithBeamParams <|-- GridScanParamsCommon
GridScanParamsCommon <|-- PandAGridScanParams
GridScanParamsCommon <|-- ZebraGridScanParams

HyperionThreeDGridScan --> ZebraGridScanParams : generates
HyperionThreeDGridScan --> PandAGridScanParams : generates
@enduml
2 changes: 1 addition & 1 deletion docs/developer/hyperion/reference/param-hierarchy.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Hyperion Parameter class hierarchy
==================================

TODO: automate including the param hierarchy here
.. uml:: param_hierarchy.puml
86 changes: 0 additions & 86 deletions docs/developer/hyperion/reference/param_hierarchy.puml

This file was deleted.

7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies = [
"ophyd == 1.9.0",
"ophyd-async >= 0.8a5",
"bluesky >= 1.13.0a4",
"dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@6295feafb43acd158ed80b30f06de2bf29fe4b16",
"dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@076d23f5e2902b7775bda37d221a04557f09bd9d",
]


Expand All @@ -68,6 +68,7 @@ dev = [
"mypy",
"myst-parser",
"pipdeptree",
"plantweb",
"pre-commit",
"pydata-sphinx-theme>=0.12",
"pyright",
Expand All @@ -78,7 +79,6 @@ dev = [
"ruff",
"sphinx-autobuild",
"sphinx-copybutton",
"sphinxcontrib-plantuml",
"sphinx-design",
"tox-direct",
"tox",
Expand Down Expand Up @@ -180,6 +180,9 @@ commands =
type-checking: pyright src tests {posargs}
tests: pytest --cov=mx_bluesky --cov-report term --cov-report xml:cov.xml {posargs}
docs: sphinx-{posargs:build -EW --keep-going} -T docs build/html
commands_pre =
docs: /usr/bin/bash -c "{toxinidir}/utility_scripts/generate_plantuml.py > \
docs/developer/hyperion/reference/param_hierarchy.puml"
"""

[tool.ruff]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import bluesky.preprocessors as bpp
from bluesky.utils import MsgGenerator
from dodal.common import inject
from dodal.devices.attenuator import ReadOnlyAttenuator
from dodal.devices.attenuator.attenuator import ReadOnlyAttenuator
from dodal.devices.hutch_shutter import HutchShutter, ShutterDemand
from dodal.devices.i24.aperture import Aperture
from dodal.devices.i24.beam_center import DetectorBeamCenter
Expand All @@ -38,6 +38,7 @@
log_on_entry,
)
from mx_bluesky.beamlines.i24.serial.parameters import ExtruderParameters
from mx_bluesky.beamlines.i24.serial.parameters.constants import BEAM_CENTER_LUT_FILES
from mx_bluesky.beamlines.i24.serial.setup_beamline import Pilatus, caget, caput, pv
from mx_bluesky.beamlines.i24.serial.setup_beamline import setup_beamline as sup
from mx_bluesky.beamlines.i24.serial.setup_beamline.setup_detector import (
Expand Down Expand Up @@ -206,10 +207,14 @@ def main_extruder_plan(
dcid: DCID,
start_time: datetime,
) -> MsgGenerator:
beam_center_pixels = sup.compute_beam_center_position_from_lut(
BEAM_CENTER_LUT_FILES[parameters.detector_name],
parameters.detector_distance_mm,
parameters.detector_size_constants,
)
yield from sup.set_detector_beam_center_plan(
beam_center_device,
parameters.detector_params,
parameters.detector_distance_mm,
beam_center_pixels,
)

# Setting up the beamline
Expand Down Expand Up @@ -283,7 +288,6 @@ def main_extruder_plan(
SSX_LOGGER.info("Using Eiger detector")

SSX_LOGGER.debug(f"Creating the directory for the collection in {filepath}.")
# NOTE Directory now created by the parameter model

caput(pv.eiger_seqID, int(caget(pv.eiger_seqID)) + 1)
SSX_LOGGER.info(f"Eiger quickshot setup: filepath {filepath}")
Expand Down Expand Up @@ -490,6 +494,8 @@ def run_extruder_plan(
parameters: ExtruderParameters = yield from read_parameters(
detector_stage, attenuator
)
# Create collection directory
parameters.collection_directory.mkdir(parents=True, exist_ok=True)

beam_center_device = sup.get_beam_center_device(parameters.detector_name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import bluesky.preprocessors as bpp
from bluesky.utils import MsgGenerator
from dodal.common import inject
from dodal.devices.attenuator import ReadOnlyAttenuator
from dodal.devices.attenuator.attenuator import ReadOnlyAttenuator
from dodal.devices.hutch_shutter import HutchShutter, ShutterDemand
from dodal.devices.i24.aperture import Aperture
from dodal.devices.i24.beam_center import DetectorBeamCenter
Expand Down Expand Up @@ -38,6 +38,7 @@
)
from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER, log_on_entry
from mx_bluesky.beamlines.i24.serial.parameters import FixedTargetParameters
from mx_bluesky.beamlines.i24.serial.parameters.constants import BEAM_CENTER_LUT_FILES
from mx_bluesky.beamlines.i24.serial.setup_beamline import caget, cagetstring, caput, pv
from mx_bluesky.beamlines.i24.serial.setup_beamline import setup_beamline as sup
from mx_bluesky.beamlines.i24.serial.setup_beamline.setup_zebra_plans import (
Expand Down Expand Up @@ -410,7 +411,6 @@ def start_i24(
SSX_LOGGER.info("Using Eiger detector")

SSX_LOGGER.debug(f"Creating the directory for the collection in {filepath}.")
# NOTE Directory now created by the parameter model

SSX_LOGGER.info(f"Triggered Eiger setup: filepath {filepath}")
SSX_LOGGER.info(f"Triggered Eiger setup: filename {filename}")
Expand Down Expand Up @@ -547,10 +547,14 @@ def main_fixed_target_plan(
) -> MsgGenerator:
SSX_LOGGER.info("Running a chip collection on I24")

beam_center_pixels = sup.compute_beam_center_position_from_lut(
BEAM_CENTER_LUT_FILES[parameters.detector_name],
parameters.detector_distance_mm,
parameters.detector_size_constants,
)
yield from sup.set_detector_beam_center_plan(
beam_center_device,
parameters.detector_params,
parameters.detector_distance_mm,
beam_center_pixels,
)

SSX_LOGGER.info("Getting Program Dictionary")
Expand Down Expand Up @@ -699,6 +703,9 @@ def run_fixed_target_plan(
detector_stage, attenuator
)

# Create collection directory
parameters.collection_directory.mkdir(parents=True, exist_ok=True)

if parameters.chip_map:
upload_chip_map_to_geobrick(pmac, parameters.chip_map)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import numpy as np
from bluesky.utils import MsgGenerator
from dodal.common import inject
from dodal.devices.attenuator import ReadOnlyAttenuator
from dodal.devices.attenuator.attenuator import ReadOnlyAttenuator
from dodal.devices.i24.beamstop import Beamstop, BeamstopPositions
from dodal.devices.i24.dual_backlight import BacklightPositions, DualBacklight
from dodal.devices.i24.i24_detector_motion import DetectorMotion
Expand Down
Loading

0 comments on commit 4c617bd

Please sign in to comment.