Skip to content

[Feature] Asynchronous dynamic timelapse with per-embryo independent scheduling #2

Description

@pskeshu

Description

Enhance the existing TimelapseOrchestrator to support truly asynchronous, dynamically configurable timelapse acquisition where each embryo operates on independent schedules that can be modified at runtime.

Current State

  • TimelapseOrchestrator exists with background asyncio task
  • Per-embryo EmbryoAcquisitionState tracks intervals and timepoints
  • Stop conditions and interval rules exist but are set at start time

Requirements

1. Independent Embryo Scheduling

Each embryo should have its own acquisition schedule that can be started/stopped/modified independently without affecting others.

2. Dynamic Configuration

Allow runtime modification of:

  • Acquisition intervals per embryo
  • Number of slices, exposure settings
  • Stop conditions (add/remove/modify)
  • Priority ordering
  • Focus drift correction parameters

3. Spawn-on-Demand

Ability to add new embryos to an ongoing timelapse without restarting.

4. Asynchronous Event Handling

  • Detection-triggered interval changes should apply immediately
  • Stage-based adaptive imaging (speed up before hatching)

5. Fluorescence Signal-Driven Acquisition

  • Monitor embryos periodically (low frequency) for fluorescence signal expression (e.g., red channel)
  • When signal starts expressing, automatically increase imaging frequency for that embryo
  • Support configurable signal thresholds and frequency escalation rules
  • Use case: Late-expressing reporters where expression timing varies per embryo

Technical Approach

  • Refactor TimelapseOrchestrator._run_loop() to use per-embryo asyncio tasks instead of sequential loop
  • Add EmbryoTimelapseTask class managing individual embryo acquisition lifecycle
  • Add real-time configuration update API via tools
  • Implement FluorescenceMonitor for signal-triggered acquisition:
    • Periodic low-frequency monitoring task (configurable interval)
    • Signal detection via intensity thresholding or detector system
    • Automatic interval adjustment rules when signal detected
    • Per-embryo signal tracking state

Key Files

  • gently/agent/timelapse_orchestrator.py
  • gently/agent/state.py (EmbryoAcquisitionState)
  • gently/agent/tools/timelapse_tools.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    acquisitionAcquisition/timelapse relatedenhancementNew feature or requestpriority-highCritical for core functionality

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions