ibex_bluesky_core.devices.reflectometry

Reflectometry-specific bluesky devices and utilities.

Members

AngleMappingReducer

Angle-mapping reducer describing parameters of beam on a 1-D angular detector.

ReflParameter

Reflectometry server parameter.

ReflParameterRedefine

Reflectometry server parameter redefinition.

refl_parameter

Small wrapper around a reflectometry parameter device.

class ibex_bluesky_core.devices.reflectometry.AngleMappingReducer(*, detectors: ndarray[tuple[Any, ...], dtype[int32]], angle_map: ndarray[tuple[Any, ...], dtype[float64]], flood: Variable | None = None)[source]

Bases: Reducer, StandardReadable

Angle-mapping reducer describing parameters of beam on a 1-D angular detector.

This Reducer fits the counts on each pixel of a detector, against the relative angular positions of those pixels. It then exposes fitted quantities, and their standard deviations, as signals from this reducer.

The fitting model used is a Gaussian. Uncertainties from the counts data are taken into account on these fits - the variances are set to counts + 0.5 (see ADR5 for justification).

Optionally, a flood map can be provided to normalise for pixel efficiencies before fitting. This flood map is provided as a scipp.Variable, which means that it may contain variances.

Warning

The uncertainties (signals ending in _err) from this reducer are obtained from lmfit. The exact method is described in lmfit’s MinimizerResult documentation. For a perfect fit, which might result from fitting a limited number of points or flat data, uncertainties may be zero.

Because the uncertainties may be zero, using them in an ‘outer’ fit is discouraged; an uncertainty of zero implies infinite weighting, which will likely cause the outer fit to fail to converge.

Parameters:
  • detectors – numpy array of detector spectra to include.

  • angle_map – numpy array of relative pixel angles for each selected detector

  • flood – Optional scipp.Variable describing a flood-correction. This array should be aligned along a “spectrum” dimension; counts are divided by this array before being used in fits. This is used to normalise the intensities detected by each detector pixel.

amp

Amplitude of fitted Gaussian

amp_err

Amplitude standard deviation of fitted Gaussian.

This is the standard error reported by lmfit.model.Model.fit.

background

Background of fitted Gaussian

background_err

Background standard deviation of fitted Gaussian.

This is the standard error reported by lmfit.model.Model.fit.

r_squared

R-squared (goodness of fit) parameter reported by lmfit.model.Model.fit.

sigma

Width (sigma) of fitted Gaussian

sigma_err

Width (sigma) standard deviation of fitted Gaussian.

This is the standard error reported by lmfit.model.Model.fit.

x0

Centre (x0) of fitted Gaussian

x0_err

Centre (x0) standard deviation of fitted Gaussian.

This is the standard error reported by lmfit.model.Model.fit.

class ibex_bluesky_core.devices.reflectometry.ReflParameter(prefix: str, name: str, changing_timeout_s: float, *, has_redefine: bool = True)[source]

Bases: StandardReadable, NamedMovable[float]

Reflectometry server parameter.

Parameters:
  • prefix – the PV prefix.

  • name – the name of the parameter.

  • changing_timeout_s – seconds to wait for the CHANGING signal to go to False after a set.

  • has_redefine – whether this parameter can be redefined.

changing: SignalR[bool]

Whether this parameter is currently changing.

readback: SignalR[float]

Readback value. This is the hinted parameter for this class.

redefine: ReflParameterRedefine | None

Signal for redefining this parameter.

Will be None if this parameter was constructed with has_redefine=False.

set(value: float) None[source]

Set the setpoint.

This waits for the ReflParameter.changing signal to go False to indicate it has finished.

setpoint: SignalW[float]

Reflectometry parameter setpoint signal.

class ibex_bluesky_core.devices.reflectometry.ReflParameterRedefine(prefix: str, name: str)[source]

Bases: StandardReadable

Reflectometry server parameter redefinition.

Parameters:
  • prefix – the reflectometry parameter full address.

  • name – the name of the parameter redefinition.

set(value: float) None[source]

Set the setpoint.

This redefines the position of a reflectometry parameter as the given value, and waits for the reflectometry parameter redefinition’s ‘CHANGED’ PV to go True to indicate it has finished redefining the position.

ibex_bluesky_core.devices.reflectometry.refl_parameter(name: str, changing_timeout_s: float = 60.0, has_redefine: bool = True) ReflParameter[source]

Small wrapper around a reflectometry parameter device.

This automatically applies the current instrument’s PV prefix.

Parameters:
  • name – the reflectometry parameter name.

  • changing_timeout_s – time to wait (seconds) for the CHANGING signal to go False after a set.

  • has_redefine – whether this parameter can be redefined.

Returns a device pointing to a reflectometry parameter.