[SIApp] Addting Tolerance to the sensor measurements - #14634
Conversation
These parameters were unused and added unnecessary complexity to model part import. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds configurable per-sensor absolute error tolerance (“error_threshold”) so small measurement residuals are treated as zero, with updated C++/Python sensor APIs and tests ensuring thresholding behavior.
Changes:
- Add
error_thresholdtoSensor(C++ + pybind) and propagate it throughDisplacementSensor/StrainSensorcreation + default parameters. - Apply thresholding in
MeasurementResidualResponseFunction::CalculateValuewhen writingSENSOR_ERROR. - Add Python unit tests covering below/above/between threshold scenarios for sensor errors.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| applications/SystemIdentificationApplication/tests/responses/test_damage_response.py | Adds regression tests validating sensor-error thresholding behavior in response value and stored SENSOR_ERROR. |
| applications/SystemIdentificationApplication/python_scripts/sensor_io/sensor_model_part_controller.py | Adds VTU output generation during model-part import (currently unconditional). |
| applications/SystemIdentificationApplication/custom_sensors/sensor.h | Extends base Sensor API to include ErrorThreshold and exposes getter + member. |
| applications/SystemIdentificationApplication/custom_sensors/sensor.cpp | Persists error_threshold in sensor parameters serialization + PrintData. |
| applications/SystemIdentificationApplication/custom_sensors/displacement_sensor.h/.cpp | Propagates error_threshold through constructor/create/default parameters. |
| applications/SystemIdentificationApplication/custom_sensors/strain_sensor.h/.cpp | Propagates error_threshold through constructor/create/default parameters. |
| applications/SystemIdentificationApplication/custom_responses/measurement_residual_response_function.cpp | Thresholds raw sensor errors before storing/using SENSOR_ERROR. |
| applications/SystemIdentificationApplication/custom_python/add_custom_sensors_to_python.cpp | Exposes GetErrorThreshold and adds optional ctor arg in bindings. |
Suppressed comments (1)
applications/SystemIdentificationApplication/custom_sensors/displacement_sensor.cpp:1
- This directly reads
SensorParameters[\"error_threshold\"], which will throw if older input files omit the new key (backward compatibility). To make the new parameter truly optional, validate/assign defaults before accessing it (e.g., validate againstGetDefaultParameters()insideCreate, or defensively fall back when the key is missing). The same issue applies toStrainSensor::Create.
// | / |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Centralize the error_threshold default as Sensor::DefaultErrorThreshold instead of duplicating 1e-16 across constructors, sensor Create() defaults, and the pybind11 binding. Gate the debug VTU dump in SensorModelPartController.ImportModelPart() behind an explicit "debug_output" parameter so imports stay side-effect free by default. Add a test covering sensor creation with error_threshold omitted from parameters, verifying the default is applied. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
name: ✨ Feature
about:
📝 Description
This pull request introduces enhancements to both the Optimization and System Identification Applications, focusing on improved sensor handling, error thresholding, and model part manipulation. The main changes include support for node coordinate offsets during model part import, configurable error thresholds for sensors, and improved Python bindings for sensor classes.