ibex_bluesky_core.devices.polarisingdae

An interface to the DAE for bluesky, suited for polarisation.

Members

DualRunDae

DAE with strategies for data collection, waiting, and reduction, suited for polarisation.

polarising_dae

Create a Polarising DAE which uses wavelength binning and calculates polarisation.

class ibex_bluesky_core.devices.polarisingdae.DualRunDae(*, prefix: str, name: str = 'DAE', controller: TController_co, waiter: TWaiter_co, reducer_final: TPReducer_co, reducer_up: TMWBReducer_co, reducer_down: TMWBReducer_co, movable: Movable[float], movable_states: list[float])[source]

Bases: Dae, Triggerable, AsyncStageable, Generic[TController_co, TWaiter_co, TPReducer_co, TMWBReducer_co]

DAE with strategies for data collection, waiting, and reduction, suited for polarisation.

This class is a more complex version of SimpleDae. It requires a flipper device to be provided and will perform two runs, changing the flipper device at the start and inbetween runs.

Initialise a DualRunDae.

Parameters:
  • prefix – the PV prefix of the instrument being controlled.

  • name – A friendly name for this DAE object.

  • controller – A DAE control strategy, defines how the DAE begins and ends data acquisition Pre-defined strategies in the ibex_bluesky_core.devices.controllers module

  • waiter – A waiting strategy, defines how the DAE waits for an acquisition to be complete Pre-defined strategies in the ibex_bluesky_core.devices.waiters module

  • reducer_final – A data reduction strategy. It will be triggered once after the two runs.

  • reducer_up – A data reduction strategy. Triggers once after the first run completes.

  • reducer_down – A data reduction strategy. Triggers once after the second run completes.

  • movable – A device which will be changed at the start of the first run and between runs.

  • movable_states – A tuple of two floats, the states to set at the start and between runs.

stage() None[source]

Pre-scan setup. Delegate to the controller.

trigger() None[source]

Take a single measurement and prepare it for later reading.

This waits for the acquisition and any defined reduction to be complete, such that after this coroutine completes, all relevant data is available via read()

unstage() None[source]

Post-scan teardown, delegate to the controller.

class ibex_bluesky_core.devices.polarisingdae.MultiWavelengthBandNormalizer(prefix: str, detector_spectra: Sequence[int], monitor_spectra: Sequence[int], sum_wavelength_bands: list[Callable[[Collection[DaeSpectra]], Awaitable[Variable | DataArray]]])[source]

Bases: Reducer, StandardReadable

Sum a set of wavelength-bounded spectra, then normalise by monitor intensity.

Init.

Parameters:
  • prefix – the PV prefix of the instrument to get spectra from (e.g. IN:DEMO:)

  • detector_spectra – a sequence of spectra numbers (detectors) to sum.

  • monitor_spectra – a sequence of spectra numbers (monitors) to sum.

  • sum_wavelength_bands – takes a sequence of summing functions, each of which takes spectra objects and returns a scipp scalar describing the detector intensity.

additional_readable_signals(dae: Dae) list[Device][source]

Publish interesting signals derived or used by this reducer.

async reduce_data(dae: Dae) None[source]

Apply the normalisation.

class ibex_bluesky_core.devices.polarisingdae.PolarisationReducer(intervals: list[Variable], reducer_up: MultiWavelengthBandNormalizer, reducer_down: MultiWavelengthBandNormalizer)[source]

Bases: Reducer, StandardReadable

Calculate polarisation from ‘spin-up’ and ‘spin-down’ states of a polarising DAE.

Init.

Parameters:
  • intervals – a sequence of scipp describing the wavelength intervals over which to calculate polarisation.

  • reducer_up – A data reduction strategy, defines the post-processing on raw DAE data. Used to retrieve intensity values from the up-spin state.

  • reducer_down – A data reduction strategy, defines the post-processing on raw DAE data. Used to retrieve intensity values from the down-spin state.

additional_readable_signals(dae: Dae) list[Device][source]

Publish interesting signals derived or used by this reducer.

async reduce_data(dae: Dae) None[source]

Apply the polarisation.

ibex_bluesky_core.devices.polarisingdae.polarising_dae(*, det_pixels: list[int], frames: int, movable: Movable[float], movable_states: list[float], intervals: list[Variable], total_flight_path_length: Variable, periods: bool = True, monitor: int = 1, save_run: bool = False) DualRunDae[Controller, Waiter, PolarisationReducer, MultiWavelengthBandNormalizer][source]

Create a Polarising DAE which uses wavelength binning and calculates polarisation.

This is a different version of monitor_normalising_dae, with a more complex set of strategies. While already normalising using a monitor and waiting for frames, it requires a movable device to be provided and will change the movable between two neutron states between runs. It uses wavelength-bounded binning, and on completion of the two runs will calculate polarisation.

Parameters:
  • det_pixels – list of detector pixel to use for scanning.

  • frames – number of frames to wait for.

  • movable – A device which can be used to change the neutron state between runs.

  • movable_states – A tuple of two floats, the neutron states to be set between runs.

  • intervals – list of wavelength intervals to use for binning.

  • total_flight_path_length – total flight path length of the neutron beam from monitor to detector.

  • periods – whether or not to use software periods.

  • monitor – the monitor spectra number.

  • save_run – whether or not to save the run of the DAE.