Comparison & Batch Reports¶
Multi-run comparison (before/after deltas) and batch (cross-DUT yield) analysis and report building
Multi-run input model for comparison and batch reports.
A Run is a set of capture files plus per-run metadata; a RunSet is the ordered collection the ComparisonAnalyzer consumes. Comparison mode measures deltas against a baseline run; batch mode aggregates across runs (DUTs).
RunMetadata
dataclass
¶
RunMetadata(dut_id: Optional[str] = None, condition: Optional[str] = None, operator: Optional[str] = None, timestamp: Optional[datetime] = None, notes: Optional[str] = None)
Descriptive, optional context for one run.
Run
dataclass
¶
Run(label: str, files: List[Path], metadata: RunMetadata = RunMetadata(), waveforms: List[WaveformData] = list(), measurements: List[MeasurementResult] = list(), passed: Optional[bool] = None, incomplete: bool = False, load_errors: List[str] = list())
One test run: capture files in, analyzed waveforms/measurements out.
RunSet
dataclass
¶
RunSet(runs: List[Run], mode: str = MODE_COMPARISON, baseline_index: int = 0, criteria_set: Optional[CriteriaSet] = None)
The full input to a comparison or batch analysis.
validate
¶
Raise ValueError on structural problems (before any file I/O).
Source code in scpi_control/report_generator/models/comparison.py
DeltaEntry
dataclass
¶
One non-baseline run's value for one statistic, relative to baseline.
AggregateStats
dataclass
¶
Cross-run aggregate of one statistic (batch mode).
ComparisonResult
dataclass
¶
ComparisonResult(runset: RunSet, matched_channels: List[str], deltas: Dict[str, Dict[str, List[DeltaEntry]]] = dict(), aggregates: Dict[str, Dict[str, AggregateStats]] = dict(), yield_passed: Optional[int] = None, yield_total: Optional[int] = None, yield_incomplete: Optional[int] = None, warnings: List[str] = list())
Everything the report builder needs, fully computed.
Loads and analyzes a RunSet into a ComparisonResult.
Strict by default: a bad file fails the whole analysis with the run and file named. skip_bad_runs=True demotes that to a warning and drops the run, except when fewer than two runs survive or the comparison baseline itself is lost.
ComparisonAnalysisError
¶
Bases: Exception
Analysis could not produce a usable result.
ComparisonAnalyzer
¶
Turns a RunSet into a fully computed ComparisonResult.
evaluate_measurements
¶
evaluate_measurements(waveforms: List[WaveformData], criteria_set: Optional[CriteriaSet], warnings: List[str], *, label: str) -> Tuple[List[MeasurementResult], Optional[bool], bool]
Turn waveforms' .statistics plus a CriteriaSet into MeasurementResult
objects, and compute the resulting pass/fail verdict.
This is the shared core of ComparisonAnalyzer._apply_criteria, extracted so
a single-capture (non-comparison) reporting path can apply the exact same
criteria-evaluation semantics without a second, divergent implementation.
Only critical-severity criteria gate the verdict; warning/info criteria
still produce MeasurementResults but never flip passed or incomplete.
A criterion that cannot be evaluated (missing/non-numeric statistic, or not
fully specified e.g. no min/max set) is surfaced as an entry appended to the
caller-supplied, mutable warnings list -- never silently dropped. If such a
criterion is critical, the verdict becomes incomplete rather than a false
PASS or FAIL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveforms
|
List[WaveformData]
|
Waveforms to evaluate; each must already have |
required |
criteria_set
|
Optional[CriteriaSet]
|
Criteria to apply, or None to skip evaluation entirely. |
required |
warnings
|
List[str]
|
Mutable list that un-evaluable-criterion messages are appended
to, matching |
required |
label
|
str
|
Identifies the source in warning text (e.g. "Run 'baseline'"), keyed-word argument so call sites read clearly at the call site. |
required |
Returns:
| Type | Description |
|---|---|
(measurements, passed, incomplete)
|
|
Optional[bool]
|
|
bool
|
|
Tuple[List[MeasurementResult], Optional[bool], bool]
|
|
Source code in scpi_control/report_generator/analysis/comparison_analyzer.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
Builds TestReports from analyzed RunSets, plus the manifest/sign-off helpers shared with the single-run report path.
build_manifest
¶
One entry per source file per run. Timestamp: provenance acquired_at, else waveform capture_timestamp, else None -- a file's mtime is when it was written or copied, not when the signal was acquired, so it is never substituted.
Source code in scpi_control/report_generator/comparison_report_builder.py
build_comparison_report
¶
build_comparison_report(result: ComparisonResult, metadata: ReportMetadata, template: Optional[ReportTemplate] = None, *, include_appendix: Optional[bool] = None, include_signoff: Optional[bool] = None) -> TestReport
Assemble a standard TestReport from an analyzed RunSet.
Explicit kwargs win; otherwise template settings; with neither, both the appendix and sign-off are included (comparison reports exist for traceability).
Source code in scpi_control/report_generator/comparison_report_builder.py
append_signoff_and_appendix
¶
Single-run path: honor the template's appendix/sign-off flags on an already-built report. Manifest is derived from section waveforms.
Source code in scpi_control/report_generator/comparison_report_builder.py
See Also¶
- Waveform - Waveform acquisition and data handling
- Analysis - Signal analysis (FFT, THD, SNR)
- Signal Synthesis - Parameterized synthetic waveforms for hardware-free examples
- Report Generator: API Reference - Single-run report building blocks (ReportMetadata, TestReport, generators)