1- """"Functions for computing Jacobian matrices to be used during fitting."""
1+ """"Functions for computing Jacobian matrices to be used during fitting.
2+
3+ Notes
4+ -----
5+ These functions line up with those in `funcs`.
6+ The parameters in these functions are labelled {a, b, c, ...}, but follow the order in `funcs`.
7+ These functions are designed to be passed into `curve_fit` to provide a computed Jacobian.
8+ """
29
310import numpy as np
411
815## Periodic fit functions
916
1017def jacobian_gauss (xs , * params ):
11- """Create the Jacobian matrix for the Guassian function."""
18+ """Create the Jacobian matrix for the Guassian function.
19+
20+ Parameters
21+ ----------
22+ xs : 1d array
23+ Input x-axis values.
24+ *params : float
25+ Parameters for the function.
26+
27+ Returns
28+ -------
29+ jacobian : 2d array
30+ Jacobian matrix, with shape [len(xs), n_params].
31+ """
1232
1333 jacobians = []
1434 for a , b , c in zip (* [iter (params )] * 3 ):
@@ -28,7 +48,20 @@ def jacobian_gauss(xs, *params):
2848## Aperiodic fit functions
2949
3050def jacobian_expo (xs , * params ):
31- """Create the Jacobian matrix for the exponential function."""
51+ """Create the Jacobian matrix for the exponential function.
52+
53+ Parameters
54+ ----------
55+ xs : 1d array
56+ Input x-axis values.
57+ *params : float
58+ Parameters for the function.
59+
60+ Returns
61+ -------
62+ jacobian : 2d array
63+ Jacobian matrix, with shape [len(xs), n_params].
64+ """
3265
3366 a , b , c = params
3467 jacobian = np .hstack ([
@@ -41,7 +74,20 @@ def jacobian_expo(xs, *params):
4174
4275
4376def jacobian_expo_nk (xs , * params ):
44- """Create the Jacobian matrix for the exponential no-knee function."""
77+ """Create the Jacobian matrix for the exponential no-knee function.
78+
79+ Parameters
80+ ----------
81+ xs : 1d array
82+ Input x-axis values.
83+ *params : float
84+ Parameters for the function.
85+
86+ Returns
87+ -------
88+ jacobian : 2d array
89+ Jacobian matrix, with shape [len(xs), n_params].
90+ """
4591
4692 jacobian = np .hstack ([
4793 np .ones ([len (xs ), 1 ]),
0 commit comments