ibex_bluesky_core.utils
Utilities for plans which are not plan stubs.
Members
Abstract class for type checking that an object is readable, named and movable. |
|
Calculate polarisation value and propagate uncertainties. |
|
Given a centre and range, return a contiguous range of pixels around the centre, inclusive. |
|
Return the PV prefix for the current instrument. |
|
Return True if matplotlib is using a qt backend. |
- class ibex_bluesky_core.utils.NamedReadableAndMovable(*args, **kwargs)[source]
Bases:
Readable
[Any
],NamedMovable
[Any
],Protocol
Abstract class for type checking that an object is readable, named and movable.
- ibex_bluesky_core.utils.calculate_polarisation(a: Variable | DataArray, b: Variable | DataArray) Variable | DataArray [source]
Calculate polarisation value and propagate uncertainties.
This function computes the polarisation given by the formula (a-b)/(a+b) and propagates the uncertainties associated with a and b.
On SANS instruments e.g. LARMOR, A and B correspond to intensity in different DAE periods (before/after switching a flipper) and the output is interpreted as a neutron polarisation ratio.
On reflectometry instruments e.g. POLREF, the situation is the same as on LARMOR.
On muon instruments, A and B correspond to measuring from forward/backward detector banks, and the output is interpreted as a muon asymmetry.
- ibex_bluesky_core.utils.centred_pixel(centre: int, pixel_range: int) list[int] [source]
Given a centre and range, return a contiguous range of pixels around the centre, inclusive.
ie. a centre of 50 with a range of 3 will give [47, 48, 49, 50, 51, 52, 53]
- Parameters:
Returns a list of pixel numbers.