Skip to content

Controller

mosca.control.controller.PollResult

PollResult(
    finished=False,
    n_read=0,
    spectra=None,
    stats=None,
    total_triggered=None,
)

Class containing data and acquisition status of an acquisition when calling Controller.poll_acq

Parameters:

  • finished (bool, default: False ) –

    True if the acquisiton is finished (i.e: detector stopped)

  • n_read (Optional[int], default: 0 ) –

    number of data points stored in spectra and/or stats, in case the spectra / stats buffers are larger than the number of read pixels

  • spectra (Optional[ndarray], default: None ) –

    numpy array of shape (n_detectors, n_points, spectrum_size), or None if there is not available data, with n_points >= n_read.

  • stats (Optional[ndarray], default: None ) –

    numpy array of shape (n_detectors, n_points, stats_size), or None if there is not available data, with n_points >= n_read.

  • total_triggered (Optional[int], default: None ) –

    optional, total number of data points read by the detector since the beginning of the acquisition. Some controllers allow waiting for a certain number of points to be acquired on the hardware before requesting a download.

mosca.control.controller.Controller

Controller()

Base class for hardware controller.

state property

state

Current state of the controller. A State enum.

abort_acq

abort_acq()

Aborts the acquisitions.

Note

optional

apply_mosca

apply_mosca(
    acq_nb_points=None,
    acq_realtime=None,
    acq_nb_triggers=None,
    run_mode=None,
    spectrum_size=None,
    gate_mode=None,
    start_trigger=None,
    stop_trigger=None,
    block_size=None,
    resume=False,
    **kwargs
)

Pass Mosca parameters to the controller. It's up to the controller to decide what to do with those parameters and how to convert them to actual hardware settings.

detetector_channels

detetector_channels()

Used to get the channel numbers (i.e: aliases). Usually the enabled detectors.

Example

if a controller has 4 detectors:

  • all a enabled, this method should return [0, 1, 2, 3].
  • the 2nd detector is disabled, this method should return [0, 1, 3], and the poll_acq should return an array of shape [3, <n points>, <spectra size>]

Returns:

  • list[int]

    list of integers.

get_stats_names

get_stats_names()

Used to get the names of statistics returned during the acquisition.

Returns:

  • list[str]

    names of statistics returned by the polling.

get_supported_gate_modes

get_supported_gate_modes()

Supported gate modes.

Returns:

  • list[GateModes]

    a list of supported gate modes.

get_supported_run_modes

get_supported_run_modes()

Supported run modes.

Returns:

  • list[RunModes]

    a list of supported run modes.

get_supported_spectrum_sizes

get_supported_spectrum_sizes()

Supported spectrum sizes.

Returns:

  • list[int]

    a list of supported spectrum sizes

get_supported_start_triggers

get_supported_start_triggers()

Supported start triggers.

Returns:

  • list[ControlTriggers]

    a list of supported start triggers.

get_supported_stop_triggers

get_supported_stop_triggers()

Supported stop triggers.

Returns:

  • list[ControlTriggers]

    a list of supported stop triggers.

is_running

is_running()

poll_acq

poll_acq()

After an acquisition is started, this method can be called to poll the controller and retrieve data. See the documentation for the PollResult class.

Returns:

prepare_acq

prepare_acq(resume=False)

Signals that an acquisition is about to be started, and that the controller should be ready (e.g: apply settings).

Parameters:

  • resume (bool, default: False ) –

    not used at the moment.

Note

after a call to that prepare_acq everything should be set up so that subsequent calls to detetector_channels and get_stats_name return values consistent with the applied settings.

spectrum_size

spectrum_size()

start_acq

start_acq(resume=None)

Starts the acquisitions.

Parameters:

  • resume (bool, default: None ) –

    not used at the moment.

stop_acq

stop_acq()

Stops the acquisitions.

timeout_prepare

timeout_prepare()

Maximum expected time when calling prepare_acq.

Returns:

  • float

    timeout in s, default 5s.

timeout_setup

timeout_setup()

Maximum expected time when calling setup_acq.

Returns:

  • float

    timeout in s, default 5s.

timeout_start

timeout_start()

Maximum expected time when calling start_acq.

Returns:

  • float

    timeout in s, default 5s.

timeout_stop

timeout_stop()

Maximum expected time when calling stop_acq.

Returns:

  • float

    timeout in s, default 5s.