Skip to content

Commit

Permalink
Pep8ify code 2/2.
Browse files Browse the repository at this point in the history
  • Loading branch information
braniii committed Oct 8, 2024
1 parent 33f8f85 commit e49a6f0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/normi/_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def _kraskov_estimator(
hxy[idx_i, idx_i] = 1
hx[idx_i, idx_i] = 1
hy[idx_i, idx_i] = 1
for idx_j, xj in enumerate(X[idx_i + 1 :], idx_i + 1):
for idx_j, xj in enumerate(X[idx_i + 1:], idx_i + 1):
mi_ij, hxy_ij, hx_ij, hy_ij = kraskov_estimator(
xi,
xj,
Expand Down Expand Up @@ -423,8 +423,7 @@ def kraskov_estimator(
r=radii,
return_length=True,
**kdtree_kwargs,
)
- 1 # fix self count
) - 1 # fix self count
for z in (x, y)
]

Expand All @@ -450,7 +449,10 @@ def kraskov_estimator(


@beartype
def _check_X(X: Float2DArray, n_dims: Union[ArrayLikePositiveInt, PositiveInt]):
def _check_X(
X: Float2DArray,
n_dims: Union[ArrayLikePositiveInt, PositiveInt],
):
"""Sanity check of the input to ensure correct format and dimension."""
_, n_cols = X.shape

Expand All @@ -472,7 +474,8 @@ def _check_X(X: Float2DArray, n_dims: Union[ArrayLikePositiveInt, PositiveInt]):

if np.sum(n_dims) != n_cols:
raise ValueError(
'The number of provided columns needs to match with the sum of `n_dims`.',
'The number of provided columns needs to match with the sum '
'of `n_dims`.',
)

stds = np.std(X, axis=0)
Expand Down

0 comments on commit e49a6f0

Please sign in to comment.