Skip to content

Commit 4901dfc

Browse files
jameslehouxclaude
authored andcommitted
1 parent b79e859 commit 4901dfc

6 files changed

Lines changed: 43 additions & 25 deletions

File tree

braggtrack/cli/embed_dataset.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ def build_parser() -> argparse.ArgumentParser:
3939
return p
4040

4141

42-
43-
4442
def main() -> int:
4543
args = build_parser().parse_args()
4644
root = resolve_dataset_root(args.root)

braggtrack/cli/segment_dataset.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def build_parser() -> argparse.ArgumentParser:
5353
return parser
5454

5555

56-
5756
def _write_notebook(path: Path) -> None:
5857
nb = {
5958
"cells": [

braggtrack/cli/track_dataset.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def build_parser() -> argparse.ArgumentParser:
5151
return parser
5252

5353

54-
5554
def _load_embeddings_npz(path: Path) -> dict[int, np.ndarray]:
5655
with np.load(path) as z:
5756
labels = z["labels"]
@@ -69,7 +68,6 @@ def _merge_embeddings(rows: list[dict[str, Any]], emb: dict[int, np.ndarray]) ->
6968
row["embedding"] = emb[lid]
7069

7170

72-
7371
def _write_notebook(path: Path) -> None:
7472
nb = {
7573
"cells": [

tests/test_error_paths.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,15 @@ def test_parse_scan_index_extracts_digits(self) -> None:
8484
class BuildTracksEdgeTests(unittest.TestCase):
8585
def _make_spot(self, mu: float = 0.0, chi: float = 0.0, d: float = 0.0) -> dict:
8686
return {
87-
"label": 1, "voxel_count": 10, "integrated_intensity": 100.0,
88-
"centroid_mu": mu, "centroid_chi": chi, "centroid_d": d,
89-
"eig_1": 0.5, "eig_2": 0.5, "eig_3": 0.5,
87+
"label": 1,
88+
"voxel_count": 10,
89+
"integrated_intensity": 100.0,
90+
"centroid_mu": mu,
91+
"centroid_chi": chi,
92+
"centroid_d": d,
93+
"eig_1": 0.5,
94+
"eig_2": 0.5,
95+
"eig_3": 0.5,
9096
}
9197

9298
def test_empty_scan_tables(self) -> None:

tests/test_integration.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ def setUpClass(cls) -> None:
6969
raw_thresholds = [otsu_threshold(v.ravel()) for v in cls.volumes]
7070
cls.smoothed = smooth_thresholds(raw_thresholds, window=5)
7171
cls.all_labels = [_segment(v, float(t)) for v, t in zip(cls.volumes, cls.smoothed)]
72-
cls.all_features = [
73-
extract_instance_table(lab, v) for lab, v in zip(cls.all_labels, cls.volumes)
74-
]
72+
cls.all_features = [extract_instance_table(lab, v) for lab, v in zip(cls.all_labels, cls.volumes)]
7573

7674
def test_discovers_three_scans(self) -> None:
7775
self.assertEqual(len(self.scans), 3)
@@ -91,11 +89,21 @@ def test_spot_counts_are_stable(self) -> None:
9189

9290
def test_feature_tables_have_required_columns(self) -> None:
9391
required = {
94-
"label", "voxel_count", "integrated_intensity",
95-
"centroid_mu", "centroid_chi", "centroid_d",
96-
"eig_1", "eig_2", "eig_3",
97-
"bbox_min_z", "bbox_max_z", "bbox_min_y", "bbox_max_y",
98-
"bbox_min_x", "bbox_max_x",
92+
"label",
93+
"voxel_count",
94+
"integrated_intensity",
95+
"centroid_mu",
96+
"centroid_chi",
97+
"centroid_d",
98+
"eig_1",
99+
"eig_2",
100+
"eig_3",
101+
"bbox_min_z",
102+
"bbox_max_z",
103+
"bbox_min_y",
104+
"bbox_max_y",
105+
"bbox_min_x",
106+
"bbox_max_x",
99107
}
100108
for feats in self.all_features:
101109
for row in feats:

tests/test_semantic_week4.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ def test_crop_masked(self) -> None:
4242
lab = np.zeros((10, 10, 10), dtype=np.int32)
4343
lab[2:5, 3:6, 4:7] = 7
4444
bbox = {
45-
"bbox_min_z": 2, "bbox_max_z": 4,
46-
"bbox_min_y": 3, "bbox_max_y": 5,
47-
"bbox_min_x": 4, "bbox_max_x": 6,
45+
"bbox_min_z": 2,
46+
"bbox_max_z": 4,
47+
"bbox_min_y": 3,
48+
"bbox_max_y": 5,
49+
"bbox_min_x": 4,
50+
"bbox_max_x": 6,
4851
}
4952
masked, mask = crop_spot_cube(vol, lab, 7, bbox, margin=0)
5053
self.assertTrue(np.all(masked[mask > 0] == 3.0))
@@ -55,9 +58,12 @@ def test_margin_clamps_to_boundary(self) -> None:
5558
labels = np.zeros((10, 10, 10), dtype=int)
5659
labels[0:2, 0:2, 0:2] = 1
5760
bbox = {
58-
"bbox_min_z": 0, "bbox_max_z": 1,
59-
"bbox_min_y": 0, "bbox_max_y": 1,
60-
"bbox_min_x": 0, "bbox_max_x": 1,
61+
"bbox_min_z": 0,
62+
"bbox_max_z": 1,
63+
"bbox_min_y": 0,
64+
"bbox_max_y": 1,
65+
"bbox_min_x": 0,
66+
"bbox_max_x": 1,
6167
}
6268
masked, mask = crop_spot_cube(volume, labels, label_id=1, bbox=bbox, margin=5)
6369
self.assertGreater(mask.sum(), 0)
@@ -68,9 +74,12 @@ def test_other_labels_masked_out(self) -> None:
6874
labels[3, 3, 3] = 1
6975
labels[4, 4, 4] = 2
7076
bbox = {
71-
"bbox_min_z": 3, "bbox_max_z": 4,
72-
"bbox_min_y": 3, "bbox_max_y": 4,
73-
"bbox_min_x": 3, "bbox_max_x": 4,
77+
"bbox_min_z": 3,
78+
"bbox_max_z": 4,
79+
"bbox_min_y": 3,
80+
"bbox_max_y": 4,
81+
"bbox_min_x": 3,
82+
"bbox_max_x": 4,
7483
}
7584
masked, mask = crop_spot_cube(volume, labels, label_id=1, bbox=bbox, margin=1)
7685
self.assertEqual(float(mask[mask.shape[0] // 2, mask.shape[1] // 2, mask.shape[2] // 2]), 0.0)

0 commit comments

Comments
 (0)