MockErrorHandler¶
- class lsst.ts.m2com.MockErrorHandler(filepath: str | Path | None = None)¶
Bases:
ErrorHandlerMock Error Handler class to manage the errors.
Parameters¶
- filepath
strorpathlib.PosixPathor None Error list file path. (the default is None)
Attributes¶
- enabled_faults_mask
int Enabled faults mask.
Methods Summary
add_new_error(code)Add the new error code.
add_new_limit_switch(actuator_id, ...)Add the new triggered limit switch.
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 errors.
decode_summary_faults_status(status)Decode the summary faults status.
Exists the error (new or reported) or not.
exists_limit_switch(limit_switch_type)Exists the triggered limit switch (new or reported) or not.
Exists the new error (not reported) or not.
exists_new_limit_switch(limit_switch_type)Exists the new triggered limit switch (not reported) or not.
Exists the new warning (not reported) or not.
Exists the warning (new or reported) or not.
get_bit_from_code(code)Get the bit value from code.
Get the errors that are not reported yet.
get_limit_switches_to_report(limit_switch_type)Get the limit switches that are not reported yet.
Get the summary faults status from codes.
Get the summary faults status 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_limit_switch(actuator_id: int, limit_switch_type: LimitSwitchType) None¶
Add the new triggered limit switch.
Parameters¶
- actuator_id
int Actuator ID: [0, NUM_ACTUATOR).
- limit_switch_typeenum
LimitSwitchType Limit switch type.
Raises¶
ValueErrorWhen the actuator ID is not in the range.
- actuator_id
- calc_enabled_faults_mask(codes: set, original_mask: int) tuple[int, list]¶
Calculate the new enabled faults mask.
Parameters¶
- codes
set Error codes to bypass.
- original_mask
int Original enabled faults mask.
Returns¶
intNew enabled faults mask.
- bits
list Bypassed bits.
- codes
- clear() None¶
Clear all 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¶
- status
int Summary faults status.
- status
- exists_error() bool¶
Exists the error (new or reported) or not.
Returns¶
boolTrue if there is the error. Otherwise, False.
- exists_limit_switch(limit_switch_type: LimitSwitchType) bool¶
Exists the triggered limit switch (new or reported) or not.
Parameters¶
- limit_switch_typeenum
LimitSwitchType Limit switch type.
Returns¶
boolTrue if there is the triggered limit switch. Otherwise, False.
- limit_switch_typeenum
- exists_new_error() bool¶
Exists the new error (not reported) or not.
Returns¶
boolTrue if there is the new error. Otherwise, False.
- exists_new_limit_switch(limit_switch_type: LimitSwitchType) bool¶
Exists the new triggered limit switch (not reported) or not.
Parameters¶
- limit_switch_typeenum
LimitSwitchType Limit switch type.
Returns¶
boolTrue if there is the new trigged limit switch. Otherwise, False.
- limit_switch_typeenum
- exists_new_warning() bool¶
Exists the new warning (not reported) or not.
Returns¶
boolTrue if there is the new warning. Otherwise, False.
- exists_warning() bool¶
Exists the warning (new or reported) or not.
Returns¶
boolTrue if there is the error. Otherwise, False.
- get_bit_from_code(code: int) int¶
Get the bit value from code.
Parameters¶
- code
int Code.
Returns¶
int0-based bit value.
- code
- get_errors_to_report() set[int]¶
Get the errors that are not reported yet.
Returns¶
setErrors to report.
- get_limit_switches_to_report(limit_switch_type: LimitSwitchType) Set[int]¶
Get the limit switches that are not reported yet.
Parameters¶
- limit_switch_typeenum
LimitSwitchType Limit switch type.
Returns¶
setLimit switches to report.
- limit_switch_typeenum
- get_summary_faults_status_from_codes(codes: list[int]) int¶
Get the summary faults status from codes.
Parameters¶
- codes
list[int] Collection of the dummy, error, and warning codes to construct the summary fault status. There should be no repeated value inside.
Returns¶
intSummary faults status.
- codes
- 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¶
intSummary faults status.
- get_warnings_to_report() set[int]¶
Get the warnings that are not reported yet.
Returns¶
setWarnings to report.
- has_error(code: int) bool¶
Has received the specific error or not.
Parameters¶
- code
int Error code.
Returns¶
boolTrue if the code is received already. Otherwise, False.
- code
- has_warning(code: int) bool¶
Has received the specific warning or not.
Parameters¶
- code
int Warning code.
Returns¶
boolTrue if the code is received already. Otherwise, False.
- code
- is_error(code: int) bool¶
Is error or not.
Parameters¶
- code
int Code.
Returns¶
boolTrue if the code belongs to error. Otherwise, False.
- code
- filepath