Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
246 commits
Select commit Hold shift + click to select a range
f222821
add planning roadmap
edyoshikun Feb 12, 2026
8dbacb8
docs: start milestone v1.1 Models
edyoshikun Feb 12, 2026
a51f6d8
docs: define milestone v1.1 requirements
edyoshikun Feb 12, 2026
fda61e8
docs: create milestone v1.1 roadmap (5 phases)
edyoshikun Feb 12, 2026
1b2d68b
docs(package-scaffold-shared-components): research phase domain
edyoshikun Feb 13, 2026
8c6883d
docs(06): create phase plan - package scaffold and shared components
edyoshikun Feb 13, 2026
9f2044f
feat(06-01): create viscy-models package scaffold
edyoshikun Feb 13, 2026
acd56b7
feat(06-01): register viscy-models in workspace
edyoshikun Feb 13, 2026
e093581
docs(06-01): complete package scaffold plan
edyoshikun Feb 13, 2026
0a2a15c
feat(06-02): extract shared components into _components/ module
edyoshikun Feb 13, 2026
8ef5998
feat(06-03): migrate ConvBlock2D and ConvBlock3D to unet/_layers/
edyoshikun Feb 13, 2026
4fa16c4
test(06-03): add tests for ConvBlock2D and ConvBlock3D
edyoshikun Feb 13, 2026
29d76d9
test(06-02): add forward-pass tests for all _components
edyoshikun Feb 13, 2026
80e6da1
docs(06-03): complete UNet ConvBlock layers plan
edyoshikun Feb 13, 2026
6559ad3
docs(06-02): complete shared components extraction plan
edyoshikun Feb 13, 2026
fa234a9
docs(phase-6): complete phase execution and verification
edyoshikun Feb 13, 2026
0fcced4
docs(07-core-unet-models): research phase domain
edyoshikun Feb 13, 2026
f674982
docs(07): create phase plan for core UNet models
edyoshikun Feb 13, 2026
dedaf1e
feat(07-01): migrate UNeXt2 model class to viscy-models
edyoshikun Feb 13, 2026
58be984
test(07-01): add 6 UNeXt2 forward-pass tests and fix deconv tuple bug
edyoshikun Feb 13, 2026
9297f00
docs(07-01): complete UNeXt2 migration plan
edyoshikun Feb 13, 2026
67859a9
feat(07-02): migrate FullyConvolutionalMAE to viscy-models
edyoshikun Feb 13, 2026
e7f7c66
test(07-02): migrate 11 FCMAE tests to viscy-models
edyoshikun Feb 13, 2026
94c2251
docs(07-02): complete FCMAE migration plan (Phase 7 complete)
edyoshikun Feb 13, 2026
1545318
docs(phase-7): complete phase execution and verification
edyoshikun Feb 13, 2026
1a21eaa
docs(phase-8): research representation models migration
edyoshikun Feb 13, 2026
1c4e01a
docs(08): create phase plan for representation models
edyoshikun Feb 13, 2026
47a8102
feat(08-02): migrate BetaVae25D and BetaVaeMonai to viscy-models
edyoshikun Feb 13, 2026
68e7852
feat(08-01): migrate ContrastiveEncoder and ResNet3dEncoder to viscy-…
edyoshikun Feb 13, 2026
3740e71
test(08-01): add 5 forward-pass tests for contrastive models
edyoshikun Feb 13, 2026
18ab66f
test(08-02): add forward-pass tests for BetaVae25D and BetaVaeMonai
edyoshikun Feb 13, 2026
71ef31a
docs(08-01): complete contrastive model migration plan
edyoshikun Feb 13, 2026
3c1486d
docs(08-02): complete VAE migration plan (Phase 8 complete)
edyoshikun Feb 13, 2026
5b49f74
docs(phase-8): complete phase execution and verification
edyoshikun Feb 13, 2026
48869e6
docs(09): research legacy UNet models migration
edyoshikun Feb 13, 2026
a689529
docs(09): create phase plan for legacy UNet models
edyoshikun Feb 13, 2026
1e8223e
feat(09-01): migrate Unet2d and Unet25d to viscy-models
edyoshikun Feb 13, 2026
712db18
test(09-01): add pytest tests for Unet2d and Unet25d
edyoshikun Feb 13, 2026
ffd5bcc
docs(09-01): complete legacy UNet migration plan
edyoshikun Feb 13, 2026
5f67d54
docs(phase-9): complete phase execution and verification
edyoshikun Feb 13, 2026
0ba5ad6
docs(10): create phase plan for public API and CI integration
edyoshikun Feb 13, 2026
86e7ebd
feat(10-01): add top-level re-exports for all 8 model classes
edyoshikun Feb 13, 2026
97efc88
test(10-01): add state dict key compatibility regression tests
edyoshikun Feb 13, 2026
358c5a0
chore(10-01): add viscy-models to CI test matrix
edyoshikun Feb 13, 2026
6657ee8
docs(10-01): complete public API & CI integration plan (v1.1 mileston…
edyoshikun Feb 13, 2026
2c067ab
docs(phase-10): complete phase execution and verification (v1.1 miles…
edyoshikun Feb 13, 2026
9cc8ebe
refactor: consolidate ConvBlock2D/3D into _components
edyoshikun Feb 13, 2026
719c940
remove the _layers
edyoshikun Feb 13, 2026
b79c746
update the readme
edyoshikun Feb 13, 2026
aa54a91
docs: start milestone v1.1 Extract viscy-data
alxndrkalinin Feb 13, 2026
ee63b38
update the main readme
edyoshikun Feb 13, 2026
e1ea1cd
docs: complete viscy-data project research
alxndrkalinin Feb 13, 2026
01a9488
docs: define milestone v1.1 requirements
alxndrkalinin Feb 13, 2026
26db307
docs: create milestone v1.1 roadmap (4 phases)
alxndrkalinin Feb 13, 2026
29af85c
docs(06-package-scaffolding-and-foundation): create phase plan
alxndrkalinin Feb 13, 2026
47d8f2d
feat(06-01): create viscy-data package directory structure with pypro…
alxndrkalinin Feb 13, 2026
9eefb8c
feat(06-01): add type definitions and package init with re-exports
alxndrkalinin Feb 13, 2026
f45db24
feat(06-01): integrate viscy-data as workspace dependency in root pyp…
alxndrkalinin Feb 13, 2026
aef7948
docs(06-01): complete package scaffolding plan with summary and state…
alxndrkalinin Feb 13, 2026
f614e96
feat(06-02): extract shared utility functions into _utils.py
alxndrkalinin Feb 13, 2026
0c4bd6e
docs(06-02): complete utility module extraction plan
alxndrkalinin Feb 13, 2026
3f96d6e
docs(phase-6): complete phase execution
alxndrkalinin Feb 14, 2026
9682fa6
docs(07-code-migration): create phase plan
alxndrkalinin Feb 14, 2026
d66e17b
feat(07-01): migrate select.py, distributed.py, segmentation.py to vi…
alxndrkalinin Feb 14, 2026
378d5e2
feat(07-01): migrate hcs.py to viscy-data with utility import rewiring
alxndrkalinin Feb 14, 2026
bd08483
feat(07-01): migrate gpu_aug.py to viscy-data with dependency rewiring
alxndrkalinin Feb 14, 2026
9d20020
docs(07-01): complete core data module migration plan
alxndrkalinin Feb 14, 2026
924386b
feat(07-03): migrate mmap_cache.py and ctmc_v1.py to viscy-data
alxndrkalinin Feb 14, 2026
a05c53d
feat(07-03): migrate livecell.py with lazy optional dependency imports
alxndrkalinin Feb 14, 2026
8ddfee2
feat(07-03): migrate combined.py as-is with import rewiring
alxndrkalinin Feb 14, 2026
97cb1e3
feat(07-02): migrate cell_classification.py and cell_division_triplet.py
alxndrkalinin Feb 14, 2026
1a3589c
docs(07-03): complete optional dependency module migration plan
alxndrkalinin Feb 14, 2026
0f9d00a
docs(07-02): complete specialized module migration plan
alxndrkalinin Feb 14, 2026
96514fd
feat(07-04): add complete public API exports to viscy_data __init__.py
alxndrkalinin Feb 14, 2026
3b571a9
docs(07-04): complete public API exports plan - phase 7 fully done
alxndrkalinin Feb 14, 2026
b615bf2
docs(phase-7): complete code migration execution
alxndrkalinin Feb 14, 2026
02a219e
docs(08-test-migration-and-validation): create phase plan
alxndrkalinin Feb 14, 2026
819d589
test(08-01): add conftest.py with HCS OME-Zarr fixtures for viscy-data
alxndrkalinin Feb 14, 2026
5df69e3
docs(08-02): complete smoke tests plan - phase 8 test migration done
alxndrkalinin Feb 14, 2026
ba0c499
feat(08-01): migrate test_hcs, test_triplet, test_select to viscy-dat…
alxndrkalinin Feb 14, 2026
6c6398c
docs(08-01): complete data test migration plan summary
alxndrkalinin Feb 14, 2026
290e5de
docs(phase-8): complete test migration and validation
alxndrkalinin Feb 14, 2026
6c492d0
docs(09-ci-integration): create phase plan
alxndrkalinin Feb 14, 2026
7610899
feat(09-01): add viscy-data CI test jobs to GitHub Actions workflow
alxndrkalinin Feb 14, 2026
7027c77
docs(09-01): complete CI integration plan
alxndrkalinin Feb 14, 2026
5d7b7f6
docs(phase-9): complete CI integration - milestone v1.1 done
alxndrkalinin Feb 14, 2026
fe59622
chore: complete v1.1 milestone — Extract viscy-data
alxndrkalinin Feb 14, 2026
c6d91a1
harmonize the planning between the modular-data and modular-models
edyoshikun Feb 16, 2026
deeb937
Merge remote-tracking branch 'origin/modular-data' into app-dynaclr
edyoshikun Feb 16, 2026
dfd95bd
Merge branch 'modular-models' into app-dynaclr
edyoshikun Feb 16, 2026
5465987
viscy-utils package
edyoshikun Feb 16, 2026
4647996
add applications/dynaclr
edyoshikun Feb 16, 2026
d217a5f
update the monorepo uv
edyoshikun Feb 16, 2026
04ca12d
moving files around
edyoshikun Feb 17, 2026
b0721de
update planning
edyoshikun Feb 17, 2026
cd18b96
docs: start milestone v2.1 DynaCLR Integration Validation
edyoshikun Feb 20, 2026
9ca177f
docs: define milestone v2.1 requirements
edyoshikun Feb 20, 2026
0a219f7
docs: create milestone v2.1 roadmap (2 phases)
edyoshikun Feb 20, 2026
522bc49
docs(18-training-validation): create phase plan
edyoshikun Feb 20, 2026
5c34dc4
feat(18-01): add training integration tests for ContrastiveModule
edyoshikun Feb 20, 2026
ff6505a
docs(18-01): complete training integration tests plan
edyoshikun Feb 20, 2026
205770b
docs(phase-18): complete phase execution
edyoshikun Feb 20, 2026
623126a
docs(19-inference-reproducibility): create phase plan
edyoshikun Feb 20, 2026
79ffdf8
chore(19-01): add anndata test dependency and HPC conftest fixtures
edyoshikun Feb 20, 2026
6238154
feat(19-01): add inference reproducibility integration tests
edyoshikun Feb 20, 2026
a837be9
docs(19-01): complete inference reproducibility plan
edyoshikun Feb 20, 2026
7f38f3a
fix: add seed_everything(42) to all integration tests
edyoshikun Feb 20, 2026
23ced85
docs(phase-19): complete phase execution
edyoshikun Feb 20, 2026
312d447
restructure the examples folder and ruff
edyoshikun Feb 20, 2026
4678355
update readme.me hallucination
edyoshikun Feb 20, 2026
9a44dd7
update the readmes
edyoshikun Feb 20, 2026
151e2de
- Add `viscy` console script in viscy-utils pointing to
edyoshikun Feb 20, 2026
fd42b73
add the CLI for running training and prediction
edyoshikun Feb 20, 2026
360d955
default embedding writer to None
edyoshikun Feb 20, 2026
6ed4529
import within the function
edyoshikun Feb 20, 2026
ab4f371
ruff
edyoshikun Feb 20, 2026
a51fa1d
dynaclr typo
edyoshikun Feb 20, 2026
a497533
rename folder to dynaclr
edyoshikun Feb 20, 2026
59c9250
add the classifiers here
edyoshikun Feb 21, 2026
b1d51b2
docs: start milestone v2.2 Composable Sampling Framework
edyoshikun Feb 22, 2026
341a213
docs: define milestone v2.2 requirements
edyoshikun Feb 22, 2026
8ba53c6
docs: create milestone v2.2 roadmap (6 phases)
edyoshikun Feb 22, 2026
b6d85a0
docs(20): capture phase context
edyoshikun Feb 22, 2026
3a54c8c
docs(20): create phase plan for experiment configuration
edyoshikun Feb 22, 2026
142b1a4
test(20-01): add failing tests for ExperimentConfig and ExperimentReg…
edyoshikun Feb 22, 2026
8bda967
feat(20-01): implement ExperimentConfig and ExperimentRegistry
edyoshikun Feb 22, 2026
4f2d772
refactor(20-01): clean up imports and exclude stale dynacrl workspace…
edyoshikun Feb 22, 2026
afff429
docs(20-01): complete ExperimentConfig/ExperimentRegistry plan
edyoshikun Feb 22, 2026
3ca1ebb
feat(20-02): add explicit deps and top-level experiment API exports
edyoshikun Feb 22, 2026
3e68cc1
feat(20-02): add example multi-experiment YAML configuration
edyoshikun Feb 22, 2026
b7e7629
docs(20-02): complete package wiring and example config plan
edyoshikun Feb 22, 2026
2471288
docs(phase-20): complete phase execution
edyoshikun Feb 22, 2026
293cb44
docs(21): create phase plan for Cell Index & Lineage
edyoshikun Feb 22, 2026
03bee1a
test(21-01): add failing tests for MultiExperimentIndex
edyoshikun Feb 22, 2026
680694b
feat(21-01): implement MultiExperimentIndex with lineage and border c…
edyoshikun Feb 22, 2026
98dc7a6
refactor(21-01): fix lint issues and export MultiExperimentIndex
edyoshikun Feb 22, 2026
9c25895
docs(21-01): complete MultiExperimentIndex plan summary and state update
edyoshikun Feb 22, 2026
2dbc359
test(21-02): add failing tests for valid anchors, properties, and sum…
edyoshikun Feb 22, 2026
9c6408a
feat(21-02): implement valid_anchors, experiment_groups, condition_gr…
edyoshikun Feb 22, 2026
ad55374
docs(21-02): complete valid anchors plan
edyoshikun Feb 22, 2026
bbd273f
docs(22): research batch sampling phase domain
edyoshikun Feb 22, 2026
e85b3bb
docs(22): create phase plan for batch sampling
edyoshikun Feb 22, 2026
f12e128
test(22-01): add failing tests for FlexibleBatchSampler
edyoshikun Feb 23, 2026
fe38805
feat(22-01): implement FlexibleBatchSampler with experiment-aware, co…
edyoshikun Feb 23, 2026
4b89f53
refactor(22-01): export FlexibleBatchSampler from viscy_data package
edyoshikun Feb 23, 2026
45ec057
docs(22-01): complete FlexibleBatchSampler core plan
edyoshikun Feb 23, 2026
7a40b6f
test(22-02): add failing tests for temporal enrichment, DDP coverage,…
edyoshikun Feb 23, 2026
7de55ee
feat(22-02): implement temporal enrichment, validation guards, DDP co…
edyoshikun Feb 23, 2026
fc2b67a
docs(22-02): complete temporal enrichment + DDP plan
edyoshikun Feb 23, 2026
76c35e8
docs(phase-22): complete batch sampling phase execution
edyoshikun Feb 23, 2026
a22b238
docs(23): create phase plan for Loss & Augmentation
edyoshikun Feb 23, 2026
6c3aac6
test(23-01): add failing tests for NTXentHCL
edyoshikun Feb 23, 2026
0b497e2
test(23-02): add failing tests for ChannelDropout and variable tau sa…
edyoshikun Feb 23, 2026
048d0fa
feat(23-02): implement ChannelDropout and variable tau sampling
edyoshikun Feb 23, 2026
b36e614
feat(23-01): implement NTXentHCL with hard-negative concentration
edyoshikun Feb 23, 2026
358ee57
refactor(23-02): add ChannelDropout and sample_tau to package exports
edyoshikun Feb 23, 2026
ebed6e9
docs(23-02): complete ChannelDropout and tau sampling plan
edyoshikun Feb 23, 2026
c1ee092
docs(23-01): complete NTXentHCL loss plan
edyoshikun Feb 23, 2026
ec2f7c8
docs(phase-23): complete loss & augmentation phase execution
edyoshikun Feb 23, 2026
eae255c
docs(24): create phase plan
edyoshikun Feb 23, 2026
ec4aebb
test(24-01): add failing tests for MultiExperimentTripletDataset
edyoshikun Feb 23, 2026
835f1a8
feat(24-01): implement MultiExperimentTripletDataset with lineage-awa…
edyoshikun Feb 23, 2026
ae5a30d
refactor(24-01): add MultiExperimentTripletDataset to package exports
edyoshikun Feb 23, 2026
ee7aff7
docs(24-01): complete MultiExperimentTripletDataset plan
edyoshikun Feb 23, 2026
6eadc0e
update uv
edyoshikun Feb 23, 2026
4f03d12
test(24-02): add failing tests for MultiExperimentDataModule
edyoshikun Feb 23, 2026
d874570
feat(24-02): implement MultiExperimentDataModule with experiment-leve…
edyoshikun Feb 23, 2026
5f0e743
refactor(24-02): add MultiExperimentDataModule to dynaclr package exp…
edyoshikun Feb 23, 2026
7d960fe
docs(24-02): complete MultiExperimentDataModule plan
edyoshikun Feb 23, 2026
e25a420
docs(phase-24): complete dataset & datamodule phase execution
edyoshikun Feb 23, 2026
8b53050
docs(25): create phase plan
edyoshikun Feb 24, 2026
c5d8cdf
docs(phase-25): complete integration phase plan
edyoshikun Feb 24, 2026
2cb0d5d
feat(25-01): add end-to-end multi-experiment integration tests
edyoshikun Feb 24, 2026
2d410b7
feat(25-01): add multi-experiment YAML config and class_path validati…
edyoshikun Feb 24, 2026
04babe8
docs(25-01): complete integration plan - milestone v2.2 complete
edyoshikun Feb 24, 2026
a233981
docs(phase-25): complete integration phase execution — v2.2 milestone…
edyoshikun Feb 24, 2026
7d04084
add the smoothness and dynamic range comparison
edyoshikun Feb 24, 2026
f5bfdb0
add the applications/qc
edyoshikun Feb 25, 2026
c34036a
bug qc metrics exposing the device
edyoshikun Feb 25, 2026
c9f898a
Merge branch 'app-dynaclr' of github.com:mehta-lab/VisCy into app-dyn…
edyoshikun Feb 25, 2026
c3dda3c
add batch predict
edyoshikun Feb 25, 2026
a55582d
adding cli for reduce dimensionality composable
edyoshikun Feb 25, 2026
f9d4e5f
add example configs for model comparision and smoothness
edyoshikun Feb 25, 2026
8f46b7e
add the biological annotations to the zattrs
edyoshikun Feb 25, 2026
b142ee0
adding airtable logic
edyoshikun Feb 26, 2026
42fe66d
harmonize and remove duplication between airtable and qc. moving most…
edyoshikun Feb 26, 2026
b079679
cleanup readme for airtable
edyoshikun Feb 26, 2026
8956781
add callback to store embeddings every n epochs and store metadata to…
edyoshikun Feb 26, 2026
2e2240e
fix the apply-linear classifiers to make sure we use the model and ve…
edyoshikun Feb 26, 2026
66b910f
add the pseudotime evals
edyoshikun Feb 28, 2026
734b89a
re-structure pseudotime folder
edyoshikun Feb 28, 2026
f19ee07
add the linear classifier evals and restructure folder path
edyoshikun Feb 28, 2026
0ad7548
add evaluations to dynaclr package
edyoshikun Feb 28, 2026
976b312
cli and linear classifier init
edyoshikun Feb 28, 2026
abf0401
Merge remote-tracking branch 'origin/app-dynaclr' into dynav2
edyoshikun Mar 1, 2026
fde8a9c
Merge branch 'modular-viscy-staging' into dynav2
edyoshikun Mar 1, 2026
85fd1ac
fix: address PR review blockers (airtable security, tests, qc cleanup)
edyoshikun Mar 1, 2026
2fd68cc
fix tests
edyoshikun Mar 1, 2026
fbb5cac
add track timing backup, save the aucroc as metric for linear classif…
edyoshikun Mar 2, 2026
aa04052
consolidate appending column to anndata functionality from reduce dim…
edyoshikun Mar 2, 2026
62f5895
add DINOv3 to viscy-data
edyoshikun Mar 3, 2026
83ae7e9
refactor dynaclr app folder structure
edyoshikun Mar 3, 2026
72e69e2
move losses to viscy-models
edyoshikun Mar 3, 2026
0d04b35
data folder
edyoshikun Mar 3, 2026
9a28457
porting #360
edyoshikun Mar 3, 2026
767f90c
rname dino to foundation and support openphenom
edyoshikun Mar 4, 2026
08cb895
move shells cripts to the configs folder
edyoshikun Mar 4, 2026
bba3210
fix the import for opephenom
edyoshikun Mar 4, 2026
9799859
generalize the qc class
edyoshikun Mar 4, 2026
d5060f3
add tqdm as default instead of Rich. Rich doesnt show up on the stdou…
edyoshikun Mar 6, 2026
0c48c1e
de parallelize and default cosine distance for msd and knn for PHATE.
edyoshikun Mar 6, 2026
4708412
make a cli for anndata
edyoshikun Mar 6, 2026
a828d7b
add append to obs cli
edyoshikun Mar 6, 2026
4d8a74f
adding a cell index that standardizes and spits out parqet
edyoshikun Mar 7, 2026
154e765
add example cell index
edyoshikun Mar 7, 2026
97baeda
update multiexperiment datamodule
edyoshikun Mar 7, 2026
4f1e282
recipes
edyoshikun Mar 8, 2026
6e692f0
add parquet integration test for multi-experiment training
edyoshikun Mar 11, 2026
36fec3f
demo slurm code
edyoshikun Mar 6, 2026
e0950cb
obs should use fov_name and track_id and id as UUID
edyoshikun Mar 11, 2026
d87e34f
add marker, task and channels to compute the crossval.
edyoshikun Mar 11, 2026
f8e2b69
fix prediction remodeling analysis
edyoshikun Mar 11, 2026
7e57523
Merge branch 'app-dynaclr' of github.com:mehta-lab/VisCy into app-dyn…
edyoshikun Mar 12, 2026
7eb594f
Raw logits are now passed through sigmoid before computing binary_acc…
edyoshikun Mar 12, 2026
7abdf96
fix the dataset statistics
edyoshikun Mar 13, 2026
96ccd7a
add contributing and uv to claude.md
edyoshikun Mar 16, 2026
9153d24
pydantic >2.0
edyoshikun Mar 16, 2026
cb5b723
- Add `schemas.py` with shared Pydantic data models (FOVRecord, etc.)
edyoshikun Mar 16, 2026
649fb18
uvx precommit
edyoshikun Mar 16, 2026
081a411
refactor(viscy-data): replace condition_balanced with stratify_by i…
edyoshikun Mar 16, 2026
eb60763
add norm_meta batching helpers and triplet None guard
edyoshikun Mar 16, 2026
31dc6c1
- Apply _radians_to_degrees to shear_range (Kornia expects degrees,…
edyoshikun Mar 16, 2026
0b3ea18
extend DatasetRecord from FOVRecord in viscy-data schemas; add viscy-…
edyoshikun Mar 16, 2026
6c7a458
- ExperimentRegistry backed by Collection for per-experiment channe…
edyoshikun Mar 16, 2026
37fd754
pass batch_size to Lightning metric logging for correct step counts
edyoshikun Mar 16, 2026
0a3d2e6
update recipes and add sampling-strategies guide; add CLAUDE.md
edyoshikun Mar 16, 2026
80f59eb
update pseudotime and linear classifier scripts for renamed fields
edyoshikun Mar 16, 2026
3d6007e
add configs
edyoshikun Mar 16, 2026
fc08b62
physical nomrlaiztion and fix to mlp projetion layer for adapter.
edyoshikun Mar 17, 2026
f30b4d6
code review fixes: remove _components/, assert→ValueError, docstrings…
edyoshikun Mar 17, 2026
e63b2ce
fix tests: remove test_smoke, update config fields, fix parquet dtype
edyoshikun Mar 17, 2026
8ed0066
rename organelle→marker channel type; fix ArrowString/schema test fai…
edyoshikun Mar 17, 2026
17f5c74
add experiment configs and SLURM scripts
edyoshikun Mar 17, 2026
71b76b6
add linear classifier and pseudotime analysis scripts
edyoshikun Mar 17, 2026
e10f825
fix test_inference_reproducibility: remove stale reference zarr depen…
edyoshikun Mar 17, 2026
81d27e4
fix examples and configs: rename organelle→marker channel type, add o…
edyoshikun Mar 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
129 changes: 129 additions & 0 deletions .ed_planning/physical_scale_normalization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Physical Scale Normalization + Microscope Metadata + Cross-Scope Finetuning

**Branch:** `app-dynaclr`
**Date:** 2026-03-17
**Status:** Implemented, pre-commit passing, unit tests passing

---

## Motivation

Two experiments from different microscopes contain the same biology but differ in:
1. **Pixel/voxel size** — different magnifications mean cells appear at different spatial scales
2. **Embedding space** — microscope-specific biases push same-biology cells apart in latent space

The fix is two-pronged:
- **Physical scale normalization** at read time — adjust the pixel window read from disk so that after rescaling the patch is always exactly the target spatial size. No padding, no empty borders.
- **Cross-scope contrastive finetuning** — finetune the projection MLP with cross-microscope positives (same condition + HPI window) mixed with temporal positives for regularization.

---

## Files Changed

| File | Change |
|---|---|
| `packages/viscy-data/src/viscy_data/collection.py` | Added `microscope`, `pixel_size_xy_um`, `pixel_size_z_um` to `ExperimentEntry` |
| `packages/viscy-data/src/viscy_data/_typing.py` | Added `microscope` to `CELL_INDEX_GROUPING_COLUMNS` |
| `packages/viscy-data/src/viscy_data/cell_index.py` | Added `microscope` to `CELL_INDEX_SCHEMA`; write from experiment in `build_timelapse_cell_index` |
| `packages/viscy-data/tests/test_cell_index.py` | Added `microscope: ""` to `_make_valid_df` fixture |
| `applications/dynaclr/src/dynaclr/data/experiment.py` | `reference_pixel_size_*` params; `scale_factors` computed field; fail-fast validation |
| `applications/dynaclr/src/dynaclr/data/index.py` | Pass `microscope` through `_load_experiment_fovs`; fill `microscope=""` in `_align_parquet_columns` for old parquets |
| `applications/dynaclr/src/dynaclr/data/dataset.py` | `_rescale_patch`; scale-adjusted read window in `_slice_patch`; `_find_cross_scope_positive`; `cross_scope_fraction` + `hpi_window` params; `microscope` in `_META_COLUMNS` |
| `applications/dynaclr/src/dynaclr/data/datamodule.py` | Pass `reference_pixel_size_*`, `cross_scope_fraction`, `hpi_window` through to registry and datasets |
| `applications/dynaclr/src/dynaclr/engine.py` | `freeze_backbone: bool = False`; `on_fit_start` freezes backbone params |
| `applications/dynaclr/configs/training/batch_correction_fit.yml` | New example finetuning config |
| `applications/dynaclr/tests/test_dataset.py` | `TestRescalePatch` (3 tests) + `TestCrossScopePositive` (4 tests) |

---

## Design Decisions

### `None` instead of `0.0` for pixel sizes
`pixel_size_xy_um`, `pixel_size_z_um`, `reference_pixel_size_xy_um`, `reference_pixel_size_z_um` all default to `None`.

- `None` = "not provided / no rescaling requested"
- `0.0` was considered but is physically nonsensical and ambiguous
- Fail-fast `ValueError` in `ExperimentRegistry.__post_init__` if reference size is set but any experiment is missing pixel sizes — catches misconfiguration at `setup()` time, before training starts

### Scale factor convention
```
scale = experiment_um / reference_um
```
- `scale > 1` → experiment has larger pixels → read fewer disk pixels to cover same physical area
- `scale = 1` → no-op (short-circuits interpolation entirely)
- Read window: `y_half = round((patch_size // 2) * scale_y)`
- After read: `F.interpolate(..., size=target, mode="nearest-exact")` back to exact target size

### Cross-scope positives
- `cross_scope_fraction: float = 0.0` — fraction of positives per batch that are cross-microscope
- Match criteria: different `microscope`, same `condition`, `|HPI_anchor - HPI_candidate| <= hpi_window`
- Falls back to temporal positive if no cross-scope candidate found
- Validation at dataset init: raises if `cross_scope_fraction > 0` and any experiment has `microscope = ""`

### Freeze backbone
- `freeze_backbone: bool = False` on `ContrastiveModule`
- Implemented in `on_fit_start` — freezes `self.model.backbone.parameters()`
- Only the projection MLP is updated during finetuning

---

## Backwards Compatibility

All new fields default to `None` / `""` / `0.0`:

| Scenario | Behaviour |
|---|---|
| Old collection YAML (no pixel sizes) | `scale_factors = 1.0` → read window unchanged, no rescaling |
| Old parquet (no `microscope` column) | `_align_parquet_columns` fills `microscope = ""` |
| `cross_scope_fraction = 0.0` (default) | Pure temporal positives — no change to existing behaviour |
| `freeze_backbone = False` (default) | No change to optimizer |

---

## Usage

### Collection YAML — add per experiment
```yaml
experiments:
- name: scope1_exp
microscope: "scope1"
pixel_size_xy_um: 0.2028
pixel_size_z_um: 0.5
...
- name: scope2_exp
microscope: "scope2"
pixel_size_xy_um: 0.1625
pixel_size_z_um: 0.5
...
```

### Datamodule config — enable rescaling + cross-scope finetuning
```yaml
data:
class_path: dynaclr.data.datamodule.MultiExperimentDataModule
init_args:
reference_pixel_size_xy_um: 0.2028 # one scope's pixel size as reference
reference_pixel_size_z_um: 0.5
cross_scope_fraction: 0.5
hpi_window: 1.0
```

### Engine config — freeze backbone for finetuning
```yaml
model:
class_path: dynaclr.engine.ContrastiveModule
init_args:
freeze_backbone: true
lr: 1.0e-5
ckpt_path: path/to/pretrained.ckpt
```

See full example: `applications/dynaclr/configs/training/batch_correction_fit.yml`

---

## TODO

- [ ] Decide whether to add `pixel_size_xy_um`, `pixel_size_z_um`, `microscope` fields to Airtable so `build-collection` can auto-populate them (currently must be filled manually in the YAML)
- [ ] Run `fast_dev_run` smoke test with `batch_correction_fit.yml` once a two-microscope dataset is available
- [ ] QC: verify `stratify_by=["condition", "microscope"]` produces balanced batches across scopes
53 changes: 52 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,61 @@ jobs:
run: uv run --frozen pytest --cov=src/ --cov-report=term-missing
working-directory: packages/${{ matrix.package }}

test-data:
name: Test Data (Python ${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13"]

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up uv with Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-suffix: ${{ matrix.os }}-${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --frozen --all-extras --dev
working-directory: packages/viscy-data

- name: Run tests with coverage
run: uv run --frozen pytest --cov=viscy_data --cov-report=term-missing
working-directory: packages/viscy-data

test-data-extras:
name: Test Data Extras (Python 3.13, ubuntu-latest)
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up uv with Python 3.13
uses: astral-sh/setup-uv@v7
with:
python-version: "3.13"
enable-cache: true
cache-suffix: ubuntu-latest-3.13

- name: Install dependencies
run: uv sync --frozen --all-extras --dev
working-directory: packages/viscy-data

- name: Run tests with coverage
run: uv run --frozen pytest --cov=viscy_data --cov-report=term-missing -m "not slow"
working-directory: packages/viscy-data

check:
name: All tests pass
if: always()
needs: [test]
needs: [test, test-data, test-data-extras]
runs-on: ubuntu-latest
steps:
- name: Verify all test jobs succeeded
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Secrets
.env

# IDE/Editor
.idea/
.vscode/
Expand Down
Loading