Skip to content

Commit de09342

Browse files
authored
Fix flake8 (#402)
* Trying to fix flake8 * That didn't work * Trying something else * Halfway there, trying something for the remaining complaints * That worked, fix the remaining ones
1 parent 71045b3 commit de09342

2 files changed

Lines changed: 25 additions & 21 deletions

File tree

openaerostruct/structures/fem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self, **kwargs):
3535
3636
Parameters
3737
----------
38-
**kwargs : dict of keyword arguments
38+
kwargs : dict of keyword arguments
3939
Keyword arguments that will be mapped into the Component options.
4040
"""
4141
super(FEM, self).__init__(**kwargs)

openaerostruct/utils/vector_algebra.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ def add_ones_axis(array):
1111

1212
def compute_dot(array1, array2):
1313
"""
14+
Compute the dot product of two arrays.
15+
1416
Parameters
1517
----------
1618
array1 : numpy array[..., 3]
17-
First argument in the dot product.
18-
The dot product axis is the last one.
19+
First argument in the dot product. The dot product axis is the last one.
1920
array2 : numpy array[..., 3]
20-
Second argument in the dot product.
21-
The dot product axis is the last one.
21+
Second argument in the dot product. The dot product axis is the last one.
2222
"""
2323
return np.einsum("...,i->...i", np.einsum("...i,...i->...", array1, array2), np.ones(3))
2424

2525

2626
def compute_dot_deriv(array, deriv_array):
2727
"""
28+
Compute the derivative of the dot product.
29+
2830
Parameters
2931
----------
3032
array : numpy array[..., 3]
31-
The argument in the dot product we are not taking the derivatives for.
32-
The dot product axis is the last one.
33+
The argument in the dot product we are not taking the derivatives for. The dot product axis is the last one.
3334
deriv_array : numpy array[..., 3, 3]
34-
The derivatives of the argument in the dot product of interest.
35-
The dot product axis is the last one.
35+
The derivatives of the argument in the dot product of interest. The dot product axis is the last one.
3636
"""
3737
return np.einsum(
3838
"...j,i->...ij",
@@ -43,28 +43,28 @@ def compute_dot_deriv(array, deriv_array):
4343

4444
def compute_cross(array1, array2):
4545
"""
46+
Compute the cross product of two arrays.
47+
4648
Parameters
4749
----------
4850
array1 : numpy array[..., 3]
49-
First argument in the cross product (order matters).
50-
The cross product axis is the last one.
51+
First argument in the cross product (order matters). The cross product axis is the last one.
5152
array2 : numpy array[..., 3]
52-
Second argument in the cross product (order matters).
53-
The cross product axis is the last one.
53+
Second argument in the cross product (order matters). The cross product axis is the last one.
5454
"""
5555
return np.cross(array1, array2, axis=-1)
5656

5757

5858
def compute_cross_deriv1(deriv_array, array):
5959
"""
60+
Compute the derivative of the cross product with respect to the first cross product argument.
61+
6062
Parameters
6163
----------
6264
deriv_array : numpy array[..., 3, 3]
63-
Derivatives of the first argument in the cross product.
64-
The cross product axis is the second last one.
65+
Derivatives of the first argument in the cross product. The cross product axis is the second last one.
6566
array : numpy array[..., 3]
66-
Second argument in the cross product (order matters).
67-
The cross product axis is the last one.
67+
Second argument in the cross product (order matters). The cross product axis is the last one.
6868
"""
6969
tmp_0 = np.einsum("...i,j->...ij", compute_cross(deriv_array[..., 0], array), np.array([1.0, 0.0, 0.0]))
7070
tmp_1 = np.einsum("...i,j->...ij", compute_cross(deriv_array[..., 1], array), np.array([0.0, 1.0, 0.0]))
@@ -74,14 +74,14 @@ def compute_cross_deriv1(deriv_array, array):
7474

7575
def compute_cross_deriv2(array, deriv_array):
7676
"""
77+
Compute the derivative of the cross product with respect to the second cross product argument.
78+
7779
Parameters
7880
----------
7981
array : numpy array[..., 3]
80-
First argument in the cross product (order matters).
81-
The cross product axis is the last one.
82+
First argument in the cross product (order matters). The cross product axis is the last one.
8283
deriv_array : numpy array[..., 3, 3]
83-
Derivatives of the second argument in the cross product.
84-
The cross product axis is the second last one.
84+
Derivatives of the second argument in the cross product. The cross product axis is the second last one.
8585
"""
8686
tmp_0 = np.einsum("...i,j->...ij", compute_cross(array, deriv_array[..., 0]), np.array([1.0, 0.0, 0.0]))
8787
tmp_1 = np.einsum("...i,j->...ij", compute_cross(array, deriv_array[..., 1]), np.array([0.0, 1.0, 0.0]))
@@ -91,6 +91,8 @@ def compute_cross_deriv2(array, deriv_array):
9191

9292
def compute_norm(array):
9393
"""
94+
Compute the 2-norm of an array.
95+
9496
Parameters
9597
----------
9698
array : numpy array[..., 3]
@@ -101,6 +103,8 @@ def compute_norm(array):
101103

102104
def compute_norm_deriv(array, deriv_array):
103105
"""
106+
Compute the derivative of the 2-norm of an array.
107+
104108
Parameters
105109
----------
106110
array : numpy array[..., 3]

0 commit comments

Comments
 (0)