QualityQuery#
- class ctapipe.core.QualityQuery(**kwargs: Any)[source]#
Bases:
Component
Manages a set of user-configurable (at runtime or in a config file) selection criteria that operate on the same type of input. Each time it is called, it returns a boolean array of whether or not each criterion passed. It also keeps track of the total number of times each criterium is passed, as well as a cumulative product of criterium (i.e. the criteria applied in-order)
Attributes Summary
list of tuples of ('<description', 'expression string') to accept (select) a given data value.
Methods Summary
__call__
(**kwargs)Test that value passes all cuts
get_table_mask
(table)Get a boolean mask for the entries that pass the quality checks.
to_table
([functions])Return a tabular view of the latest quality summary
Attributes Documentation
- quality_criteria#
list of tuples of (‘<description’, ‘expression string’) to accept (select) a given data value. E.g.
[('mycut', 'x > 3'),]
. You may usenumpy
asnp
andastropy.units
asu
, but no other modules.
Methods Documentation
- __call__(**kwargs) ndarray [source]#
Test that value passes all cuts
- Parameters:
- **kwargs:
Are passed as locals to evaluate the given expression
- Returns:
- np.ndarray:
array of booleans with results of each selection criterion in order
- get_table_mask(table)[source]#
Get a boolean mask for the entries that pass the quality checks.
- Parameters:
- table
Table
Table with columns matching the expressions used in the
QualityQuery.quality_criteria
.
- table
- Returns:
- masknp.ndarray[bool]
Boolean mask of valid entries.
- to_table(functions=False)[source]#
Return a tabular view of the latest quality summary
The columns are - criteria: name of each criterion - counts: counts of each criterion independently - cum_counts: counts of cumulative application of each criterion in order
- Parameters:
- functions: bool:
include the function string as a column
- Returns:
- astropy.table.Table