ibex_bluesky_core.plans.reflectometry

Plans specific to Reflectometry beamlines.

Members

refl_adaptive_scan

Perform an adaptive scan over a reflectometry parameter.

refl_scan

Scan over a reflectometry parameter.

class ibex_bluesky_core.plans.reflectometry.DetMapAlignResult[source]

Bases: TypedDict

Result from mapping alignment plan.

Keys:
height_fit:

An lmfit ModelResult object describing the height fit, if the fit succeeded, or None otherwise.

angle_fit:

An lmfit ModelResult object describing the angle fit, if the fit succeeded, or None otherwise.

ibex_bluesky_core.plans.reflectometry.angle_scan_plan(dae: SimpleDae[PeriodPerPointController, Waiter, PeriodSpecIntegralsReducer], *, angle_map: ndarray[tuple[int, ...], dtype[float64]]) Generator[Msg, None, ModelResult | None][source]

Reflectometry detector-mapping angle alignment plan.

This plan does not move any axes, but takes a single DAE measurement at the current position. It processes this single DAE measurement to produce an angle scan, mapping the detector intensity against angular pixel position.

Parameters:
  • dae – The DAE to acquire from

  • angle_map – a numpy array, with the same shape as detectors, describing the detector angle of each detector pixel

ibex_bluesky_core.plans.reflectometry.height_and_angle_scan_plan(dae: SimpleDae[PeriodPerPointController, Waiter, PeriodSpecIntegralsReducer], height: NamedMovable[float], start: float, stop: float, *, num: int, angle_map: ndarray[tuple[int, ...], dtype[float64]], rel: bool = False) Generator[Msg, None, DetMapAlignResult][source]

Reflectometry detector-mapping simultaneous height & angle alignment plan.

This plan does a step scan over the specified height axis, taking num measurements from the DAE, evenly spaced between start and stop.

Parameters:
  • dae – The DAE to acquire from

  • height – A bluesky Movable corresponding to a height stage

  • start – start point for scan

  • stop – stop point for scan

  • num – how many points to measure

  • angle_map – a numpy array, with the same shape as detectors, describing the detector angle of each detector pixel

  • rel – whether this scan should be absolute (default) or relative

Returns:

A dictionary containing the fit results from gaussian height and angle fits.

ibex_bluesky_core.plans.reflectometry.optimise_axis_against_intensity(dae: SimpleDae, alignment_param: NamedMovable[float], fit_method: FitMethod, fit_param: str, rel_scan_ranges: list[float], *, num_points: int = 10, periods: bool = True, save_run: bool = True, problem_found_plan: Callable[[], Generator[Msg, None, None]] | None = None, is_good_fit: Callable[[ModelResult, float], str | None] | None = None) Generator[Msg, None, ISISCallbacks | None][source]

Optimise a motor/device to the intensity of the beam.

Scan between two symmetrical points relative to alignment_param’s current motor position, to find where the optimal point is depending on fit_param, and move to it, then optionally repeat the process for a smaller range and higher granularity.

Note

This plan does not redefine the position of the movable as zero - that should be done in caller plans

Parameters:
  • dae (SimpleDae) – A readable signal that represents beam intensity.

  • alignment_param (AlignmentParam) – The alignment parameter to be scanned over and optimised.

  • fit_method (FitMethod) – The relationship to expect between the alignment parameter and the beam. e.g Gaussian.

  • fit_param (str) – Which property of fit_method you aim to optimise. e.g centre (x0) of a Gaussian. See fitting/fitting_utils for the possible options for each fitting method.

  • rel_scan_ranges (list[float]) – Scan range relative to the current motor position. If the list has more than one element then it will rescan for each range. Scans between mot_pos - rel_scan_range / 2 -> mot_pos + rel_scan_range / 2

  • num_points (int) – The number of points across the scan. Defaults to 10.

  • periods (bool) – Are DAE periods being used. Defaults to True.

  • save_run (bool) – Should runs be saved. Defaults to True.

  • problem_found_plan (Callable[[], Generator[Msg, None, None]] | None) – A plan, called if optimised value is not found to be sensible.

  • is_good_fit (Callable[[ModelResult, float], bool] | None) – User provided checks on the optimised value, must return True if result is sensible.

Returns:

Instance of ibex_bluesky_core.callbacks.ISISCallbacks.

ibex_bluesky_core.plans.reflectometry.refl_adaptive_scan(param: str, start: float, stop: float, min_step: float, max_step: float, target_delta: float, *, frames: int, det: int, mon: int, model: FitMethod | None = None, pixel_range: int = 0, periods: bool = True, save_run: bool = False, rel: bool = False) Generator[Msg, None, ISISCallbacks][source]

Perform an adaptive scan over a reflectometry parameter.

This is really just a wrapper around ibex_bluesky_core.plans.adaptive_scan()

Parameters:
  • param – The parameter to scan.

  • start – The initial setpoint.

  • stop – The final setpoint.

  • min_step – the minimum step size to plot

  • max_step – the maximum step size to plot

  • target_delta – desired fractional change in detector signal between steps

  • frames – the number of frames to wait for.

  • det – the detector spectra to use.

  • mon – the monitor spectra to use.

  • pixel_range – the range of pixels to scan over, using det as a centred pixel.

  • model – the fit method to use.

  • periods – whether to use periods.

  • save_run – whether to save the run of the scan.

  • rel – whether to use a relative scan around the current position.

Returns:

an ibex_bluesky_core.callbacks.ISISCallbacks instance.

ibex_bluesky_core.plans.reflectometry.refl_scan(param: str, start: float, stop: float, num: int, *, frames: int, det: int, mon: int, model: FitMethod | None = None, pixel_range: int = 0, periods: bool = True, save_run: bool = False, rel: bool = False) Generator[Msg, None, ISISCallbacks][source]

Scan over a reflectometry parameter.

This is really just a wrapper around ibex_bluesky_core.plans.scan()

Parameters:
  • param – the reflectometry parameter.

  • start – the starting setpoint of the parameter.

  • stop – the final setpoint of the parameter.

  • num – the number of points to scan.

  • frames – the number of frames to wait for.

  • det – the detector spectra to use.

  • mon – the monitor spectra to use.

  • pixel_range – the range of pixels to scan over, using det as a centred pixel.

  • model – the model to use.

  • periods – whether to use periods.

  • save_run – whether to save the run of the scan.

  • rel – whether to use a relative scan around the current position.

Returns:

an ibex_bluesky_core.callbacks.ISISCallbacks instance.