Skip to content

Commit

Permalink
Merge branch 'main' into 684_serial-detector-params
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Jan 8, 2025
2 parents 1d70d06 + 35a64a2 commit 09c45e7
Show file tree
Hide file tree
Showing 141 changed files with 2,141 additions and 1,526 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@e6ad77ee5aa489d0035918e45a28a0d6f72b19ed",
]


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 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
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from bluesky.callbacks import CallbackBase
from event_model.documents.run_start import RunStart

from mx_bluesky.hyperion.log import LOGGER
from mx_bluesky.common.utils.log import LOGGER

from .logging_callback import format_doc_for_log

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,28 @@
from dodal.devices.oav.utils import calculate_x_y_z_of_pixel
from event_model.documents import Event

from mx_bluesky.hyperion.log import LOGGER
from mx_bluesky.common.utils.log import LOGGER


class GridParamUpdate(TypedDict):
"""
Grid parameters extracted from the grid detection.
Positions are in motor-space.
Attributes:
x_start_um: x position of the centre of the first xy-gridscan box in microns
y_start_um: y position of the centre of the first xy-gridscan box in microns
y2_start_um: y position of the centre of the first xz-gridscan box in microns
z_start_um: z position of the centre of the first xy-gridscan box in microns
z2_start_um: z position of the centre of the first xz-gridscan box in microns
x_steps: Number of grid boxes in x-direction for xy- and xz- gridscans
y_steps: Number of grid boxes in y-direction for xy-gridscan
z_steps: Number of grid boxes in z-direction for xz-gridscan
x_step_size_um: x-dimension of the grid box
y_step_size_um: y-dimension of the grid box
z_step_size_um: z-dimension of the grid box
"""

x_start_um: float
y_start_um: float
y2_start_um: float
Expand Down
Loading

0 comments on commit 09c45e7

Please sign in to comment.