Skip to content

Commit

Permalink
Style Python files
Browse files Browse the repository at this point in the history
  • Loading branch information
lazappi committed Dec 9, 2024
1 parent a4d75a3 commit 2fe15bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
16 changes: 5 additions & 11 deletions src/data_processors/process_dataset/script.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sys

import anndata as ad
import openproblems as op
import numpy as np
import openproblems as op
from sklearn.metrics import pairwise_distances

## VIASH START
Expand Down Expand Up @@ -43,7 +43,7 @@
adata.layers["normalized"],
adata.layers["normalized"][adata.obs["is_waypoint"].values, :],
metric="euclidean",
n_jobs = -2
n_jobs=-2,
)
np.fill_diagonal(adata.obsm["waypoint_distances"], 0)

Expand All @@ -52,7 +52,7 @@
adata.layers["normalized"][adata.obs["is_waypoint"].values, :],
adata.layers["normalized"][adata.obs["is_waypoint"].values, :],
metric="euclidean",
n_jobs = -2
n_jobs=-2,
)
np.fill_diagonal(adata.uns["between_waypoint_distances"], 0)

Expand All @@ -68,19 +68,13 @@

print("\n>>> Calculating distances to centroids...", flush=True)
adata.obsm["centroid_distances"] = pairwise_distances(
adata.layers["normalized"],
centroids,
metric="euclidean",
n_jobs = -2
adata.layers["normalized"], centroids, metric="euclidean", n_jobs=-2
)
np.fill_diagonal(adata.obsm["centroid_distances"], 0)

print("\n>>> Calculating distances between centroids...", flush=True)
adata.uns["between_centroid_distances"] = pairwise_distances(
centroids,
centroids,
metric="euclidean",
n_jobs = -2
centroids, centroids, metric="euclidean", n_jobs=-2
)
np.fill_diagonal(adata.uns["between_centroid_distances"], 0)

Expand Down
11 changes: 9 additions & 2 deletions src/metrics/distance_correlation/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
}
## VIASH END

print(f"====== Distance correlation metrics (scipy v{scipy.__version__}) ======", flush=True)
print(
f"====== Distance correlation metrics (scipy v{scipy.__version__}) ======",
flush=True,
)

print("\n>>> Reading solution...", flush=True)
solution = ad.read_h5ad(par["input_solution"])
Expand Down Expand Up @@ -43,7 +46,11 @@
"dataset_id": solution.uns["dataset_id"],
"normalization_id": solution.uns["normalization_id"],
"method_id": embedding.uns["method_id"],
"metric_ids": ["waypoint_distance_correlation", "centroid_distance_correlation", "label_distance_correlation"],
"metric_ids": [
"waypoint_distance_correlation",
"centroid_distance_correlation",
"label_distance_correlation",
],
"metric_values": [waypoint_corr, centroid_corr, label_corr],
}
)
Expand Down

0 comments on commit 2fe15bc

Please sign in to comment.