Phase 1 Polynomial-Fourier Benchmark
Run the Wave 5.2 Phase 1 Polynomial-Fourier analytical benchmark.
- class scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.CurveRecord(condition_id, split, direction, source_path, nominal_speed_rpm, nominal_torque_nm, nominal_temperature_deg_c, measured_speed_rpm, measured_torque_nm, measured_temperature_deg_c, theta_deg, te_deg)[source]
Bases:
objectOne leakage-safe directional benchmark curve.
- Parameters:
condition_id (str)
split (str)
direction (str)
source_path (str)
nominal_speed_rpm (float)
nominal_torque_nm (float)
nominal_temperature_deg_c (float)
measured_speed_rpm (float)
measured_torque_nm (float)
measured_temperature_deg_c (float)
theta_deg (ndarray)
te_deg (ndarray)
- condition_id: str
- split: str
- direction: str
- source_path: str
- nominal_speed_rpm: float
- nominal_torque_nm: float
- nominal_temperature_deg_c: float
- measured_speed_rpm: float
- measured_torque_nm: float
- measured_temperature_deg_c: float
- theta_deg: ndarray
- te_deg: ndarray
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.parse_arguments()[source]
Parse command-line arguments.
- Return type:
Namespace
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.load_yaml(path)[source]
Load one YAML mapping.
- Parameters:
path (Path)
- Return type:
dict[str, Any]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.load_csv_rows(path)[source]
Load one CSV as dictionaries.
- Parameters:
path (Path)
- Return type:
list[dict[str, str]]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.resolve_repository_path(path_text)[source]
Resolve a repository-relative path.
- Parameters:
path_text (str)
- Return type:
Path
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.load_curve_records(configuration, manifest)[source]
Load and uniformly resample every eligible directional curve.
- Parameters:
configuration (dict[str, Any])
manifest (dict[str, Any])
- Return type:
list[CurveRecord]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.fit_surface_map(curve_record_list, harmonic_order_list)[source]
Fit one separate quadratic coefficient surface per direction.
- Parameters:
curve_record_list (list[CurveRecord])
harmonic_order_list (list[int])
- Return type:
dict[str, QuadraticCoefficientSurface]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.curve_metrics(measured_curve, predicted_curve)[source]
Compute curve-first raw, shape, offset, derivative, and closure metrics.
- Parameters:
measured_curve (ndarray)
predicted_curve (ndarray)
- Return type:
dict[str, float]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.harmonic_error_metrics(measured_curve, predicted_curve, harmonic_order_list)[source]
Summarize retained-order amplitude and circular phase errors.
- Parameters:
measured_curve (ndarray)
predicted_curve (ndarray)
harmonic_order_list (list[int])
- Return type:
dict[str, float]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.evaluate_benchmark(configuration, curve_record_list, surface_map_by_model, onnx_predictor, plc_parameters)[source]
Evaluate all analytical formulations on all common curves.
- Parameters:
configuration (dict[str, Any])
curve_record_list (list[CurveRecord])
surface_map_by_model (dict[str, dict[str, QuadraticCoefficientSurface]])
onnx_predictor (RecoveredMatlabOnnxPredictor)
plc_parameters (Any)
- Return type:
tuple[list[dict[str, Any]], dict[tuple[str, str, str], ndarray]]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.aggregate_metrics(metric_row_list)[source]
Aggregate every numeric metric by model, split, and direction.
- Parameters:
metric_row_list (list[dict[str, Any]])
- Return type:
list[dict[str, Any]]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.select_phase1_models(aggregate_row_list)[source]
Select an analytical reference and a structurally different comparator.
- Parameters:
aggregate_row_list (list[dict[str, Any]])
- Return type:
dict[str, Any]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.false_value()[source]
Return a YAML-safe explicit false value.
- Return type:
bool
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.run_deterministic_tests(onnx_predictor, plc_parameters)[source]
Run deterministic analytical identity and contract tests.
- Parameters:
onnx_predictor (RecoveredMatlabOnnxPredictor)
plc_parameters (Any)
- Return type:
dict[str, Any]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.evaluate_matlab_examples(configuration, onnx_predictor)[source]
Evaluate recovered ONNX inference against the five MATLAB Fw examples.
- Parameters:
configuration (dict[str, Any])
onnx_predictor (RecoveredMatlabOnnxPredictor)
- Return type:
list[dict[str, Any]]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.build_preprocessing_rows(configuration, curve_record_list)[source]
Audit the Bauer preprocessing chain on the held-out test curves.
- Parameters:
configuration (dict[str, Any])
curve_record_list (list[CurveRecord])
- Return type:
list[dict[str, Any]]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.write_csv_rows(path, row_list)[source]
Write stable dictionary rows to CSV.
- Parameters:
path (Path)
row_list (list[dict[str, Any]])
- Return type:
None
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.surface_to_payload(surface)[source]
Serialize one fitted surface with explicit coefficients.
- Parameters:
surface (QuadraticCoefficientSurface)
- Return type:
dict[str, Any]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.create_representative_plots(configuration, curve_record_list, metric_row_list, prediction_cache, selected_model_map)[source]
Create median and worst held-out plots for both directions.
- Parameters:
configuration (dict[str, Any])
curve_record_list (list[CurveRecord])
metric_row_list (list[dict[str, Any]])
prediction_cache (dict[tuple[str, str, str], ndarray])
selected_model_map (dict[str, Any])
- Return type:
list[str]
- scripts.analysis.polynomial_fourier_benchmark.run_phase1_polynomial_fourier_benchmark.write_report(configuration, summary_payload, aggregate_row_list)[source]
Write the canonical Phase 1 analytical report.
- Parameters:
configuration (dict[str, Any])
summary_payload (dict[str, Any])
aggregate_row_list (list[dict[str, Any]])
- Return type:
None