ErrorHandler

class lsst.ts.m2com.ErrorHandler(filepath: str | Path | None = None)

Bases: object

Error Handler class to manage the errors.

Parameters

filepathstr or pathlib.PosixPath or None

Error list file path. (the default is None)

Attributes

list_code_totallist

List of the dummy, error, and warning codes to map the bit value of summary faults status in cell controller with the related code.

Methods Summary

add_new_error(code)

Add the new error code.

add_new_warning(code)

Add the new warning code.

calc_enabled_faults_mask(codes, original_mask)

Calculate the new enabled faults mask.

clear()

Clear all warnings and errors.

decode_summary_faults_status(status)

Decode the summary faults status.

exists_error()

Exists the error (new or reported) or not.

exists_new_error()

Exists the new error (not reported) or not.

exists_new_warning()

Exists the new warning (not reported) or not.

exists_warning()

Exists the warning (new or reported) or not.

get_bit_from_code(code)

Get the bit value from code.

get_errors_to_report()

Get the errors that are not reported yet.

get_summary_faults_status_from_codes(codes)

Get the summary faults status from codes.

get_summary_faults_status_to_report()

Get the summary faults status to report.

get_warnings_to_report()

Get the warnings that are not reported yet.

has_error(code)

Has received the specific error or not.

has_warning(code)

Has received the specific warning or not.

is_error(code)

Is error or not.

is_warning(code)

Is warning or not.

read_error_list_file(filepath)

Read the tsv file of error list.

Methods Documentation

add_new_error(code: int) None

Add the new error code.

Parameters

codeint

Error code.

add_new_warning(code: int) None

Add the new warning code.

Parameters

codeint

Warning code.

calc_enabled_faults_mask(codes: set, original_mask: int) tuple[int, list]

Calculate the new enabled faults mask.

Parameters

codesset

Error codes to bypass.

original_maskint

Original enabled faults mask.

Returns

int

New enabled faults mask.

bitslist

Bypassed bits.

clear() None

Clear all warnings and errors.

decode_summary_faults_status(status: int) None

Decode the summary faults status. The decoded error/warning code will be put into the internal lists of error and warning.

Parameters

statusint

Summary faults status.

exists_error() bool

Exists the error (new or reported) or not.

Returns

bool

True if there is the error. Otherwise, False.

exists_new_error() bool

Exists the new error (not reported) or not.

Returns

bool

True if there is the new error. Otherwise, False.

exists_new_warning() bool

Exists the new warning (not reported) or not.

Returns

bool

True if there is the new warning. Otherwise, False.

exists_warning() bool

Exists the warning (new or reported) or not.

Returns

bool

True if there is the error. Otherwise, False.

get_bit_from_code(code: int) int

Get the bit value from code.

Parameters

codeint

Code.

Returns

int

0-based bit value.

get_errors_to_report() set[int]

Get the errors that are not reported yet.

Returns

set

Errors to report.

get_summary_faults_status_from_codes(codes: list[int]) int

Get the summary faults status from codes.

Parameters

codeslist [int]

Collection of the dummy, error, and warning codes to construct the summary fault status. There should be no repeated value inside.

Returns

int

Summary faults status.

get_summary_faults_status_to_report() int

Get the summary faults status to report.

Note this function will put all unreported errors and warnings to the reported items.

Returns

int

Summary faults status.

get_warnings_to_report() set[int]

Get the warnings that are not reported yet.

Returns

set

Warnings to report.

has_error(code: int) bool

Has received the specific error or not.

Parameters

codeint

Error code.

Returns

bool

True if the code is received already. Otherwise, False.

has_warning(code: int) bool

Has received the specific warning or not.

Parameters

codeint

Warning code.

Returns

bool

True if the code is received already. Otherwise, False.

is_error(code: int) bool

Is error or not.

Parameters

codeint

Code.

Returns

bool

True if the code belongs to error. Otherwise, False.

is_warning(code: int) bool

Is warning or not.

Parameters

codeint

Code.

Returns

bool

True if the code belongs to warning. Otherwise, False.

read_error_list_file(filepath: str | Path) None

Read the tsv file of error list.

Parameters

filepathstr or pathlib.PosixPath

File path.