MockErrorHandler¶
- class lsst.ts.m2com.MockErrorHandler¶
Bases:
ErrorHandler
Mock Error Handler class to manage the errors.
- Attributes:
- enabled_faults_mask
int
Enabled faults mask.
- 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.
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.
- actuator_id
- Raises:
ValueError
When the actuator ID is not in the range.
- 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:
bool
True 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.
- limit_switch_typeenum
- Returns:
bool
True if there is the triggered limit switch. 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_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.
- limit_switch_typeenum
- Returns:
bool
True if there is the new trigged limit switch. 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_errors_to_report() set[int] ¶
Get the errors that are not reported yet.
- Returns:
set
Errors 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.
- limit_switch_typeenum
- Returns:
set
Limit switches to report.
- get_summary_faults_status_from_codes(codes: list[int]) int ¶
Get the summary faults status from 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:
int
Summary faults status.
- get_warnings_to_report() set[int] ¶
Get the warnings that are not reported yet.
- Returns:
set
Warnings to report.
- read_error_list_file(filepath: str | pathlib.Path) None ¶
Read the tsv file of error list.
- Parameters:
- filepath
str
orpathlib.PosixPath
File path.
- filepath