rfwtools.example_validator

This package manages the validation of Examples. While much data is collected, some data is unsuitable for analysis.

An ExampleValidator object is responsible for investigating an Example object and determining if it suitable for analysis. ExampleValidator should be subclassed as needed to support the individual requirements of different analytical approaches.

Typically you won’t use these directly, and instead pass it to the ExapmleSet.purge_invalid_examples() method. Basic Usage Example:

import math
from datetime import datetime
from rfwtools.example import Example
from rfwtools.example_validator import ExampleValidator

# Make an example to validate
ex = Example(zone='1L25',
             dtime=datetime.strptime("2020-03-10 01:08:41.2", "%Y-%m-%d %H:%M:%S.%f),
             cavity_label="4",
             fault_label="Microphonics",
             cavity_conf=math.nan,
             fault_conf=math.nan,
             label_source='my_label_file.txt'
            )

# Setup the validator
ev = ExampleValidator()
ev.set_example(ex)

# If anything is wrong with the example, the validator will raise an exception.  The exception clause is
# intentionally broad to capture the bevy of problems that could be encountered.
try:
    ev.validate_data()
except Exception as exc:
    print(f"Invalid event - {ex}\n  {exc}\n")

Classes

ExampleValidator([mya_deployment])

This class provides functionality for checking that an individual example meets the criteria for validity.

WindowedExampleValidator([mya_deployment])

Checks that WindowedExamples meet our validation criteria.