Skip to content

Commit 8fe511b

Browse files
committed
update jacobian funcs docs
1 parent f3f74d8 commit 8fe511b

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

fooof/core/jacobians.py

+50-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
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

310
import numpy as np
411

@@ -8,7 +15,20 @@
815
## Periodic fit functions
916

1017
def 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

3050
def 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

4376
def 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]),

fooof/tests/core/test_jacobians.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for fooof.core.jacobians."""
22

3-
43
from fooof.core.jacobians import *
54

65
###################################################################################################

0 commit comments

Comments
 (0)