# michaeldalbrow/dazzle architecture

> Architecture diagram of the GitHub repository michaeldalbrow/dazzle, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/michaeldalbrow/dazzle
- Repository: https://github.com/michaeldalbrow/dazzle

## Overview

##### Project type and purpose
- From the file tree and README, Dazzle is a Python library/CLI tool (not a web or distributed microservice) for over‐sampled image construction, difference imaging, transient detection, and PSF photometry, targeted at the Nancy Grace Roman Space Telescope data.

##### File structure
- Top‐level items:
- LICENSE, README.md, PSFs/ (data folder), dazzel_paper.pdf (paper)
- Package directory “dazzle/” with four core modules:
– dazzel.py (entry points and orchestration)
– detect.py (transient detection logic)
– make_psf_grid.py (PSF oversampling)
– photometry.py (difference‐image PSF photometry)
– utils.py (shared utilities, I/O, FITS handling)
- tests/ directory with JSON configs, test scripts, and fixtures.

##### README for additional insights
- Workflow is linear and script‐driven:
1) difference‐image construction
2) transient detection
3) photometry
- Configuration via JSON that controls input data paths, image splits, iteration counts.
- Parallel processing by splitting large images into blocks.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Control Plane
    subgraph "Control Plane"
        ConfigLoader["Configuration Loader"]:::control
        Orch1["test_difference_images.py"]:::control
        Orch2["test_detect.py"]:::control
        Orch3["test_photometry.py"]:::control
    end

    %% Compute Plane
    subgraph "Compute Plane"
        PSFO["PSF Oversampler"]:::compute
        DIP["Difference-Image Processor"]:::compute
        TD["Transient Detector"]:::compute
        PPE["PSF Photometry Engine"]:::compute
    end

    %% Data Plane
    subgraph "Data Plane"
        DM["Data Manager (FITS & PSFs)"]:::data
        Out["Output Storage"]:::data
    end

    %% Utilities/Test
    Utilities["Utilities"]:::util
    TestHarness["Test Harness"]:::util

    %% Control Flow
    ConfigLoader --> Orch1
    ConfigLoader --> Orch2
    ConfigLoader --> Orch3

    %% Pipeline Stages
    Orch1 --> PSFO
    PSFO --> DIP
    Orch2 --> TD
    Orch3 --> PPE

    %% Data Flow
    DM --> PSFO
    DM --> DIP
    DIP --> TD
    DIP --> PPE
    TD --> PPE
    PSFO --> Out
    DIP --> Out
    TD --> Out
    PPE --> Out

    %% Utilities Usage
    PSFO -->|"uses"| Utilities
    DIP -->|"uses"| Utilities
    TD -->|"uses"| Utilities
    PPE -->|"uses"| Utilities

    %% Test Harness
    TestHarness --> Orch1
    TestHarness --> Orch2
    TestHarness --> Orch3

    %% Image Splitting Annotation
    DIP -->|"splits into tiles (parallel)"| DIP

    %% Click Events
    click ConfigLoader "https://github.com/michaeldalbrow/dazzle/blob/main/tests/config_paper_split.json"
    click DM "https://github.com/michaeldalbrow/dazzle/tree/main/PSFs/"
    click PSFO "https://github.com/michaeldalbrow/dazzle/blob/main/dazzle/make_psf_grid.py"
    click DIP "https://github.com/michaeldalbrow/dazzle/blob/main/dazzle/dazzle.py"
    click TD "https://github.com/michaeldalbrow/dazzle/blob/main/dazzle/detect.py"
    click PPE "https://github.com/michaeldalbrow/dazzle/blob/main/dazzle/photometry.py"
    click Utilities "https://github.com/michaeldalbrow/dazzle/blob/main/dazzle/utils.py"
    click Orch1 "https://github.com/michaeldalbrow/dazzle/blob/main/tests/test_difference_images.py"
    click Orch2 "https://github.com/michaeldalbrow/dazzle/blob/main/tests/test_detect.py"
    click Orch3 "https://github.com/michaeldalbrow/dazzle/blob/main/tests/test_photometry.py"
    click TestHarness "https://github.com/michaeldalbrow/dazzle/blob/main/tests/context.py"

    %% Styles
    classDef control fill:#a6cee3,stroke:#1f78b4,color:#000;
    classDef compute fill:#b2df8a,stroke:#33a02c,color:#000;
    classDef data fill:#fb9a99,stroke:#e31a1c,color:#000;
    classDef util fill:#cccccc,stroke:#333333,color:#000;
```
