Repository navigation
Expand file tree
/
Copy pathtest_data_loading.py
More file actions
48 lines (38 loc) · 1.76 KB
/
Copy pathtest_data_loading.py
File metadata and controls
48 lines (38 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
Quick test script to verify data loading works correctly.
"""
from data_loader import (
load_eval_results,
load_evaluations_csv,
merge_data,
get_filter_options,
compute_histogram_data,
)
print("Testing data loading...")
# Paths
RESULTS_DIR = "../cellmap-challenge"
EVALUATIONS_CSV = "../cellmap-challenge/evaluations.csv"
print(f"\n1. Loading evaluation results from {RESULTS_DIR}...")
df_results, df_aggregate = load_eval_results(RESULTS_DIR)
print(f" ✓ Loaded {len(df_results)} result rows")
print(f" ✓ Loaded {len(df_aggregate)} aggregate rows")
print(f"\n2. Loading evaluations CSV from {EVALUATIONS_CSV}...")
df_evals = load_evaluations_csv(EVALUATIONS_CSV)
print(f" ✓ Loaded {len(df_evals)} evaluation records")
print(f"\n3. Merging data...")
df_results_merged, df_aggregate_merged = merge_data(df_results, df_aggregate, df_evals)
print(f" ✓ Merged results: {len(df_results_merged)} rows")
print(f" ✓ Merged aggregates: {len(df_aggregate_merged)} rows")
print(f"\n4. Extracting filter options...")
filters = get_filter_options(df_results_merged, df_aggregate_merged)
print(f" ✓ Found {len(filters['metrics'])} metrics")
print(f" ✓ Found {len(filters['crops'])} crops")
print(f" ✓ Found {len(filters['organelles'])} organelles")
print(f"\n5. Testing histogram computation...")
hist_data = compute_histogram_data(df_aggregate_merged, metric="overall_score", bins=20)
print(f" ✓ Computed histogram with {len(hist_data['bins'])} bins")
print(f" ✓ Total count: {sum(hist_data['counts'])}")
print(f"\n6. Sample metrics: {filters['metrics'][:5]}")
print(f"\n7. Sample crops: {filters['crops'][:5]}")
print(f"\n8. Sample organelles: {filters['organelles'][:5]}")
print("\n✅ All tests passed! Data loading works correctly.")