Portable Original ONNX Curve Plotter

Portable original RCIM paper ONNX curve plotter.

This script is intentionally self-contained. It can be copied outside the repository and run after editing the hardcoded user configuration block below.

Required external packages:

numpy pandas matplotlib onnxruntime

class scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.OnnxTargetConfiguration(target_kind, harmonic_order, family_name, model_path)[source]

Bases: object

One hardcoded ONNX target configuration.

Parameters:
  • target_kind (str)

  • harmonic_order (int)

  • family_name (str)

  • model_path (Path)

target_kind: str
harmonic_order: int
family_name: str
model_path: Path
class scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.LoadedOnnxTarget(configuration, session, input_name)[source]

Bases: object

One loaded ONNX target model.

Parameters:
configuration: OnnxTargetConfiguration
session: onnxruntime.InferenceSession
input_name: str
class scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.CurveRecord(source_csv_path, speed_rpm, torque_nm, oil_temperature_deg, angular_position_deg, measured_transmission_error_deg)[source]

Bases: object

One measured curve and its operating point.

Parameters:
  • source_csv_path (Path)

  • speed_rpm (float)

  • torque_nm (float)

  • oil_temperature_deg (float)

  • angular_position_deg (ndarray)

  • measured_transmission_error_deg (ndarray)

source_csv_path: Path
speed_rpm: float
torque_nm: float
oil_temperature_deg: float
angular_position_deg: ndarray
measured_transmission_error_deg: ndarray
scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.resolve_configured_path(path_value)[source]

Resolve one hardcoded path from the configured base directory.

Parameters:

path_value (str | Path)

Return type:

Path

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.find_first_existing_column(dataframe, candidate_list, role_label)[source]

Find the first configured column name present in a dataframe.

Parameters:
  • dataframe (DataFrame)

  • candidate_list (list[str])

  • role_label (str)

Return type:

str

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.read_constant_value_from_column(dataframe, column_name, role_label)[source]

Read one finite operating-point scalar from a CSV column.

Parameters:
  • dataframe (DataFrame)

  • column_name (str)

  • role_label (str)

Return type:

float

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.read_optional_operating_point_column(dataframe, candidate_list, role_label)[source]

Read one optional operating-point scalar from a CSV column.

Parameters:
  • dataframe (DataFrame)

  • candidate_list (list[str])

  • role_label (str)

Return type:

float | None

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.parse_operating_point_from_filename(csv_path)[source]

Parse original-dataset operating-point metadata from a CSV filename.

Parameters:

csv_path (Path)

Return type:

dict[str, float] | None

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.resolve_operating_point(dataframe, csv_path)[source]

Resolve speed, torque, and oil temperature for one input curve.

Parameters:
  • dataframe (DataFrame)

  • csv_path (Path)

Return type:

dict[str, float]

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.load_curve_record(csv_path)[source]

Load one measured curve CSV.

Parameters:

csv_path (Path)

Return type:

CurveRecord

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.collect_curve_csv_path_list()[source]

Collect explicit and directory-based input CSV paths.

Return type:

list[Path]

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.load_onnx_target_configuration_list()[source]

Load and validate hardcoded ONNX target configurations.

Return type:

list[OnnxTargetConfiguration]

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.resolve_selected_harmonic_order_list(configuration_list)[source]

Resolve and validate the selected harmonic list.

Parameters:

configuration_list (list[OnnxTargetConfiguration])

Return type:

list[int]

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.load_selected_onnx_target_list(configuration_list, selected_harmonic_order_list)[source]

Load ONNX Runtime sessions for the selected target models.

Parameters:
Return type:

list[LoadedOnnxTarget]

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.build_feature_matrix(curve_record)[source]

Build one ONNX input feature row.

Parameters:

curve_record (CurveRecord)

Return type:

ndarray

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.predict_target_dictionary(curve_record, loaded_target_list)[source]

Predict amplitude and phase targets for one curve.

Parameters:
Return type:

dict[tuple[str, int], float]

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.reconstruct_curve_from_prediction_dictionary(angular_position_deg, selected_harmonic_order_list, prediction_dictionary)[source]

Reconstruct one transmission-error curve from predicted harmonic targets.

Parameters:
  • angular_position_deg (ndarray)

  • selected_harmonic_order_list (list[int])

  • prediction_dictionary (dict[tuple[str, int], float])

Return type:

ndarray

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.compute_metric_dictionary(measured_curve_deg, predicted_curve_deg)[source]

Compute simple curve metrics against measured TE.

Parameters:
  • measured_curve_deg (ndarray)

  • predicted_curve_deg (ndarray)

Return type:

dict[str, float]

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.sanitize_path_stem(path)[source]

Build a filesystem-safe output stem from one input path.

Parameters:

path (Path)

Return type:

str

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.save_predicted_curve_csv(curve_record, predicted_curve_deg, output_csv_path)[source]

Save measured, predicted, and residual TE arrays for one curve.

Parameters:
  • curve_record (CurveRecord)

  • predicted_curve_deg (ndarray)

  • output_csv_path (Path)

Return type:

None

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.save_curve_plot(curve_record, predicted_curve_deg, metric_dictionary, output_plot_path)[source]

Save or show one measured-versus-predicted TE plot.

Parameters:
  • curve_record (CurveRecord)

  • predicted_curve_deg (ndarray)

  • metric_dictionary (dict[str, float])

  • output_plot_path (Path)

Return type:

None

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.process_curve_record(curve_record, loaded_target_list, selected_harmonic_order_list, output_directory_path)[source]

Run prediction, reconstruction, metrics, and artifacts for one curve.

Parameters:
  • curve_record (CurveRecord)

  • loaded_target_list (list[LoadedOnnxTarget])

  • selected_harmonic_order_list (list[int])

  • output_directory_path (Path)

Return type:

dict[str, Any]

scripts.paper_reimplementation.rcim_ml_compensation.reference_family_vs_feedforward.portable_original_onnx_curve_plotter.run_portable_plotter()[source]

Run the portable original-ONNX curve plotter.

Return type:

list[dict[str, Any]]