ElectrometerCsc#

class lsst.ts.electrometer.ElectrometerCsc(index, config_dir=None, initial_state=State.STANDBY, simulation_mode=0)#

Bases: ConfigurableCsc

Implement the Electrometer CSC.

Parameters:
  • index (int) – The index of the CSC.

  • config_dir (str or None, optional) – Path to the configuration directory.

  • initial_state (lsst.ts.salobj.State, optional) – Initial summary state for the CSC.

  • simulation_mode (int) – The simulation mode of the CSC.

simulator#

Electrometer simulator used for simulation modes.

Type:

mock_server.MockServer or None

controller#

Controller object for the configured electrometer.

Type:

controller.ElectrometerController or None

image_name_service_client#

None

Client used to allocate observation identifiers for scan products.

Type:

lsst.ts.utils.ImageNameServiceClient or

run_event_loop#

Whether the event loop runs.

Type:

bool

event_loop_task#

Done future reserved for compatibility with existing task cleanup.

Type:

asyncio.Task

default_force_output#

Force the output of an event.

Type:

bool

bucket#

Bucket used for large file object uploads.

Type:

salobj.AsyncS3Bucket or None

Attributes Summary

active_bucket

Configured S3 bucket.

active_controller

Configured electrometer controller.

active_image_name_service_client

Configured image name service client.

detailed_state

The current substate of the CSC.

valid_simulation_modes

version

Methods Summary

assert_substate(substates, action)

Assert the CSC is in the proper substate.

assert_valid_range()

Assert that the requested measurement range is supported.

close_tasks()

Close unfinished tasks when the CSC is stopped.

configure(config)

Configure the Electrometer CSC.

do_changeNPLC(data)

Change the Number of Power Line Cycles (NPLC).

do_performZeroCalib(data)

Perform zero calibration.

do_setDigitalFilter(data)

Set the digital filter(s).

do_setIntegrationTime(data)

Set the integration time.

do_setMode(data)

Set the measurement mode.

do_setRange(data)

Set the range.

do_setVoltageSource(data)

Set voltage source settings.

do_startScan(data)

Start a manual scan.

do_startScanDt(data)

Start the scan with a set duration.

do_stopScan(data)

Stop the scan.

get_config_pkg()

Get the config package.

get_mode_index([mode_name])

Get the SAL index for a controller measurement mode.

handle_summary_state()

Handle transitions into and out of active summary states.

publish_controller_settings([settings])

Publish controller settings as SAL events.

publish_digital_filter_settings(settings)

Publish digital filter settings from a controller snapshot.

report_detailed_state(new_state)

Publish the detailed state.

run_controller_command(*, action, substates, ...)

Run a controller-backed command with consistent state handling.

write_scan_result(scan_result)

Write scan data to object storage and publish the LFA event.

Attributes Documentation

active_bucket#

Configured S3 bucket.

Raises:

RuntimeError – If the bucket has not been configured.

active_controller#

Configured electrometer controller.

Raises:

RuntimeError – If the controller has not been configured.

active_image_name_service_client#

Configured image name service client.

Raises:

RuntimeError – If the image name service client has not been configured.

detailed_state#

The current substate of the CSC.

Returns:

detailed_state – The sub state of the CSC.

Return type:

lsst.ts.xml.enums.Electrometer.DetailedState

valid_simulation_modes: Sequence[int] = (0, 1, 2)#
version = '0.14.1.dev1+g427fbb7b4'#

Methods Documentation

assert_substate(substates, action)#

Assert the CSC is in the proper substate.

Parameters:
  • substates (list of Electrometer.DetailedState) – The list of accepted substates for a given command.

  • action (str) – The name of the command to assert.

Raises:

salobj.ExpectedError – If the current substate is not allowed to perform the action.

assert_valid_range()#

Assert that the requested measurement range is supported.

async close_tasks()#

Close unfinished tasks when the CSC is stopped.

async configure(config)#

Configure the Electrometer CSC.

Parameters:

config (types.SimpleNamespace) – The parsed yaml object.

async do_changeNPLC(data)#

Change the Number of Power Line Cycles (NPLC).

Parameters:

data (cmd_changeNPLC.DataType) – The data for the command.

async do_performZeroCalib(data)#

Perform zero calibration.

Parameters:

data (cmd_performZeroCalib.DataType) – The data for the command.

async do_setDigitalFilter(data)#

Set the digital filter(s).

Parameters:

data (cmd_setDigitalFilter.DataType) – The data for the command.

async do_setIntegrationTime(data)#

Set the integration time.

Parameters:

data (cmd_setIntegrationTime.DataType) – The data for the command.

async do_setMode(data)#

Set the measurement mode.

Parameters:

data (cmd_setMode.DataType) – The data for the command.

async do_setRange(data)#

Set the range.

Parameters:

data (cmd_setRange.DataType) – The data for the command.

async do_setVoltageSource(data)#

Set voltage source settings.

Parameters:

data (cmd_setVoltageSource.DataType) – The data for the command.

async do_startScan(data)#

Start a manual scan.

Parameters:

data (cmd_startScan.DataType) – The data for the command.

async do_startScanDt(data)#

Start the scan with a set duration.

Parameters:

data (cmd_startScanDt.DataType) – The data for the command.

async do_stopScan(data)#

Stop the scan.

Parameters:

data (cmd_stopScan.DataType) – The data for the command.

static get_config_pkg()#

Get the config package.

Returns:

The name of the package where the configuration is stored.

Return type:

str

get_mode_index(mode_name=None)#

Get the SAL index for a controller measurement mode.

Parameters:

mode_name (str or None, optional) – Measurement mode to look up. Defaults to the active mode.

Returns:

mode_index – SAL enum index matching the controller measurement mode.

Return type:

int

async handle_summary_state()#

Handle transitions into and out of active summary states.

If transitioning to the disabled or enabled state:

  • Start the simulator if simulation_mode is true.

  • Create a bucket object for LFA support.

  • Connect the controller to the electrometer if needed.

  • Publish the controller settings as SAL events.

If leaving the disabled or enabled state:

  • Disconnect from the server, if connected.

  • If the simulator is running, stop it.

async publish_controller_settings(settings=None)#

Publish controller settings as SAL events.

Parameters:

settings (controller.ControllerSettings or None, optional) – Settings to publish. Defaults to the active controller settings.

Return type:

None

async publish_digital_filter_settings(settings)#

Publish digital filter settings from a controller snapshot.

Parameters:

settings (ControllerSettings)

Return type:

None

async report_detailed_state(new_state)#

Publish the detailed state.

Parameters:

new_state (lsst.ts.xml.enums.Electrometer.DetailedState) – Detailed state to publish.

async run_controller_command(*, action, substates, command, working_state=None, final_state=DetailedState.NOTREADINGSTATE, error_message, fault_code=None)#

Run a controller-backed command with consistent state handling.

Parameters:
  • action (str)

  • substates (list[DetailedState])

  • working_state (DetailedState | None, default: None)

  • final_state (DetailedState | None, default: <DetailedState.NOTREADINGSTATE: 6>)

  • error_message (str)

  • fault_code (Error | None, default: None)

async write_scan_result(scan_result)#

Write scan data to object storage and publish the LFA event.

Parameters:

scan_result (controller.ScanResult) – Scan data and metadata returned by the active controller.

Return type:

None