progpy 1.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- progpy-1.6.0/PKG-INFO +105 -0
- progpy-1.6.0/README.md +65 -0
- progpy-1.6.0/setup.cfg +4 -0
- progpy-1.6.0/setup.py +62 -0
- progpy-1.6.0/src/progpy/__init__.py +52 -0
- progpy-1.6.0/src/progpy/composite_model.py +278 -0
- progpy-1.6.0/src/progpy/data_models/__init__.py +13 -0
- progpy-1.6.0/src/progpy/data_models/data_model.py +186 -0
- progpy-1.6.0/src/progpy/data_models/dmd.py +499 -0
- progpy-1.6.0/src/progpy/data_models/lstm_model.py +700 -0
- progpy-1.6.0/src/progpy/data_models/pce.py +193 -0
- progpy-1.6.0/src/progpy/datasets/__init__.py +1 -0
- progpy-1.6.0/src/progpy/datasets/nasa_battery.py +125 -0
- progpy-1.6.0/src/progpy/datasets/nasa_cmapss.py +125 -0
- progpy-1.6.0/src/progpy/ensemble_model.py +146 -0
- progpy-1.6.0/src/progpy/exceptions.py +20 -0
- progpy-1.6.0/src/progpy/linear_model.py +235 -0
- progpy-1.6.0/src/progpy/loading/__init__.py +6 -0
- progpy-1.6.0/src/progpy/loading/controllers.py +286 -0
- progpy-1.6.0/src/progpy/loading/gaussian_wrapper.py +62 -0
- progpy-1.6.0/src/progpy/loading/moving_average.py +60 -0
- progpy-1.6.0/src/progpy/loading/piecewise.py +64 -0
- progpy-1.6.0/src/progpy/metrics/__init__.py +8 -0
- progpy-1.6.0/src/progpy/metrics/samples.py +42 -0
- progpy-1.6.0/src/progpy/metrics/toe_metrics.py +75 -0
- progpy-1.6.0/src/progpy/metrics/toe_profile_metrics.py +140 -0
- progpy-1.6.0/src/progpy/metrics/uncertain_data_metrics.py +115 -0
- progpy-1.6.0/src/progpy/mixture_of_experts.py +292 -0
- progpy-1.6.0/src/progpy/models/__init__.py +13 -0
- progpy-1.6.0/src/progpy/models/aircraft_model/__init__.py +5 -0
- progpy-1.6.0/src/progpy/models/aircraft_model/aircraft.py +13 -0
- progpy-1.6.0/src/progpy/models/aircraft_model/small_rotorcraft.py +375 -0
- progpy-1.6.0/src/progpy/models/aircraft_model/vehicles/__init__.py +2 -0
- progpy-1.6.0/src/progpy/models/aircraft_model/vehicles/aero/__init__.py +2 -0
- progpy-1.6.0/src/progpy/models/aircraft_model/vehicles/aero/aerodynamics.py +44 -0
- progpy-1.6.0/src/progpy/models/aircraft_model/vehicles/control/__init__.py +2 -0
- progpy-1.6.0/src/progpy/models/aircraft_model/vehicles/control/allocation_functions.py +55 -0
- progpy-1.6.0/src/progpy/models/aircraft_model/vehicles/vehicles.py +233 -0
- progpy-1.6.0/src/progpy/models/battery_circuit.py +212 -0
- progpy-1.6.0/src/progpy/models/battery_electrochem.py +728 -0
- progpy-1.6.0/src/progpy/models/centrifugal_pump.py +348 -0
- progpy-1.6.0/src/progpy/models/dcmotor.py +200 -0
- progpy-1.6.0/src/progpy/models/dcmotor_singlephase.py +172 -0
- progpy-1.6.0/src/progpy/models/esc.py +112 -0
- progpy-1.6.0/src/progpy/models/experimental/__init__.py +2 -0
- progpy-1.6.0/src/progpy/models/experimental/paris_law.py +93 -0
- progpy-1.6.0/src/progpy/models/pneumatic_valve.py +447 -0
- progpy-1.6.0/src/progpy/models/powertrain.py +147 -0
- progpy-1.6.0/src/progpy/models/propeller_load.py +64 -0
- progpy-1.6.0/src/progpy/models/test_models/__init__.py +3 -0
- progpy-1.6.0/src/progpy/models/test_models/linear_models.py +191 -0
- progpy-1.6.0/src/progpy/models/test_models/linear_thrown_object.py +131 -0
- progpy-1.6.0/src/progpy/models/test_models/other_models.py +84 -0
- progpy-1.6.0/src/progpy/models/thrown_object.py +156 -0
- progpy-1.6.0/src/progpy/predictors/__init__.py +16 -0
- progpy-1.6.0/src/progpy/predictors/monte_carlo.py +219 -0
- progpy-1.6.0/src/progpy/predictors/prediction.py +163 -0
- progpy-1.6.0/src/progpy/predictors/predictor.py +67 -0
- progpy-1.6.0/src/progpy/predictors/toe_prediction_profile.py +189 -0
- progpy-1.6.0/src/progpy/predictors/unscented_transform.py +286 -0
- progpy-1.6.0/src/progpy/prognostics_model.py +1519 -0
- progpy-1.6.0/src/progpy/sim_result.py +472 -0
- progpy-1.6.0/src/progpy/state_estimators/__init__.py +7 -0
- progpy-1.6.0/src/progpy/state_estimators/kalman_filter.py +168 -0
- progpy-1.6.0/src/progpy/state_estimators/particle_filter.py +204 -0
- progpy-1.6.0/src/progpy/state_estimators/state_estimator.py +113 -0
- progpy-1.6.0/src/progpy/state_estimators/unscented_kalman_filter.py +137 -0
- progpy-1.6.0/src/progpy/uncertain_data/__init__.py +8 -0
- progpy-1.6.0/src/progpy/uncertain_data/multivariate_normal_dist.py +85 -0
- progpy-1.6.0/src/progpy/uncertain_data/scalar_data.py +84 -0
- progpy-1.6.0/src/progpy/uncertain_data/uncertain_data.py +283 -0
- progpy-1.6.0/src/progpy/uncertain_data/unweighted_samples.py +176 -0
- progpy-1.6.0/src/progpy/utils/__init__.py +6 -0
- progpy-1.6.0/src/progpy/utils/calc_error.py +435 -0
- progpy-1.6.0/src/progpy/utils/containers.py +234 -0
- progpy-1.6.0/src/progpy/utils/input_validation.py +22 -0
- progpy-1.6.0/src/progpy/utils/next_state.py +132 -0
- progpy-1.6.0/src/progpy/utils/noise_functions.py +77 -0
- progpy-1.6.0/src/progpy/utils/parameters.py +232 -0
- progpy-1.6.0/src/progpy/utils/progress_bar.py +23 -0
- progpy-1.6.0/src/progpy/utils/serialization.py +53 -0
- progpy-1.6.0/src/progpy/utils/size.py +83 -0
- progpy-1.6.0/src/progpy/utils/table.py +93 -0
- progpy-1.6.0/src/progpy/utils/traj_gen/__init__.py +4 -0
- progpy-1.6.0/src/progpy/utils/traj_gen/geometry.py +502 -0
- progpy-1.6.0/src/progpy/utils/traj_gen/nurbs.py +309 -0
- progpy-1.6.0/src/progpy/utils/traj_gen/trajectory.py +616 -0
- progpy-1.6.0/src/progpy/visualize/__init__.py +616 -0
- progpy-1.6.0/src/progpy/visualize/plot_hist.py +58 -0
- progpy-1.6.0/src/progpy/visualize/plot_scatter.py +94 -0
- progpy-1.6.0/src/progpy.egg-info/PKG-INFO +105 -0
- progpy-1.6.0/src/progpy.egg-info/SOURCES.txt +122 -0
- progpy-1.6.0/src/progpy.egg-info/dependency_links.txt +1 -0
- progpy-1.6.0/src/progpy.egg-info/requires.txt +13 -0
- progpy-1.6.0/src/progpy.egg-info/top_level.txt +1 -0
- progpy-1.6.0/tests/test_base_models.py +1349 -0
- progpy-1.6.0/tests/test_battery.py +73 -0
- progpy-1.6.0/tests/test_calc_error.py +407 -0
- progpy-1.6.0/tests/test_centrifugal_pump.py +270 -0
- progpy-1.6.0/tests/test_composite.py +244 -0
- progpy-1.6.0/tests/test_data_model.py +330 -0
- progpy-1.6.0/tests/test_datasets.py +50 -0
- progpy-1.6.0/tests/test_dict_like_matrix_wrapper.py +114 -0
- progpy-1.6.0/tests/test_direct.py +121 -0
- progpy-1.6.0/tests/test_ensemble.py +252 -0
- progpy-1.6.0/tests/test_estimate_params.py +1073 -0
- progpy-1.6.0/tests/test_examples.py +52 -0
- progpy-1.6.0/tests/test_horizon.py +78 -0
- progpy-1.6.0/tests/test_linear_model.py +494 -0
- progpy-1.6.0/tests/test_loading.py +97 -0
- progpy-1.6.0/tests/test_manual.py +108 -0
- progpy-1.6.0/tests/test_metrics.py +523 -0
- progpy-1.6.0/tests/test_moe.py +133 -0
- progpy-1.6.0/tests/test_pneumatic_valve.py +468 -0
- progpy-1.6.0/tests/test_powertrain.py +78 -0
- progpy-1.6.0/tests/test_predictors.py +442 -0
- progpy-1.6.0/tests/test_serialization.py +112 -0
- progpy-1.6.0/tests/test_sim_result.py +805 -0
- progpy-1.6.0/tests/test_state_estimators.py +590 -0
- progpy-1.6.0/tests/test_surrogates.py +605 -0
- progpy-1.6.0/tests/test_tutorials.py +31 -0
- progpy-1.6.0/tests/test_uav_model.py +290 -0
- progpy-1.6.0/tests/test_uncertain_data.py +573 -0
- progpy-1.6.0/tests/test_visualize.py +55 -0
progpy-1.6.0/PKG-INFO
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: progpy
|
|
3
|
+
Version: 1.6.0
|
|
4
|
+
Summary: The NASA Prognostic Package (ProgPy) is a python prognostics framework focused on building, using, and evaluating models and algorithms for prognostics (computation of remaining useful life) and health management of engineering systems, and provides a set of prognostics models for select components and prognostics algorithms developed within this framework, including uncertainty propagation.
|
|
5
|
+
Home-page: https://nasa.github.io/progpy/
|
|
6
|
+
Author: Christopher Teubert
|
|
7
|
+
Author-email: christopher.a.teubert@nasa.gov
|
|
8
|
+
License: NOSA
|
|
9
|
+
Project-URL: Bug Reports, https://github.com/nasa/progpy/issues
|
|
10
|
+
Project-URL: Docs, https://nasa.github.io/progpy/
|
|
11
|
+
Project-URL: Organization, https://www.nasa.gov/content/diagnostics-prognostics
|
|
12
|
+
Project-URL: Source, https://github.com/nasa/progpy
|
|
13
|
+
Keywords: prognostics,diagnostics,fault detection,fdir,physics modeling,prognostics and health management,PHM,health management,surrogate modeling,model tuning,simulation,ivhm
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Manufacturing
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
21
|
+
Classifier: License :: Other/Proprietary License
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
28
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
29
|
+
Requires-Python: >=3.7, <3.12
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
Requires-Dist: scipy
|
|
32
|
+
Requires-Dist: pandas
|
|
33
|
+
Requires-Dist: matplotlib
|
|
34
|
+
Requires-Dist: requests
|
|
35
|
+
Requires-Dist: chaospy
|
|
36
|
+
Requires-Dist: fastdtw
|
|
37
|
+
Requires-Dist: tensorflow; platform_system != "Darwin" or platform_machine != "arm64"
|
|
38
|
+
Requires-Dist: tensorflow-macos; platform_system == "Darwin" and platform_machine == "arm64"
|
|
39
|
+
Requires-Dist: filterpy
|
|
40
|
+
|
|
41
|
+
# Prognostics Python Package (ProgPy)
|
|
42
|
+
[](https://www.codefactor.io/repository/github/nasa/progpy)
|
|
43
|
+
[](https://github.com/nasa/progpy/blob/master/license.pdf)
|
|
44
|
+
[](https://github.com/nasa/progpy/releases)
|
|
45
|
+
[](https://mybinder.org/v2/gh/nasa/progpy/HEAD?tutorial.ipynb)
|
|
46
|
+
|
|
47
|
+
The NASA Prognostic Package (ProgPy) is a python prognostics framework focused on building, using, and evaluating models and algorithms for prognostics (computation of remaining useful life) and health management of engineering systems, and provides a set of prognostics models for select components and prognostics algorithms developed within this framework, suitable for use in prognostics for these components. It also includes algorithms for state estimation and prediction, including uncertainty propagation.
|
|
48
|
+
|
|
49
|
+
ProgPy combines NASAs prog_models and prog_algs packages into a single python package, for simplicity and clarity.
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
`pip3 install progpy`
|
|
53
|
+
|
|
54
|
+
## [Documentation](https://nasa.github.io/progpy/)
|
|
55
|
+
See documentation [here](https://nasa.github.io/progpy/)
|
|
56
|
+
|
|
57
|
+
## Repository Directory Structure
|
|
58
|
+
Here is the directory structure for the github repository
|
|
59
|
+
|
|
60
|
+
`src/progpy/` - The prognostics python package<br />
|
|
61
|
+
`examples/` - Example Python scripts using progpy<br />
|
|
62
|
+
`tests/` - Tests for progpy<br />
|
|
63
|
+
`README.md` - The readme (this file)<br />
|
|
64
|
+
`prog_model_template.py` - Template for Prognostics Model<br />
|
|
65
|
+
`state_estimator_template.py` - Template for State Estimators<br />
|
|
66
|
+
`predictor_template.py` - Template for Predictor<br />
|
|
67
|
+
`tutorial.ipynb` - Tutorial (Juypter Notebook)
|
|
68
|
+
|
|
69
|
+
## Citing this repository
|
|
70
|
+
Use the following to cite this repository:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
@misc{2023_nasa_progpy,
|
|
74
|
+
| author = {Christopher Teubert and Katelyn Jarvis Griffith and Matteo Corbetta and Chetan Kulkarni and Portia Banerjee and Matthew Daigle},
|
|
75
|
+
| title = {{ProgPy Python Prognostics Packages}},
|
|
76
|
+
| month = Oct,
|
|
77
|
+
| year = 2023,
|
|
78
|
+
| version = {1.6},
|
|
79
|
+
| url = {https://nasa.github.io/progpy}
|
|
80
|
+
| doi = {10.5281/ZENODO.8097013}
|
|
81
|
+
| }
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The corresponding reference should look like this:
|
|
85
|
+
|
|
86
|
+
C. Teubert, K. Jarvis Griffith, M. Corbetta, C. Kulkarni, P. Banerjee, M. Daigle, ProgPy Python Prognostics Packages, v1.6, Oct 2023. URL https://github.com/nasa/progpy.
|
|
87
|
+
|
|
88
|
+
## Contributing Organizations
|
|
89
|
+
ProgPy was created by a partnership of multiple organizations, working together to build a set of high-quality prognostic tools for the wider PHM Community. We would like to give a big thank you for the ProgPy community, especially the following contributing organizations:
|
|
90
|
+
|
|
91
|
+
* [NASA's Diagnostics and Prognostics Group](https://www.nasa.gov/content/diagnostics-prognostics)
|
|
92
|
+
* German Aerospace Center (DLR)
|
|
93
|
+
* Northrop Grumman Corporation (NGC)
|
|
94
|
+
* Vanderbilt University
|
|
95
|
+
|
|
96
|
+
## Acknowledgements
|
|
97
|
+
The structure and algorithms of this package are strongly inspired by the [MATLAB Prognostics Model Library](https://github.com/nasa/PrognosticsModelLibrary), [MATLAB Prognostics Algorithm Library](https://github.com/nasa/PrognosticsAlgorithmLibrary), and the [MATLAB Prognostics Metrics Library](https://github.com/nasa/PrognosticsMetricsLibrary). We would like to recognize Matthew Daigle and the rest of the team that contributed to the Prognostics Models, Algorithms, and Metrics Libraries for the contributions their work on the MATLAB library made to the design of progpy.
|
|
98
|
+
|
|
99
|
+
## Notices
|
|
100
|
+
Copyright © 2021 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved.
|
|
101
|
+
|
|
102
|
+
## Disclaimers
|
|
103
|
+
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT "AS IS."
|
|
104
|
+
|
|
105
|
+
Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.
|
progpy-1.6.0/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Prognostics Python Package (ProgPy)
|
|
2
|
+
[](https://www.codefactor.io/repository/github/nasa/progpy)
|
|
3
|
+
[](https://github.com/nasa/progpy/blob/master/license.pdf)
|
|
4
|
+
[](https://github.com/nasa/progpy/releases)
|
|
5
|
+
[](https://mybinder.org/v2/gh/nasa/progpy/HEAD?tutorial.ipynb)
|
|
6
|
+
|
|
7
|
+
The NASA Prognostic Package (ProgPy) is a python prognostics framework focused on building, using, and evaluating models and algorithms for prognostics (computation of remaining useful life) and health management of engineering systems, and provides a set of prognostics models for select components and prognostics algorithms developed within this framework, suitable for use in prognostics for these components. It also includes algorithms for state estimation and prediction, including uncertainty propagation.
|
|
8
|
+
|
|
9
|
+
ProgPy combines NASAs prog_models and prog_algs packages into a single python package, for simplicity and clarity.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
`pip3 install progpy`
|
|
13
|
+
|
|
14
|
+
## [Documentation](https://nasa.github.io/progpy/)
|
|
15
|
+
See documentation [here](https://nasa.github.io/progpy/)
|
|
16
|
+
|
|
17
|
+
## Repository Directory Structure
|
|
18
|
+
Here is the directory structure for the github repository
|
|
19
|
+
|
|
20
|
+
`src/progpy/` - The prognostics python package<br />
|
|
21
|
+
`examples/` - Example Python scripts using progpy<br />
|
|
22
|
+
`tests/` - Tests for progpy<br />
|
|
23
|
+
`README.md` - The readme (this file)<br />
|
|
24
|
+
`prog_model_template.py` - Template for Prognostics Model<br />
|
|
25
|
+
`state_estimator_template.py` - Template for State Estimators<br />
|
|
26
|
+
`predictor_template.py` - Template for Predictor<br />
|
|
27
|
+
`tutorial.ipynb` - Tutorial (Juypter Notebook)
|
|
28
|
+
|
|
29
|
+
## Citing this repository
|
|
30
|
+
Use the following to cite this repository:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
@misc{2023_nasa_progpy,
|
|
34
|
+
| author = {Christopher Teubert and Katelyn Jarvis Griffith and Matteo Corbetta and Chetan Kulkarni and Portia Banerjee and Matthew Daigle},
|
|
35
|
+
| title = {{ProgPy Python Prognostics Packages}},
|
|
36
|
+
| month = Oct,
|
|
37
|
+
| year = 2023,
|
|
38
|
+
| version = {1.6},
|
|
39
|
+
| url = {https://nasa.github.io/progpy}
|
|
40
|
+
| doi = {10.5281/ZENODO.8097013}
|
|
41
|
+
| }
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The corresponding reference should look like this:
|
|
45
|
+
|
|
46
|
+
C. Teubert, K. Jarvis Griffith, M. Corbetta, C. Kulkarni, P. Banerjee, M. Daigle, ProgPy Python Prognostics Packages, v1.6, Oct 2023. URL https://github.com/nasa/progpy.
|
|
47
|
+
|
|
48
|
+
## Contributing Organizations
|
|
49
|
+
ProgPy was created by a partnership of multiple organizations, working together to build a set of high-quality prognostic tools for the wider PHM Community. We would like to give a big thank you for the ProgPy community, especially the following contributing organizations:
|
|
50
|
+
|
|
51
|
+
* [NASA's Diagnostics and Prognostics Group](https://www.nasa.gov/content/diagnostics-prognostics)
|
|
52
|
+
* German Aerospace Center (DLR)
|
|
53
|
+
* Northrop Grumman Corporation (NGC)
|
|
54
|
+
* Vanderbilt University
|
|
55
|
+
|
|
56
|
+
## Acknowledgements
|
|
57
|
+
The structure and algorithms of this package are strongly inspired by the [MATLAB Prognostics Model Library](https://github.com/nasa/PrognosticsModelLibrary), [MATLAB Prognostics Algorithm Library](https://github.com/nasa/PrognosticsAlgorithmLibrary), and the [MATLAB Prognostics Metrics Library](https://github.com/nasa/PrognosticsMetricsLibrary). We would like to recognize Matthew Daigle and the rest of the team that contributed to the Prognostics Models, Algorithms, and Metrics Libraries for the contributions their work on the MATLAB library made to the design of progpy.
|
|
58
|
+
|
|
59
|
+
## Notices
|
|
60
|
+
Copyright © 2021 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved.
|
|
61
|
+
|
|
62
|
+
## Disclaimers
|
|
63
|
+
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT "AS IS."
|
|
64
|
+
|
|
65
|
+
Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.
|
progpy-1.6.0/setup.cfg
ADDED
progpy-1.6.0/setup.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Copyright © 2021 United States Government as represented by the Administrator of the
|
|
2
|
+
# National Aeronautics and Space Administration. All Rights Reserved.
|
|
3
|
+
|
|
4
|
+
from setuptools import setup, find_packages
|
|
5
|
+
import pathlib
|
|
6
|
+
|
|
7
|
+
here = pathlib.Path(__file__).parent.resolve()
|
|
8
|
+
|
|
9
|
+
# Get the long description from the README file
|
|
10
|
+
long_description = (here / 'README.md').read_text(encoding='utf-8')
|
|
11
|
+
|
|
12
|
+
INSTALL_REQS = [
|
|
13
|
+
'scipy',
|
|
14
|
+
'pandas', # For data downloading features
|
|
15
|
+
'matplotlib',
|
|
16
|
+
'requests', # For data downloading features
|
|
17
|
+
'chaospy', # For PCE
|
|
18
|
+
'fastdtw', # For DTW error calculation
|
|
19
|
+
"tensorflow; platform_system!='Darwin' or platform_machine!='arm64'",
|
|
20
|
+
"tensorflow-macos; platform_system=='Darwin' and platform_machine=='arm64'",
|
|
21
|
+
"filterpy",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
setup(
|
|
25
|
+
name='progpy',
|
|
26
|
+
version='1.6.0',
|
|
27
|
+
description='The NASA Prognostic Package (ProgPy) is a python prognostics framework focused on building, using, and evaluating models and algorithms for prognostics (computation of remaining useful life) and health management of engineering systems, and provides a set of prognostics models for select components and prognostics algorithms developed within this framework, including uncertainty propagation.',
|
|
28
|
+
long_description=long_description,
|
|
29
|
+
long_description_content_type='text/markdown',
|
|
30
|
+
url='https://nasa.github.io/progpy/',
|
|
31
|
+
author='Christopher Teubert',
|
|
32
|
+
author_email='christopher.a.teubert@nasa.gov',
|
|
33
|
+
classifiers=[
|
|
34
|
+
'Development Status :: 5 - Production/Stable',
|
|
35
|
+
'Intended Audience :: Science/Research',
|
|
36
|
+
'Intended Audience :: Developers',
|
|
37
|
+
'Intended Audience :: Manufacturing',
|
|
38
|
+
'Topic :: Scientific/Engineering',
|
|
39
|
+
'Topic :: Scientific/Engineering :: Artificial Intelligence',
|
|
40
|
+
'Topic :: Scientific/Engineering :: Physics',
|
|
41
|
+
'License :: Other/Proprietary License ',
|
|
42
|
+
'Programming Language :: Python :: 3',
|
|
43
|
+
'Programming Language :: Python :: 3.7',
|
|
44
|
+
'Programming Language :: Python :: 3.8',
|
|
45
|
+
'Programming Language :: Python :: 3.9',
|
|
46
|
+
'Programming Language :: Python :: 3.10',
|
|
47
|
+
'Programming Language :: Python :: 3.11',
|
|
48
|
+
'Programming Language :: Python :: 3 :: Only'
|
|
49
|
+
],
|
|
50
|
+
keywords=['prognostics', 'diagnostics', 'fault detection', 'fdir', 'physics modeling', 'prognostics and health management', 'PHM', 'health management', 'surrogate modeling', 'model tuning', 'simulation', 'ivhm'],
|
|
51
|
+
package_dir={"": "src"},
|
|
52
|
+
packages=find_packages(where='src'),
|
|
53
|
+
python_requires='>=3.7, <3.12',
|
|
54
|
+
install_requires=INSTALL_REQS,
|
|
55
|
+
license='NOSA',
|
|
56
|
+
project_urls={ # Optional
|
|
57
|
+
'Bug Reports': 'https://github.com/nasa/progpy/issues',
|
|
58
|
+
'Docs': 'https://nasa.github.io/progpy/',
|
|
59
|
+
'Organization': 'https://www.nasa.gov/content/diagnostics-prognostics',
|
|
60
|
+
'Source': 'https://github.com/nasa/progpy',
|
|
61
|
+
},
|
|
62
|
+
)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Copyright © 2021 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved.
|
|
2
|
+
|
|
3
|
+
__all__ = ['predictors', 'uncertain_data', 'state_estimators', 'run_prog_playback', 'metrics']
|
|
4
|
+
|
|
5
|
+
from progpy.prognostics_model import PrognosticsModel
|
|
6
|
+
from progpy.ensemble_model import EnsembleModel
|
|
7
|
+
from progpy.composite_model import CompositeModel
|
|
8
|
+
from progpy.mixture_of_experts import MixtureOfExpertsModel
|
|
9
|
+
from progpy.linear_model import LinearModel
|
|
10
|
+
from progpy import predictors, state_estimators, uncertain_data
|
|
11
|
+
|
|
12
|
+
import warnings
|
|
13
|
+
|
|
14
|
+
__version__ = '1.6.0'
|
|
15
|
+
|
|
16
|
+
def run_prog_playback(obs, pred, future_loading, output_measurements, **kwargs):
|
|
17
|
+
warnings.warn("Depreciated in 1.2.0, will be removed in a future release.", DeprecationWarning)
|
|
18
|
+
config = {# Defaults
|
|
19
|
+
'predict_rate': 0, # Default- predict every step
|
|
20
|
+
'num_samples': 10,
|
|
21
|
+
'predict_config': {}
|
|
22
|
+
}
|
|
23
|
+
config.update(kwargs)
|
|
24
|
+
|
|
25
|
+
next_predict = output_measurements[0][0] + config['predict_rate']
|
|
26
|
+
times = []
|
|
27
|
+
inputs = []
|
|
28
|
+
states = []
|
|
29
|
+
outputs = []
|
|
30
|
+
event_states = []
|
|
31
|
+
toes = []
|
|
32
|
+
index = 0
|
|
33
|
+
for (t, measurement) in output_measurements:
|
|
34
|
+
obs.estimate(t, future_loading(t), measurement)
|
|
35
|
+
if t >= next_predict:
|
|
36
|
+
pred_results = pred.predict(obs.x.sample(config['num_samples']), future_loading, **config['predict_config'])
|
|
37
|
+
times.append(pred_results.times)
|
|
38
|
+
inputs.append(pred_results.inputs)
|
|
39
|
+
states.append(pred_results.states)
|
|
40
|
+
outputs.append(pred_results.outputs)
|
|
41
|
+
event_states.append(pred_results.event_states)
|
|
42
|
+
toes.append(pred_results.time_of_event)
|
|
43
|
+
index += 1
|
|
44
|
+
next_predict += config['predict_rate']
|
|
45
|
+
return predictors.PredictionResults(
|
|
46
|
+
times,
|
|
47
|
+
inputs,
|
|
48
|
+
states,
|
|
49
|
+
outputs,
|
|
50
|
+
event_states,
|
|
51
|
+
toes
|
|
52
|
+
)
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# Copyright © 2021 United States Government as represented by the Administrator of the
|
|
2
|
+
# National Aeronautics and Space Administration. All Rights Reserved.
|
|
3
|
+
|
|
4
|
+
from collections.abc import Iterable
|
|
5
|
+
|
|
6
|
+
from progpy import PrognosticsModel
|
|
7
|
+
|
|
8
|
+
DIVIDER = '.'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CompositeModel(PrognosticsModel):
|
|
12
|
+
"""
|
|
13
|
+
.. versionadded:: 1.5.0
|
|
14
|
+
|
|
15
|
+
A CompositeModel is a PrognosticsModel that is composed of multiple PrognosticsModels. This is a tool for modeling system-of-systems. I.e., interconnected systems, where the behavior and state of one system effects the state of another system. The composite prognostics models are connected using defined connections between the output or state of one model, and the input of another model. The resulting CompositeModel behaves as a single model.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
models (list[PrognosticsModel] or list[tuple[str, PrognosticsModel]]):
|
|
19
|
+
A list of PrognosticsModels to be combined into a single model.
|
|
20
|
+
Provided in one of two forms:
|
|
21
|
+
|
|
22
|
+
1. A list of PrognosticsModels. The name of each model will be the class name. A number will be added for duplicates
|
|
23
|
+
|
|
24
|
+
2. A list of tuples where the first element is the model name and the second element is the model
|
|
25
|
+
|
|
26
|
+
Note: Order provided will be the order that models are executed
|
|
27
|
+
connections (list[tuple[str, str]], optional):
|
|
28
|
+
A list of tuples where the first element is the name of the output, state, or performance metrics of one model and the second element is the name of the input of another model.
|
|
29
|
+
The first element of the tuple must be of the form "model_name.output_name", "model_name.state_name", or "model_name.performance_metric_key".
|
|
30
|
+
The second element of the tuple must be of the form "model_name.input_name".
|
|
31
|
+
For example, if you have two models, "Batt1" and "Batt2", and you want to connect the output of "Batt1" to the input of "Batt2", you would use the following connection: ("Batt1.output", "Batt2.input")
|
|
32
|
+
|
|
33
|
+
Keyword Args:
|
|
34
|
+
outputs (list[str]):
|
|
35
|
+
Model outputs in format "model_name.output_name". Must be subset of all outputs from models. If not provided, all outputs will be included.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def __init__(self, models: list, connections: list = [], **kwargs):
|
|
39
|
+
# General Input Validation
|
|
40
|
+
if not isinstance(models, Iterable):
|
|
41
|
+
raise ValueError('The models argument must be a list')
|
|
42
|
+
if len(models) <= 1:
|
|
43
|
+
raise ValueError('The models argument must contain at least two models')
|
|
44
|
+
if not isinstance(connections, Iterable):
|
|
45
|
+
raise ValueError('The connections argument must be a list')
|
|
46
|
+
|
|
47
|
+
# Initialize
|
|
48
|
+
self.inputs = set()
|
|
49
|
+
self.states = set()
|
|
50
|
+
self.outputs = set()
|
|
51
|
+
self.events = set()
|
|
52
|
+
self.performance_metric_keys = set()
|
|
53
|
+
self.model_names = set()
|
|
54
|
+
duplicate_names = {}
|
|
55
|
+
kwargs['models'] = []
|
|
56
|
+
|
|
57
|
+
# Handle models
|
|
58
|
+
for m in models:
|
|
59
|
+
if isinstance(m, Iterable):
|
|
60
|
+
if len(m) != 2:
|
|
61
|
+
raise ValueError('Each model tuple must be of the form (name: str, model). For example ("Batt1", BatteryElectroChem())')
|
|
62
|
+
if not isinstance(m[0], str):
|
|
63
|
+
raise ValueError('The first element of each model tuple must be a string')
|
|
64
|
+
if not isinstance(m[1], PrognosticsModel):
|
|
65
|
+
raise ValueError('The second element of each model tuple must be a PrognosticsModel')
|
|
66
|
+
if m[0] in self.model_names:
|
|
67
|
+
duplicate_names[m[0]] = duplicate_names.get(m[0], 1) + 1
|
|
68
|
+
m = (m[0] + '_' + str(duplicate_names[m[0]]), m[1])
|
|
69
|
+
self.model_names.add(m[0])
|
|
70
|
+
kwargs['models'].append(m)
|
|
71
|
+
elif isinstance(m, PrognosticsModel):
|
|
72
|
+
m = (m.__class__.__name__, m)
|
|
73
|
+
if m[0] in self.model_names:
|
|
74
|
+
duplicate_names[m[0]] = duplicate_names.get(m[0], 1) + 1
|
|
75
|
+
m = (m[0] + '_' + str(duplicate_names[m[0]]), m[1])
|
|
76
|
+
self.model_names.add(m[0])
|
|
77
|
+
kwargs['models'].append(m)
|
|
78
|
+
else:
|
|
79
|
+
raise ValueError(f'Each model must be a PrognosticsModel or tuple (name: str, PrognosticsModel), was {type(m)}')
|
|
80
|
+
|
|
81
|
+
for (name, m) in kwargs['models']:
|
|
82
|
+
self.inputs |= set([name + DIVIDER + u for u in m.inputs])
|
|
83
|
+
self.states |= set([name + DIVIDER + x for x in m.states])
|
|
84
|
+
self.outputs |= set([name + DIVIDER + z for z in m.outputs])
|
|
85
|
+
self.events |= set([name + DIVIDER + e for e in m.events])
|
|
86
|
+
self.performance_metric_keys |= set([name + DIVIDER + p for p in m.performance_metric_keys])
|
|
87
|
+
|
|
88
|
+
# Handle outputs
|
|
89
|
+
if 'outputs' in kwargs:
|
|
90
|
+
if isinstance(kwargs['outputs'], str):
|
|
91
|
+
kwargs['outputs'] = [kwargs['outputs']]
|
|
92
|
+
if not isinstance(kwargs['outputs'], Iterable):
|
|
93
|
+
raise ValueError('The outputs argument must be a list[str]')
|
|
94
|
+
if not set(kwargs['outputs']).issubset(self.outputs):
|
|
95
|
+
raise ValueError('The outputs of the composite model must be a subset of the outputs of the models')
|
|
96
|
+
self.outputs = kwargs['outputs']
|
|
97
|
+
|
|
98
|
+
# Handle Connections
|
|
99
|
+
kwargs['connections'] = []
|
|
100
|
+
self.__to_input_connections = {m_name: [] for m_name in self.model_names}
|
|
101
|
+
self.__to_state_connections = {m_name: [] for m_name in self.model_names}
|
|
102
|
+
self.__to_state_from_pm_connections = {m_name: [] for m_name in self.model_names}
|
|
103
|
+
|
|
104
|
+
for connection in connections:
|
|
105
|
+
# Input validation
|
|
106
|
+
if not isinstance(connection, Iterable) or len(connection) != 2:
|
|
107
|
+
raise ValueError('Each connection must be a tuple of the form (input: str, output: str)')
|
|
108
|
+
if not isinstance(connection[0], str) or not isinstance(connection[1], str):
|
|
109
|
+
raise ValueError('Each connection must be a tuple of the form (input: str, output: str)')
|
|
110
|
+
|
|
111
|
+
in_key, out_key = connection
|
|
112
|
+
# Validation
|
|
113
|
+
if out_key not in self.inputs:
|
|
114
|
+
raise ValueError(f'The output key, {out_key}, must be an input to one of the composite models. Options include {self.inputs}')
|
|
115
|
+
|
|
116
|
+
# Remove the out_key from inputs
|
|
117
|
+
# These no longer are an input to the composite model
|
|
118
|
+
# as they are now satisfied internally
|
|
119
|
+
self.inputs.remove(out_key)
|
|
120
|
+
|
|
121
|
+
# Split the keys into parts (model, key_part)
|
|
122
|
+
(in_model, in_key_part) = in_key.split('.')
|
|
123
|
+
(out_model, out_key_part) = out_key.split('.')
|
|
124
|
+
|
|
125
|
+
# Validate parts
|
|
126
|
+
if in_model == out_model:
|
|
127
|
+
raise ValueError('The input and output models must be different')
|
|
128
|
+
if in_model not in self.model_names:
|
|
129
|
+
raise ValueError('The input model must be one of the models in the composite model')
|
|
130
|
+
if out_model not in self.model_names:
|
|
131
|
+
raise ValueError('The output model must be one of the models in the composite model')
|
|
132
|
+
|
|
133
|
+
# Add to connections
|
|
134
|
+
if in_key in self.states:
|
|
135
|
+
self.__to_input_connections[out_model].append((in_key, out_key_part))
|
|
136
|
+
elif in_key in self.outputs:
|
|
137
|
+
# In output
|
|
138
|
+
self.__to_input_connections[out_model].append((in_key, out_key_part))
|
|
139
|
+
|
|
140
|
+
# Add to state (to preserve last between runs)
|
|
141
|
+
self.__to_state_connections[in_model].append((in_key_part, in_key))
|
|
142
|
+
self.states.add(in_key)
|
|
143
|
+
elif in_key in self.performance_metric_keys:
|
|
144
|
+
# In performance metric
|
|
145
|
+
self.__to_input_connections[out_model].append((in_key, out_key_part))
|
|
146
|
+
|
|
147
|
+
# Add to state (to preserve last between runs)
|
|
148
|
+
self.__to_state_from_pm_connections[out_model].append((in_key_part, in_key))
|
|
149
|
+
self.states.add(in_key)
|
|
150
|
+
else:
|
|
151
|
+
raise ValueError('The input key must be an output or state of one of the composite models')
|
|
152
|
+
|
|
153
|
+
# Finish initialization
|
|
154
|
+
super().__init__(**kwargs)
|
|
155
|
+
|
|
156
|
+
def initialize(self, u={}, z={}):
|
|
157
|
+
if u is None:
|
|
158
|
+
u = {}
|
|
159
|
+
if z is None:
|
|
160
|
+
z = {}
|
|
161
|
+
|
|
162
|
+
x_0 = {}
|
|
163
|
+
# Initialize the models
|
|
164
|
+
for (name, m) in self.parameters['models']:
|
|
165
|
+
u_i = {key: u.get(name + '.' + key, None) for key in m.inputs}
|
|
166
|
+
z_i = {key: z.get(name + '.' + key, None) for key in m.outputs}
|
|
167
|
+
x_i = m.initialize(u_i, z_i)
|
|
168
|
+
for key, value in x_i.items():
|
|
169
|
+
x_0[name + '.' + key] = value
|
|
170
|
+
|
|
171
|
+
# Process connections
|
|
172
|
+
# This initializes the states that are connected to outputs
|
|
173
|
+
for (in_key_part, in_key) in self.__to_state_connections[name]:
|
|
174
|
+
if in_key in z.keys():
|
|
175
|
+
x_0[in_key] = z[in_key]
|
|
176
|
+
else: # Missing from z, so estimate using initial state
|
|
177
|
+
z_ii = m.output(x_i)
|
|
178
|
+
x_0[in_key] = z_ii.get(in_key_part, None)
|
|
179
|
+
|
|
180
|
+
# This initializes the states that are connected to performance metrics
|
|
181
|
+
for (in_key_part, in_key) in self.__to_state_from_pm_connections[name]:
|
|
182
|
+
pm = m.performance_metrics(x_i)
|
|
183
|
+
x_0[in_key] = pm.get(in_key_part, None)
|
|
184
|
+
|
|
185
|
+
return self.StateContainer(x_0)
|
|
186
|
+
|
|
187
|
+
def next_state(self, x, u, dt):
|
|
188
|
+
for (name, m) in self.parameters['models']:
|
|
189
|
+
# Prepare inputs
|
|
190
|
+
u_i = {key: u.get(name + '.' + key, None) for key in m.inputs}
|
|
191
|
+
# Process connections
|
|
192
|
+
# This updates the inputs that are connected to states/outputs
|
|
193
|
+
for (in_key, out_key_part) in self.__to_input_connections[name]:
|
|
194
|
+
u_i[out_key_part] = x[in_key]
|
|
195
|
+
|
|
196
|
+
u_i = m.InputContainer(u_i)
|
|
197
|
+
|
|
198
|
+
# Prepare state
|
|
199
|
+
x_i = m.StateContainer({key: x[name + '.' + key] for key in m.states})
|
|
200
|
+
|
|
201
|
+
# Propagate state
|
|
202
|
+
x_next_i = m.next_state(x_i, u_i, dt)
|
|
203
|
+
|
|
204
|
+
# Save to super state
|
|
205
|
+
for key, value in x_next_i.items():
|
|
206
|
+
x[name + '.' + key] = value
|
|
207
|
+
|
|
208
|
+
# Process connections
|
|
209
|
+
# This updates the states that are connected to outputs
|
|
210
|
+
if len(self.__to_state_connections[name]) > 0:
|
|
211
|
+
# From Outputs
|
|
212
|
+
z_i = m.output(x_next_i)
|
|
213
|
+
for (in_key_part, in_key) in self.__to_state_connections[name]:
|
|
214
|
+
x[in_key] = z_i.get(in_key_part, None)
|
|
215
|
+
|
|
216
|
+
if len(self.__to_state_from_pm_connections) > 0:
|
|
217
|
+
# From Performance Metrics
|
|
218
|
+
pm_i = m.performance_metrics(x_next_i)
|
|
219
|
+
for (in_key_part, in_key) in self.__to_state_from_pm_connections[name]:
|
|
220
|
+
x[in_key] = pm_i.get(in_key_part, None)
|
|
221
|
+
|
|
222
|
+
return x
|
|
223
|
+
|
|
224
|
+
def output(self, x):
|
|
225
|
+
z = {}
|
|
226
|
+
for (name, m) in self.parameters['models']:
|
|
227
|
+
# Prepare state
|
|
228
|
+
x_i = m.StateContainer({key: x[name + '.' + key] for key in m.states})
|
|
229
|
+
|
|
230
|
+
# Get outputs
|
|
231
|
+
z_i = m.output(x_i)
|
|
232
|
+
|
|
233
|
+
# Save to super outputs
|
|
234
|
+
for key, value in z_i.items():
|
|
235
|
+
z[name + '.' + key] = value
|
|
236
|
+
return self.OutputContainer(z)
|
|
237
|
+
|
|
238
|
+
def performance_metrics(self, x):
|
|
239
|
+
metrics = {}
|
|
240
|
+
for (name, m) in self.parameters['models']:
|
|
241
|
+
# Prepare state
|
|
242
|
+
x_i = m.StateContainer({key: x[name + '.' + key] for key in m.states})
|
|
243
|
+
|
|
244
|
+
# Get outputs
|
|
245
|
+
metrics_i = m.performance_metrics(x_i)
|
|
246
|
+
|
|
247
|
+
# Save to super outputs
|
|
248
|
+
for key, value in metrics_i.items():
|
|
249
|
+
metrics[name + '.' + key] = value
|
|
250
|
+
return metrics
|
|
251
|
+
|
|
252
|
+
def event_state(self, x):
|
|
253
|
+
e = {}
|
|
254
|
+
for (name, m) in self.parameters['models']:
|
|
255
|
+
# Prepare state
|
|
256
|
+
x_i = m.StateContainer({key: x[name + '.' + key] for key in m.states})
|
|
257
|
+
|
|
258
|
+
# Get outputs
|
|
259
|
+
e_i = m.event_state(x_i)
|
|
260
|
+
|
|
261
|
+
# Save to super outputs
|
|
262
|
+
for key, value in e_i.items():
|
|
263
|
+
e[name + '.' + key] = value
|
|
264
|
+
return e
|
|
265
|
+
|
|
266
|
+
def threshold_met(self, x):
|
|
267
|
+
tm = {}
|
|
268
|
+
for (name, m) in self.parameters['models']:
|
|
269
|
+
# Prepare state
|
|
270
|
+
x_i = m.StateContainer({key: x[name + '.' + key] for key in m.states})
|
|
271
|
+
|
|
272
|
+
# Get outputs
|
|
273
|
+
tm_i = m.threshold_met(x_i)
|
|
274
|
+
|
|
275
|
+
# Save to super outputs
|
|
276
|
+
for key, value in tm_i.items():
|
|
277
|
+
tm[name + '.' + key] = value
|
|
278
|
+
return tm
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright © 2021 United States Government as represented by the Administrator of the
|
|
2
|
+
# National Aeronautics and Space Administration. All Rights Reserved.
|
|
3
|
+
|
|
4
|
+
from .data_model import DataModel
|
|
5
|
+
from .dmd import DMDModel
|
|
6
|
+
from .lstm_model import LSTMStateTransitionModel
|
|
7
|
+
from .pce import PolynomialChaosExpansion, PCE
|
|
8
|
+
|
|
9
|
+
SURROGATE_METHOD_LOOKUP = {
|
|
10
|
+
'dmd': DMDModel.from_model,
|
|
11
|
+
'lstm': LSTMStateTransitionModel.from_model,
|
|
12
|
+
'pce': PolynomialChaosExpansion.from_model,
|
|
13
|
+
}
|