Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 21, 2024
1 parent 5602e4d commit b124339
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pycrostates/cluster/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ def _segment(
"""Create segmentation. Must operate on a copy of states."""
corr = np.zeros((states.shape[0], data.shape[1]))
for k in range(0, states.shape[0]):
corr[k] = _correlation(data, states[k] , ignore_polarity=ignore_polarity)
corr[k] = _correlation(data, states[k], ignore_polarity=ignore_polarity)
labels = np.argmax(corr, axis=0)

if factor != 0:
Expand Down
2 changes: 1 addition & 1 deletion pycrostates/metrics/silhouette.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def silhouette_score(cluster): # higher the better
keep = np.linalg.norm(data.T, axis=1) != 0
data = data[:, keep]
labels = labels[keep]
distances = np.corrcoef(data) #TODO: memory error ?
distances = np.corrcoef(data) # TODO: memory error ?
if ignore_polarity:
distances = np.abs(distances)
silhouette = sk_silhouette_score(distances, labels, metric="precomputed")
Expand Down
3 changes: 2 additions & 1 deletion pycrostates/segmentation/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def compute_parameters(self, norm_gfp: bool = True, return_dist: bool = False):
if len(arg_where) != 0:
labeled_tp = data.T[arg_where][:, 0, :].T
labeled_gfp = gfp[arg_where][:, 0]
dist_corr = _correlation(labeled_tp, state, ignore_polarity=True
dist_corr = _correlation(
labeled_tp, state, ignore_polarity=True
) # TODO: ignore_polarity
params[f"{state_name}_mean_corr"] = np.mean(np.abs(dist_corr))
dist_gev = (labeled_gfp * dist_corr) ** 2 / np.sum(gfp**2) # TODO: gev
Expand Down

0 comments on commit b124339

Please sign in to comment.