Validation API¶
Validation¶
Validate kadi command states against telemetry.
This is a set of classes that validate the kadi command states against
Chandra telemetry. The classes are designed to be run either standalone
or from the command-line application kadi_validate_states
(defined in
kadi.scripts.validate_states
).
- class kadi.commands.validate.PlotAttrs(title: str, ylabel: str, range: list | None = None, max_delta_time: float | None = None, max_delta_val: float = 0, max_gap_time: float = 300)[source]¶
Plot attributes for a Validate subclass.
- Parameters:
- titlestr
Plot title.
- ylabelstr
Y-axis label.
- rangelist, optional
Y-axis range.
- max_delta_timefloat, optional
Maximum time delta before a new data point is plotted.
- max_delta_valfloat, default 0
Maximum value delta before a new data point is plotted.
- max_gap_timefloat, default 300
Maximum gap in time before a plot gap is inserted.
- class kadi.commands.validate.Validate(stop=None, days: float = 14, no_exclude: bool = False)[source]¶
Validate kadi command states against telemetry base class.
Class attributes are as follows:
- state_namestr
Name of state to validate.
- stopCxoTime
Stop time.
- daysfloat
Number of days to validate.
- state_keys_extralist, optional
Extra state keys needed for validation.
- plot_attrsPlotAttrs
Attributes for plot.
- msidslist
MSIDs to fetch for telemetry.
- max_delta_valfloat
Maximum value delta to signal a violation.
- max_gapfloat
Maximum gap in telemetry before breaking an interval (sec).
- min_violation_durationfloat
Minimum duration of a violation (sec).
- Parameters:
- stop
stop time for validation
- days
number of days for validation
- no_exclude
if True then do not exclude any data (for testing)
- add_exclude_interval(start: CxoTime | str | float | int | ndarray | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | complex | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None, stop: CxoTime | str | float | int | ndarray | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | complex | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None, comment: str, pad_start: Quantity | None = None, pad_stop: Quantity | None = None, source: str = 'Auto-generated')[source]¶
Add an interval to the exclude_intervals table
The
start
/stop
times are padded bypad_start
andpad_stop
(which are a Quantity objects with time units).manual
is a boolean that is used to indicate whether the interval was manually specified in the command sheet. Non-manual intervals are annotated in the table accordingly.
- add_exclude_intervals()[source]¶
Base method to exclude intervals, starting with intervals defined in the Chandra Command Events Google Sheet.
This method gets called at the end of self.tlm.
Subclasses can override this method to add additional intervals to exclude, making sure to call super().add_exclude_intervals() first.
- property exclude_intervals¶
Intervals that are excluded from state validation.
This includes manually excluded times from the Command Events sheet (e.g. within a few minutes of an IU-reset), or auto-generated state-specific intervals like not validating pitch when in NMM.
- exclude_ofp_intervals_except(states_expected: List[str])[source]¶
Exclude intervals where OFP (on-board flight program) is not in the expected state.
This includes a padding of 30 minutes after SAFE mode and 5 minutes for non-NRML states other than SAFE like STUP, SYON, SYSF etc.
- get_html(context: dict | None = None, template_text: str | None = None) str [source]¶
Get HTML for validator including section header, violations, and plot
- Parameters:
- context
optional dict of context for jinja2 template
- template_text
optional Jinja2 template text
- Returns:
- str
HTML string
- get_violations() Table [source]¶
Get the violations mask for this validation class
This is the main method for each validation class. It returns a Table with the columns
start
andstop
which are date strings.
- get_violations_mask() ndarray [source]¶
Get the violations mask for this validation class
This is the default implementation for most validation classes which just checks that the telemetry value is within
max_delta_val
of the state value.
- property msid¶
Validate classes have first MSID as primary telemetry. Override as needed.
- property states_at_times¶
Get the states that correspond to the telemetry times
- property tlm_vals¶
Get the reference telemetry value for this Validation subclass
That means the quantity derived from telemetry that gets compared to the states that come from kadi commands. This might be a single MSID (e.g. for pitch) or it might be something more complicated (e.g. for pointing which comes from 3 quaternion components).
- class kadi.commands.validate.ValidateDither(stop=None, days: float = 14, no_exclude: bool = False)[source]¶
- add_exclude_intervals()[source]¶
Base method to exclude intervals, starting with intervals defined in the Chandra Command Events Google Sheet.
This method gets called at the end of self.tlm.
Subclasses can override this method to add additional intervals to exclude, making sure to call super().add_exclude_intervals() first.
- class kadi.commands.validate.ValidateHETG(stop=None, days: float = 14, no_exclude: bool = False)[source]¶
- class kadi.commands.validate.ValidateLETG(stop=None, days: float = 14, no_exclude: bool = False)[source]¶
- class kadi.commands.validate.ValidateObsid(stop=None, days: float = 14, no_exclude: bool = False)[source]¶
- class kadi.commands.validate.ValidatePcadMode(stop=None, days: float = 14, no_exclude: bool = False)[source]¶
- add_exclude_intervals()[source]¶
Base method to exclude intervals, starting with intervals defined in the Chandra Command Events Google Sheet.
This method gets called at the end of self.tlm.
Subclasses can override this method to add additional intervals to exclude, making sure to call super().add_exclude_intervals() first.
- class kadi.commands.validate.ValidatePitch(stop=None, days: float = 14, no_exclude: bool = False)[source]¶