Skip to content

Commit 5f27575

Browse files
committed
modified the .rst so the methods of certain modules are listed in a preferred order rather than alphabetically
1 parent 70fe0f9 commit 5f27575

13 files changed

Lines changed: 66 additions & 50 deletions

File tree

docs/source/code.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ API documentation
55
:maxdepth: 1
66

77
finite_difference
8-
kalman_smooth
9-
linear_model
108
smooth_finite_difference
119
total_variation_regularization
10+
kalman_smooth
11+
linear_model
1212
optimize
1313
utils
14-

docs/source/finite_difference.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@ finite_difference
22
=================
33

44
.. automodule:: pynumdiff.finite_difference
5-
:members:
5+
:no-members:
6+
7+
.. autofunction:: pynumdiff.finite_difference.finite_difference
8+
.. autofunction:: pynumdiff.finite_difference.first_order
9+
.. autofunction:: pynumdiff.finite_difference.second_order
10+
.. autofunction:: pynumdiff.finite_difference.fourth_order

docs/source/kalman_smooth.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@ kalman_smooth
22
=============
33

44
.. automodule:: pynumdiff.kalman_smooth
5-
:members:
5+
:no-members:
6+
7+
.. autofunction:: pynumdiff.kalman_smooth.rts_const_deriv
8+
.. autofunction:: pynumdiff.kalman_smooth.constant_velocity
9+
.. autofunction:: pynumdiff.kalman_smooth.constant_acceleration
10+
.. autofunction:: pynumdiff.kalman_smooth.constant_jerk
11+
.. autofunction:: pynumdiff.kalman_smooth.known_dynamics

docs/source/total_variation_regularization.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@ total_variation_regularization
22
==============================
33

44
.. automodule:: pynumdiff.total_variation_regularization
5-
:members:
5+
:no-members:
6+
7+
.. autofunction:: pynumdiff.total_variation_regularization.tvr
8+
.. autofunction:: pynumdiff.total_variation_regularization.velocity
9+
.. autofunction:: pynumdiff.total_variation_regularization.acceleration
10+
.. autofunction:: pynumdiff.total_variation_regularization.jerk
11+
.. autofunction:: pynumdiff.total_variation_regularization.iterative_velocity
12+
.. autofunction:: pynumdiff.total_variation_regularization.smooth_acceleration
13+
.. autofunction:: pynumdiff.total_variation_regularization.jerk_sliding

examples/1_basic_tutorial.ipynb

Lines changed: 21 additions & 21 deletions
Large diffs are not rendered by default.

examples/2a_optimizing_parameters_with_dxdt_known.ipynb

Lines changed: 12 additions & 10 deletions
Large diffs are not rendered by default.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
"""This module implements some common finite difference schemes
22
"""
33
from ._finite_difference import finite_difference, first_order, second_order, fourth_order
4-
5-
__all__ = ['finite_difference', 'first_order', 'second_order', 'fourth_order'] # So these get treated as direct members of the module by sphinx

pynumdiff/finite_difference/_finite_difference.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def finite_difference(x, dt, num_iterations, order):
2727
dxdt_hat[-1] = dxdt_hat[-2] # using stencil -1,0 vs stencil 0,1 you get an expression for the same value
2828
elif order == 2:
2929
dxdt_hat[1:-1] = (x_hat[2:] - x_hat[:-2])/2 # second-order center-difference formula
30-
dxdt_hat[0] = x_hat[1] - x_hat[0]
31-
dxdt_hat[-1] = x_hat[-1] - x_hat[-2] # use first-order endpoint formulas so as not to amplify noise. See #104
30+
dxdt_hat[0] = (-3 * x_hat[0] + 4 * x_hat[1] - x_hat[2])/2 # use spaced out stencil to get endpoint formulas
31+
dxdt_hat[-1] = (3 * x_hat[-1] - 4 * x_hat[-2] + x_hat[-3])/2 # that do not amplify noise. See #104
3232
elif order == 4:
3333
dxdt_hat[2:-2] = (8*(x_hat[3:-1] - x_hat[1:-3]) - x_hat[4:] + x_hat[:-4])/12 # fourth-order center-difference
3434
dxdt_hat[1] = (x_hat[2] - x_hat[0])/2
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
"""This module implements Kalman filters
22
"""
33
from ._kalman_smooth import rts_const_deriv, constant_velocity, constant_acceleration, constant_jerk, known_dynamics
4-
5-
__all__ = ['rts_const_deriv', 'constant_velocity', 'constant_acceleration', 'constant_jerk', 'known_dynamics'] # So these get treated as direct members of the module by sphinx

pynumdiff/optimize/_optimize.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@
7878
{'gamma': (1e-4, 1e7),
7979
'window_size': (3, 1000)}),
8080
rts_const_deriv: ({'forwardbackward': [True, False],
81-
'qr_ratio': [-16, -12, -9, -6, -3, 0, 3, 6, 9, 12, 16]},
82-
{'qr_ratio': [1e-20, 1e20]}),
81+
'order': [1, 3],
82+
'qr_ratio': [1e-16, 1e-12, 1e-9, 1e-6, 1e-3, 1, 1e3, 1e6, 1e9, 1e12, 1e16]},
83+
{'order': (1, 3),
84+
'qr_ratio': [1e-20, 1e20]}),
8385
constant_velocity: ({'forwardbackward': [True, False],
8486
'q': [1e-8, 1e-4, 1e-1, 1e1, 1e4, 1e8],
8587
'r': [1e-8, 1e-4, 1e-1, 1e1, 1e4, 1e8]},
@@ -169,7 +171,7 @@ def optimize(func, x, dt, search_space={}, dxdt_truth=None, tvgamma=1e-2, paddin
169171
categorical_params = {k for k,v in params.items() if isinstance(v, tuple)}
170172
categorical_combos = [dict(zip(categorical_params, combo)) for combo in product(*[params[k] for k in categorical_params])] # ends up [{}] if there are no categorical params
171173

172-
# The Nelder-Mead's search space is the Cartesian product of all dimensions where multiple options are given in a list
174+
# The Nelder-Mead's search space is the dimensions where multiple numerical (float or castable to float) options are given in a list
173175
search_space_types = {k:type(v[0]) for k,v in params.items() if isinstance(v, list)} # map param name -> type, for converting to and from point
174176
if any(v not in [float, int, bool] for v in search_space_types.values()):
175177
raise ValueError("To optimize over categorical strings, put them in a tuple, not a list.")

0 commit comments

Comments
 (0)