ibex_bluesky_core.callbacks

Bluesky callbacks which may be attached to the RunEngine.

Submodules

document_logger

Logs all documents that the BlueSky run engine creates via a callback.

file_logger

Creates a readable .txt file of Bluesky runengine dataset.

fitting

For IBEX Bluesky scan fitting.

plotting

IBEX plotting callbacks.

Members

ISISCallbacks

ISIS standard callbacks for use within plans.

class ibex_bluesky_core.callbacks.ISISCallbacks(*, x: str, y: str, yerr: str | None = None, measured_fields: list[str] | None = None, add_table_cb: bool = True, fields_for_live_table: list[str] | None = None, add_human_readable_file_cb: bool = True, fields_for_hr_file: list[str] | None = None, human_readable_file_output_dir: str | PathLike[str] | None = None, add_plot_cb: bool = True, ax: Axes | None = None, fit: FitMethod | None = None, show_fit_on_plot: bool = True, add_peak_stats: bool = True, add_live_fit_logger: bool = True, live_fit_logger_output_dir: str | PathLike[str] | None = None, live_fit_logger_postfix: str = 'isc')[source]

Bases: object

ISIS standard callbacks for use within plans.

A collection of ISIS standard callbacks for use within plans.

By default, this adds:

  • HumanReadableFileCallback

  • LiveTable

  • PeakStats

  • LiveFit

  • LiveFitPlot

  • LivePlot

Results can be accessed from the live_fit and peak_stats properties.

This is to be used as a member and then as a decorator if results are needed ie:

def dae_scan_plan():
    ...
    icc = ISISCallbacks(
        x=block.name,
        y=reducer.intensity.name,
        yerr=reducer.intensity_stddev.name,
        fit=Linear.fit(),
        ...
    )
    ...

    @icc
    def _inner():
        yield from ...
        ...
        print(icc.live_fit.result.fit_report())
        print(f"COM: {icc.peak_stats['com']}")
Parameters:
  • x – The signal name to use for X within plots and fits.

  • y – The signal name to use for Y within plots and fits.

  • yerr – The signal name to use for the Y uncertainty within plots and fits.

  • measured_fields – the fields to use for both the live table and human-readable file.

  • add_table_cb – whether to add a table callback.

  • fields_for_live_table – the fields to measure for the live table (in addition to measured_fields).

  • add_human_readable_file_cb – whether to add a human-readable file callback.

  • fields_for_hr_file – the fields to measure for the human-readable file (in addition to measured_fields).

  • human_readable_file_output_dir – the output directory for human-readable files. can be blank and will default.

  • add_plot_cb – whether to add a plot callback.

  • ax – An optional axes object to use for plotting.

  • fit – The fit method to use when fitting.

  • show_fit_on_plot – whether to show fit on plot.

  • add_peak_stats – whether to add a peak stats callback.

  • add_live_fit_logger – whether to add a live fit logger.

  • live_fit_logger_output_dir – the output directory for live fit logger.

  • live_fit_logger_postfix – the postfix to add to live fit logger.

property live_fit: LiveFit

The live fit object containing fitting results.

property peak_stats: PeakStats

The peak stats object containing statistics ie. centre of mass.

property subs: list[CallbackBase]

The list of subscribed callbacks.