Skip to content

Commit

Permalink
Merge pull request #235 from nasa/dt-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
teubert committed Jun 27, 2023
2 parents c4a5378 + 0fa7f08 commit 6101ac1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/prog_algs/state_estimators/kalman_filter.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 6101ac1

Please sign in to comment.