Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
teubert committed Jun 29, 2023
2 parents 5bf737f + 57546c2 commit 185d146
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -102,3 +102,5 @@ cython_debug/
.DS_Store
data_test.pkl
predictor_test.pkl

.VSCodeCounter/
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -25,23 +25,23 @@ See documentation [here](https://nasa.github.io/progpy/prog_algs_guide.html)
Use the following to cite this repository:

```
@misc{2022_nasa_prog_algs,
@misc{2023_nasa_prog_algs,
author = {Christopher Teubert and Matteo Corbetta and Chetan Kulkarni},
title = {Prognostics Algorithm Python Package},
month = Dec,
year = 2022,
month = May,
year = 2023,
version = {1.5},
url = {https://github.com/nasa/prog\_algs}
}
```

The corresponding reference should look like this:

C. Teubert, M. Corbetta, C. Kulkarni, Prognostics Algorithm Python Package, v1.5, Dec 2022. URL https://github.com/nasa/prog_algs.
C. Teubert, M. Corbetta, C. Kulkarni, Prognostics Algorithm Python Package, v1.5, May 2023. URL https://github.com/nasa/prog_algs.

Alternatively, if using both prog_models and prog_algs, you can cite the combined package as

C. Teubert, C. Kulkarni, M. Corbetta, K. Jarvis, M. Daigle, ProgPy Prognostics Python Packages, v1.5, December 2022. URL https://nasa.github.io/progpy.
C. Teubert, C. Kulkarni, M. Corbetta, K. Jarvis, M. Daigle, ProgPy Prognostics Python Packages, v1.5, May 2023. URL https://nasa.github.io/progpy.

## Acknowledgements
The structure and algorithms of this package are strongly inspired by the [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, Shankar Sankararaman and the rest of the team that contributed to the Prognostics Model Library for the contributions their work on the MATLAB library made to the design of prog_algs
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions setup.py
Expand Up @@ -2,7 +2,6 @@

from setuptools import setup, find_packages
import pathlib
import pkg_resources

here = pathlib.Path(__file__).parent.resolve()

Expand All @@ -11,7 +10,7 @@

setup(
name = 'prog_algs',
version = '1.5.0.pre',
version = '1.5.0',
description = "The NASA Prognostics Algorithm Package is a framework for model-based prognostics (computation of remaining useful life) of engineering systems. It includes algorithms for state estimation and prediction, including uncertainty propagation. The algorithms use prognostic models (see prog_models) to perform estimation and prediction. The package enables rapid development of prognostics solutions for given models of components and systems. Algorithms can be swapped for comparative studies and evaluations",
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down Expand Up @@ -43,7 +42,7 @@
'scipy',
'filterpy',
'matplotlib',
'prog_models>=1.5.0.pre'
'prog_models>=1.5.0'
],
license = 'NOSA',
project_urls={ # Optional
Expand Down
2 changes: 1 addition & 1 deletion src/prog_algs/__init__.py
Expand Up @@ -5,7 +5,7 @@

import warnings

__version__ = '1.5.0.pre'
__version__ = '1.5.0'

def run_prog_playback(obs, pred, future_loading, output_measurements, **kwargs):
warnings.warn("Depreciated in 1.2.0, will be removed in a future release.", DeprecationWarning)
Expand Down
8 changes: 4 additions & 4 deletions src/prog_algs/state_estimators/kalman_filter.py
Expand Up @@ -30,10 +30,10 @@ class KalmanFilter(state_estimator.StateEstimator):
alpha (float, optional):
KF Scaling parameter. An alpha > 1 turns this into a fading memory filter.
t0 (float, optional):
Maximum timestep for prediction in seconds. By default is the difference between new and last t. Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt]
e.g., dt = 1e-2
Starting time (s)
dt (float, optional):
time step (s)
Maximum timestep for prediction in seconds. By default, the timestep dt is the difference between the last and current call of .estimate(). Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt']
e.g., dt = 1e-2
Q (list[list[float]], optional):
Kalman Process Noise Matrix
R (list[list[float]], optional):
Expand Down Expand Up @@ -116,7 +116,7 @@ def estimate(self, t: float, u, z, **kwargs):
Keyword Arguments
-----------------
dt : float, optional
Maximum timestep for prediction in seconds. By default is the difference between new and last t. Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt]
Maximum timestep for prediction in seconds. By default, the timestep dt is the difference between the last and current call of .estimate(). Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt']
e.g., dt = 1e-2
"""
assert t > self.t, "New time must be greater than previous"
Expand Down
6 changes: 3 additions & 3 deletions src/prog_algs/state_estimators/particle_filter.py
Expand Up @@ -32,7 +32,7 @@ class ParticleFilter(state_estimator.StateEstimator):
t0 (float, optional):
Starting time (s)
dt (float, optional):
Maximum timestep for prediction in seconds. By default is the difference between new and last t. Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt]
Maximum timestep for prediction in seconds. By default, the timestep dt is the difference between the last and current call of .estimate(). Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt']
e.g., dt = 1e-2
num_particles (int, optional):
Number of particles in particle filter
Expand Down Expand Up @@ -100,7 +100,7 @@ def estimate(self, t : float, u, z, dt = None):
Keyword Args
------------
dt : float, optional
Maximum timestep for prediction in seconds. By default is the difference between new and last t. Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt]
Maximum timestep for prediction in seconds. By default, the timestep dt is the difference between the last and current call of .estimate(). Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt']
e.g., dt = 1e-2
Note
Expand Down Expand Up @@ -141,7 +141,7 @@ def estimate(self, t : float, u, z, dt = None):
# Get particle measurements
zPredicted = output(self.particles)
else:
# Propogate and calculate weights
# Propagate and calculate weights
for i in range(num_particles):
t_i = self.t # Used to mark time for each particle
x = self.model.StateContainer({key: particles[key][i] for key in particles.keys()})
Expand Down
12 changes: 6 additions & 6 deletions src/prog_algs/state_estimators/state_estimator.py
Expand Up @@ -10,7 +10,7 @@ class StateEstimator(ABC):
"""
Interface class for state estimators
Abstract base class for creating state estimators that perform state estimation. Subclasses must implement this interface. Equivilant to "Observers" in NASA's Matlab Prognostics Algorithm Library
Abstract base class for creating state estimators that perform state estimation. Subclasses must implement this interface. Equivalent to "Observers" in NASA's Matlab Prognostics Algorithm Library
Args:
model (PrognosticsModel):
Expand All @@ -20,14 +20,14 @@ class StateEstimator(ABC):
Initial (starting) state, with keys defined by model.states \n
e.g., x = ScalarData({'abc': 332.1, 'def': 221.003}) given states = ['abc', 'def']
Keywork Args:
Keyword Args:
t0 (float):
Initial time at which prediction begins, e.g., 0
dt (float):
Maximum timestep for prediction in seconds. By default is the difference between new and last t. Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt]
Maximum timestep for prediction in seconds. By default, the timestep dt is the difference between the last and current call of .estimate(). Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt']
e.g., dt = 1e-2
**kwargs:
See state-estimator specific documentation for speicfic keyword arguments.
See state-estimator specific documentation for specific keyword arguments.
"""

default_parameters = {
Expand Down Expand Up @@ -91,10 +91,10 @@ def estimate(self, t: float, u, z, **kwargs) -> None:
Keyword Args
-------------
dt : float, optional
Maximum timestep for prediction in seconds. By default is the difference between new and last t. Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt]
Maximum timestep for prediction in seconds. By default, the timestep dt is the difference between the last and current call of .estimate(). Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt']
e.g., dt = 1e-2
**kwargs:
See state-estimator specific documentation for speicfic keyword arguments.
See state-estimator specific documentation for specific keyword arguments.
Note
----
Expand Down
4 changes: 2 additions & 2 deletions src/prog_algs/state_estimators/unscented_kalman_filter.py
Expand Up @@ -33,7 +33,7 @@ class UnscentedKalmanFilter(state_estimator.StateEstimator):
t0 (float, optional):
Starting time (s)
dt (float, optional):
Maximum timestep for prediction in seconds. By default is the difference between new and last t. Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt]
Maximum timestep for prediction in seconds. By default, the timestep dt is the difference between the last and current call of .estimate(). Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt']
e.g., dt = 1e-2
Q (list[list[float]], optional):
Process Noise Matrix
Expand Down Expand Up @@ -113,7 +113,7 @@ def estimate(self, t: float, u, z, **kwargs):
Keyword Args
------------
dt : float, optional
Maximum timestep for prediction in seconds. By default is the difference between new and last t. Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt]
Maximum timestep for prediction in seconds. By default, the timestep dt is the difference between the last and current call of .estimate(). Some models are unstable at larger dt. Setting a smaller dt will force the model to take smaller steps; resulting in multiple prediction steps for each estimate step. Default is the parameters['dt']
e.g., dt = 1e-2
"""
assert t > self.t, "New time must be greater than previous"
Expand Down
4 changes: 4 additions & 0 deletions test_requirements.txt
@@ -0,0 +1,4 @@
ipython>=8.10.0
ipykernel>=6.21.2
testbook>=0.4.2
.
4 changes: 2 additions & 2 deletions tutorial.ipynb
Expand Up @@ -54,7 +54,7 @@
"* `prog_algs.uncertain_data.ScalarData` - Data without uncertainty, a single value\n",
"* `prog_algs.uncertain_data.UnweightedSamples` - Data represented by a set of unweighted samples. Objects of this class can be treated like a list where samples[n] returns the nth sample (Dict)\n",
"\n",
"To begin using `UncertainData`, import the type that best portrays the data. In this simple demonstration, we import the `UnweightedSamples` data type. See <https://nasa.github.io/prog_algs> for full details on the available `UncertainData` types."
"To begin using `UncertainData`, import the type that best portrays the data. In this simple demonstration, we import the `UnweightedSamples` data type. See <https://nasa.github.io/progpy/api_ref/prog_algs/UncertainData.html> for full details on the available `UncertainData` types."
]
},
{
Expand Down Expand Up @@ -192,7 +192,7 @@
"\n",
"In `prog_algs` a State Estimator is used to estimate the system state. \n",
"\n",
"To start, import the needed packages. Here we will import the `BatteryCircuit` model and the `UnscentedKalmanFilter` state estimator. See <https://nasa.github.io/progpy/guide> for more details on the available state estimators.\n"
"To start, import the needed packages. Here we will import the `BatteryCircuit` model and the `UnscentedKalmanFilter` state estimator. See <https://nasa.github.io/progpy/api_ref/prog_algs/StateEstimator.html> for more details on the available state estimators.\n"
]
},
{
Expand Down

0 comments on commit 185d146

Please sign in to comment.