-
Notifications
You must be signed in to change notification settings - Fork 0
Implement multi-model uncertainty quantification tools #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sdahdah
merged 15 commits into
main
from
50-implement-multi-model-uncertainty-quantification-tools
Oct 14, 2025
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
87cffa3
Initial implementation of uncertainty residual response computation a…
timeverettadams c58204d
Implement optimal uncertainty weight computation and add initial SISO…
timeverettadams a25ca0b
Initial implementation of uncertainty weight overbounding.
timeverettadams 8b12485
Rename variables in to ensure better consistency
timeverettadams f376c16
Update uncertainty characterization code to use np.ndarray objects fo…
timeverettadams c480926
Write unit tests for uncertainty characterization
timeverettadams 63667ef
Add docstring examples for the user-facing uncertainty characterizati…
timeverettadams 6a4a3e5
Implement additional options in the plotting functionality for the un…
timeverettadams 7e1b46e
Add uncertainty characterization example in the documentation.
timeverettadams 38e3e1b
Remove MOSEK dependencies
timeverettadams b4ab219
Set default solver parameters to use Clarabel for uncertainty charact…
timeverettadams 7e03892
Update default solver options and regenerate regression test results …
timeverettadams ba03cce
Address initial code review comments
timeverettadams 81c1184
Implement plot customization features, conversion from control.Freque…
timeverettadams 851072e
Bump version numbers
timeverettadams File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| """Multi-model uncertainty characterization from frequency response data.""" | ||
|
|
||
| import numpy as np | ||
| from matplotlib import pyplot as plt | ||
|
|
||
| import dkpy | ||
|
|
||
|
|
||
| def example_uncertainty_characterization(): | ||
| """Multi-model uncertainty characterization from frequency response data.""" | ||
|
|
||
| # Generate example data | ||
| eg = dkpy.example_multimodel_uncertainty() | ||
| complex_response_nom = eg["complex_response_nominal"] | ||
| complex_response_offnom_list = eg["complex_response_offnominal_list"] | ||
| omega = eg["omega"] | ||
|
|
||
| # Plot: Magnitude response of nominal and off-nominal systems | ||
| fig, _ = dkpy.plot_magnitude_response_nom_offnom( | ||
| complex_response_nom, | ||
| complex_response_offnom_list, | ||
| omega, | ||
| ) | ||
|
|
||
| # Plot: Phase response of nominal and off-nominal systems | ||
| fig, _ = dkpy.plot_phase_response_nom_offnom( | ||
| complex_response_nom, | ||
| complex_response_offnom_list, | ||
| omega, | ||
| ) | ||
|
|
||
| # Plot: Singular value response of nominal and off-nominal systems | ||
| fig, ax = dkpy.plot_singular_value_response_nom_offnom( | ||
| complex_response_nom, | ||
| complex_response_offnom_list, | ||
| omega, | ||
| ) | ||
|
|
||
| # Uncertainty models | ||
| uncertainty_models = {"A", "I", "O", "iA", "iI", "iO"} | ||
| complex_response_residuals_dict = dkpy.compute_uncertainty_residual_response( | ||
| complex_response_nom, | ||
| complex_response_offnom_list, | ||
| uncertainty_models, | ||
| ) | ||
|
|
||
| # Plot: Singular value response of uncerainty residuals | ||
| figure_dict = dkpy.plot_singular_value_response_uncertainty_residual( | ||
| complex_response_residuals_dict, omega | ||
| ) | ||
|
|
||
| # Plot: Comparison of singular value response of uncerainty residuals for each | ||
| # uncertainty model | ||
| fig, _ = dkpy.plot_singular_value_response_uncertainty_residual_comparison( | ||
| complex_response_residuals_dict, omega | ||
| ) | ||
| fig.savefig("doc/_static/example_7/7_sval_max_residual.png") | ||
timeverettadams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Compute uncertainty weight frequency response | ||
| complex_response_weight_left, complex_response_weight_right = ( | ||
timeverettadams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| dkpy.compute_optimal_uncertainty_weight_response( | ||
| complex_response_residuals_dict["iA"], "diagonal", "diagonal" | ||
| ) | ||
| ) | ||
|
|
||
| print("fit weight") | ||
timeverettadams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # Fit overbounding stable and minimum-phase uncertainty weight system | ||
| weight_left = dkpy.fit_overbounding_uncertainty_weight( | ||
| complex_response_weight_left, omega, [4, 5] | ||
| ) | ||
| weight_right = dkpy.fit_overbounding_uncertainty_weight( | ||
| complex_response_weight_right, omega, [3, 5] | ||
| ) | ||
|
|
||
| # Plot: Magnitude response of uncertainty weight and overbounding uncertainty weight | ||
| # fit | ||
| fig, _ = dkpy.plot_magnitude_response_uncertainty_weight( | ||
| complex_response_weight_left, | ||
| complex_response_weight_right, | ||
| omega, | ||
| weight_left, | ||
| weight_right, | ||
| ) | ||
| plt.show() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| example_uncertainty_characterization() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.