Skip to content

Commit 5179bfa

Browse files
committed
Format
1 parent d74c23e commit 5179bfa

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

docs/source/examples/clustering.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ print(f"Number of valid pixels: {len(valid_indices)}")
4545
# We want to divide the valid pixels into 5 regions
4646
n_regions = 5
4747
clustered_map = find_kmeans_clusters(
48-
mask,
49-
valid_indices,
50-
n_regions=n_regions,
48+
mask,
49+
valid_indices,
50+
n_regions=n_regions,
5151
key=key,
5252
max_centroids=10 # Maximum buffer for centroids (useful for JIT)
5353
)
@@ -62,8 +62,8 @@ After clustering, you might want to normalize the labels so they are contiguous
6262
```python
6363
# Normalize labels
6464
normalized_map = normalize_by_first_occurrence(
65-
clustered_map,
66-
n_regions=n_regions,
65+
clustered_map,
66+
n_regions=n_regions,
6767
max_centroids=10
6868
)
6969

@@ -98,8 +98,8 @@ processed_cutout = cutout * 2.0
9898
# Put it back into the full map structure
9999
# Pixels not in the cutout will be filled with hp.UNSEEN
100100
reconstructed_map = get_fullmap_from_cutout(
101-
processed_cutout,
102-
valid_indices,
101+
processed_cutout,
102+
valid_indices,
103103
nside=nside
104104
)
105105

@@ -124,8 +124,8 @@ cutout2 = jnp.array([1000., 2000., 3000.]) # Data for region 2
124124
# Combine them into a single map
125125
# Note: You need to provide the indices for each cutout
126126
combined_map = combine_masks(
127-
[cutout1, cutout2],
128-
[indices1, indices2],
127+
[cutout1, cutout2],
128+
[indices1, indices2],
129129
nside=nside
130130
)
131131

@@ -142,4 +142,3 @@ print(f"Pixel 50 value (unseen): {combined_map[50]}") # Should be UNSEEN
142142
- **Exception**: `shuffle_labels` uses NumPy for randomization and is **not** JIT-compatible. It is primarily intended for visualization (e.g., to make contiguous clusters distinct in plots) rather than performance-critical loops.
143143

144144
- **Static Arguments**: When JIT-compiling, ensure arguments like `nside` are marked as static if they affect array shapes.
145-

0 commit comments

Comments
 (0)