ErrorHandler¶
- class lsst.ts.m2com.ErrorHandler(filepath: str | Path | None = None)¶
Bases:
object
Error Handler class to manage the errors.
Parameters¶
- filepath
str
orpathlib.PosixPath
or None Error list file path. (the default is None)
Attributes¶
- list_code_total
list
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 the error (new or reported) or not.
Exists the new error (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 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
- 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¶
int
New enabled faults mask.
- bits
list
Bypassed bits.
- codes
- 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¶
- 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_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¶
- code
int
Code.
Returns¶
int
0-based bit value.
- code
- 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¶
- 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¶
int
Summary 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¶
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¶
- code
int
Error code.
Returns¶
bool
True 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¶
bool
True if the code is received already. Otherwise, False.
- code
- is_error(code: int) bool ¶
Is error or not.
Parameters¶
- code
int
Code.
Returns¶
bool
True if the code belongs to error. Otherwise, False.
- code
- filepath