diff --git a/.gitignore b/.gitignore index 3c50e3f2..688f5636 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,5 @@ cython_debug/ .DS_Store data_test.pkl predictor_test.pkl + +.VSCodeCounter/ diff --git a/README.md b/README.md index 598d82c7..196c0530 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ 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} } @@ -37,11 +37,11 @@ Use the following to cite this repository: 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 diff --git a/Python Prognostic Algorithm Library NOSA_2021.pdf b/license.pdf similarity index 100% rename from Python Prognostic Algorithm Library NOSA_2021.pdf rename to license.pdf diff --git a/setup.py b/setup.py index f23486ad..cea3c002 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,6 @@ from setuptools import setup, find_packages import pathlib -import pkg_resources here = pathlib.Path(__file__).parent.resolve() @@ -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', @@ -43,7 +42,7 @@ 'scipy', 'filterpy', 'matplotlib', - 'prog_models>=1.5.0.pre' + 'prog_models>=1.5.0' ], license = 'NOSA', project_urls={ # Optional diff --git a/src/prog_algs/__init__.py b/src/prog_algs/__init__.py index 293ae246..dd5420db 100644 --- a/src/prog_algs/__init__.py +++ b/src/prog_algs/__init__.py @@ -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) diff --git a/src/prog_algs/state_estimators/kalman_filter.py b/src/prog_algs/state_estimators/kalman_filter.py index 731b4a4d..417ab45c 100644 --- a/src/prog_algs/state_estimators/kalman_filter.py +++ b/src/prog_algs/state_estimators/kalman_filter.py @@ -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): @@ -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" diff --git a/src/prog_algs/state_estimators/particle_filter.py b/src/prog_algs/state_estimators/particle_filter.py index 9b2c894e..d85ad773 100644 --- a/src/prog_algs/state_estimators/particle_filter.py +++ b/src/prog_algs/state_estimators/particle_filter.py @@ -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 @@ -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 @@ -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()}) diff --git a/src/prog_algs/state_estimators/state_estimator.py b/src/prog_algs/state_estimators/state_estimator.py index be4f7923..75cac51f 100644 --- a/src/prog_algs/state_estimators/state_estimator.py +++ b/src/prog_algs/state_estimators/state_estimator.py @@ -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): @@ -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 = { @@ -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 ---- diff --git a/src/prog_algs/state_estimators/unscented_kalman_filter.py b/src/prog_algs/state_estimators/unscented_kalman_filter.py index adcfb6b0..38c34eea 100644 --- a/src/prog_algs/state_estimators/unscented_kalman_filter.py +++ b/src/prog_algs/state_estimators/unscented_kalman_filter.py @@ -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 @@ -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" diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 00000000..e1396156 --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,4 @@ +ipython>=8.10.0 +ipykernel>=6.21.2 +testbook>=0.4.2 +. \ No newline at end of file diff --git a/tutorial.ipynb b/tutorial.ipynb index cb91125b..b9934b17 100644 --- a/tutorial.ipynb +++ b/tutorial.ipynb @@ -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 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 for full details on the available `UncertainData` types." ] }, { @@ -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 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 for more details on the available state estimators.\n" ] }, {