Skip to content

Add tuple-pattern return format for simulate and gen_images#31

Merged
kalidke merged 11 commits intomainfrom
feature/tuple-pattern
Feb 7, 2026
Merged

Add tuple-pattern return format for simulate and gen_images#31
kalidke merged 11 commits intomainfrom
feature/tuple-pattern

Conversation

@kalidke
Copy link
Member

@kalidke kalidke commented Feb 2, 2026

Summary

  • BREAKING CHANGE: All simulation and image generation functions now return (output, info) tuples
  • simulate(::StaticSMLMParams) returns (smld_noisy, SimInfo) with intermediate results in info
  • simulate(::DiffusionSMLMParams) returns (smld, SimInfo)
  • gen_images() and gen_image() return (images/image, ImageInfo)
  • New SimInfo and ImageInfo types provide timing, counts, and metadata

Test plan

  • All 275 existing tests updated and passing
  • SimInfo fields validated in tests
  • ImageInfo fields validated in tests
  • Documentation updated (api_overview.md, README.md)

🤖 Generated with Claude Code

kalidke and others added 11 commits January 22, 2026 18:01
Introduces AbstractLabeling type hierarchy to separate labeling statistics
from molecule photophysics:

- FixedLabeling: deterministic n fluorophores per site
- PoissonLabeling: Poisson-distributed fluorophores per site
- BinomialLabeling: binomial-distributed (n trials, p probability)

All types include labeling_efficiency parameter for probability that
a site gets labeled at all.

Key design decisions:
- Labeling is orthogonal to Molecule (photophysics) - enables composition
- Default FixedLabeling(n=1, efficiency=1.0) preserves backward compatibility
- apply_labeling() dispatches on labeling type for coordinate expansion
- Metadata tracks labeling_type and labeling_params

Usage:
  simulate(params; pattern=Nmer2D(), labeling=PoissonLabeling(1.5), molecule=fluor)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Update emitter constructors in simulation.jl, photophysics.jl, and
  coordinate_noise.jl to set σ_xy=0.0 (correct for symmetric PSFs)
- Update test files to use new Emitter2DFit keyword constructor format
- Require SMLMData >= 0.5.1 for σ_xy field support

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add burn_in parameter to intensity_trace() and kinetic_model() for
  simulating pre-illumination before recording (photobleaching models)
- Add state1 parameter to simulate() for explicit initial state control
- Fix CTMC warnings for absorbing states (Q[i,i]=0 is valid)
- Update api_overview.md with labeling types documentation
- Update CLAUDE.md with simulation pipeline documentation

burn_in is useful for 3-state photobleaching models where you want to
simulate the experimental protocol of high laser power for several
seconds before data collection begins.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- uniform2D/uniform3D now return pattern_ids indicating pattern membership
- apply_labeling preserves pattern_ids through expansion (with backward-compat overloads)
- Emitters now carry pattern id through simulation pipeline
- Update SMLMData compat to "0.5, 0.6"
- Update documentation for new return signatures

Co-Authored-By: Claude Opus 4.5 <[email protected]>
BREAKING CHANGE: All simulation and image generation functions now return
(output, info) tuples instead of single values or 3-tuples.

Changes:
- simulate(::StaticSMLMParams) returns (smld_noisy, SimInfo)
  - SimInfo contains smld_true, smld_model, timing, and counts
- simulate(::DiffusionSMLMParams) returns (smld, SimInfo)
- gen_images() returns (images, ImageInfo)
- gen_image() returns (image, ImageInfo)

New types:
- SimInfo: elapsed_ns, backend, device_id, seed, smld_true, smld_model,
  n_patterns, n_emitters, n_localizations, n_frames
- ImageInfo: elapsed_ns, backend, device_id, frames_generated,
  n_photons_total, output_size

Bump version to 0.5.0

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- SimInfo.elapsed_s::Float64 (was elapsed_ns::UInt64)
- ImageInfo.elapsed_s::Float64 (was elapsed_ns::UInt64)
- Time now stored directly in seconds for convenience

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Breaking change: Renamed simulation config types for consistency:
- StaticSMLMParams -> StaticSMLMConfig
- DiffusionSMLMParams -> DiffusionSMLMConfig

Updated all source files, tests, and documentation.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Breaking changes in this release:
- simulate() returns (output, info) tuple instead of 3-tuple or single value
- gen_images()/gen_image() return (images, ImageInfo) tuple
- StaticSMLMParams renamed to StaticSMLMConfig
- DiffusionSMLMParams renamed to DiffusionSMLMConfig

Co-Authored-By: Claude Opus 4.5 <[email protected]>
SMLMSimParams <: AbstractSMLMConfig, SimInfo <: AbstractSMLMInfo,
ImageInfo <: AbstractSMLMInfo. Remove unused AbstractSim type.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Requires SMLMData v0.7.0 which provides AbstractSMLMConfig and
AbstractSMLMInfo abstract types for the tuple pattern.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@kalidke kalidke changed the base branch from label to main February 7, 2026 19:12
@kalidke kalidke merged commit 8cd4595 into main Feb 7, 2026
0 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant