# astrohuntsman/gunagala architecture

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

- Interactive diagram: https://gitdiagram.com/astrohuntsman/gunagala
- Repository: https://github.com/astrohuntsman/gunagala

## Overview

- Core Library (Gunagala Package): Represent this as the heart of the system. Inside the “gunagala” directory, include the primary modules:
- camera.py – Handles camera modeling and performance simulation.
- imager.py – Simulates imaging aspects of the instruments.
- optic.py – Contains functions related to optical components.
- optical_filter.py – Manages filtering aspects in simulation.
- psf.py – Deals with point spread functions.
- sky.py – Incorporates sky model data and calculations.
- config.py – Manages configuration settings.
- _astropy_init.py – Likely used for Astropy package integration considerations.
- Data Management:
- Data Resources Folder (“gunagala/data”): Encompasses CSV files, YAML configurations (performance.yaml), and FITS files. This represents the raw observational data and performance metrics that feed into the simulation.
- Testing Suite:
- The “gunagala/tests” directory shows unit tests for each major component. Identify these as validation layers that ensure the correctness of the simulation modules.
- Documentation & Examples:
- The “docs” directory and the “examples” folder provide user guidance and use case demonstrations. While they are not part of the core logic, they provide insights into how the package should be used.
- Build and Package Infrastructure:
- Files like setup.py, setup.cfg, MANIFEST.in, and ez_setup.py indicate packaging, distribution, and build aspects for the project.
- Ancillary Tools:
- Directories or files like “astropy_helpers”, CI configurations (.travis.yml, readthedocs.yml), and licensing files are important for project management and integration.

##### Relationships and Interactions
- Data inputs (CSV, YAML, FITS) flow into the core modules (camera, imager, psf, etc.), which then process this information to perform calculations and simulations.
- The configuration module (config.py) acts as an intermediary that passes setup parameters to the individual simulation modules.
- How each module might depend on others:
- For example, the “imager” module might use data manipulations from “camera” and “optic”, while “psf” interacts with both optical parameters from “optic” and image simulation routines in “imager”.
- External Dependencies:
- Make a note of external libraries (particularly Astropy, as well as any dependencies hinted by astropy_helpers) that are fundamental to how these modules operate.

##### Important Architectural Patterns and Design Principles
- Modularity: The separation of concerns is clear – each module (camera, imager, etc.) is responsible for a specific aspect of the simulation.
- Data-Driven Design: There is a strong focus on ingesting and processing external data (CSV, YAML, FITS) that drives the simulation engine.
- Testing as a Core Principle: A dedicated testing suite reinforces the design’s focus on reliability and correctness.

##### Final Steps
- That the primary goal is to capture interaction patterns between core modules and data sources along with integration points with external libraries.

## Diagram (Mermaid)

```mermaid
flowchart TD 
    %% High-Level System Overview
    subgraph "Core Library (Gunagala)"
        CAM["Camera Simulation Module"]:::core
        IMG["Imaging Simulation Module"]:::core
        OPT["Optical Computation Module"]:::core
        OF["Optical Filter Module"]:::core
        PSF["PSF Module"]:::core
        SKY["Sky Model Module"]:::core
        CFG["Configuration Module"]:::core
        AST["Astropy Integration"]:::core
    end

    DATA["Data Repository"]:::data
    DATA_SKY["Sky Data Files"]:::data

    TEST["Testing Suite"]:::test
    DOC["Documentation"]:::doc
    EX["Examples"]:::doc
    PKG["Packaging & Build Scripts"]:::pkg
    ANC["Astropy Helpers & CI/License"]:::anc
    EXT["External Libraries (Astropy)"]:::ext

    %% Data Flow Relationships
    DATA -->|"feeds"| CAM
    DATA -->|"feeds"| IMG
    DATA -->|"feeds"| PSF
    DATA -->|"feeds"| SKY
    DATA --> DATA_SKY

    %% Configuration Dependency
    CFG -->|"configures"| CAM
    CFG -->|"configures"| IMG
    CFG -->|"configures"| PSF
    CFG -->|"configures"| SKY
    CFG -->|"configures"| OF
    CFG -->|"configures"| OPT

    %% Intra-module Interactions
    CAM -->|"provides data"| IMG
    OPT -->|"supplies optics"| PSF
    IMG -->|"calls simulation"| PSF

    %% External Dependencies
    EXT -->|"integrates with"| AST

    %% Supporting Components
    TEST -->|"validates"| CAM
    TEST -->|"validates"| IMG
    TEST -->|"validates"| OPT
    TEST -->|"validates"| OF
    TEST -->|"validates"| PSF
    TEST -->|"validates"| SKY

    DOC -->|"guides usage of"| CAM
    DOC -->|"guides usage of"| IMG
    DOC -->|"guides usage of"| OPT
    DOC -->|"guides usage of"| OF
    DOC -->|"guides usage of"| PSF
    DOC -->|"guides usage of"| SKY

    EX -->|"demonstrates usecases for"| CAM
    EX -->|"demonstrates usecases for"| IMG
    EX -->|"demonstrates usecases for"| OPT
    EX -->|"demonstrates usecases for"| OF
    EX -->|"demonstrates usecases for"| PSF
    EX -->|"demonstrates usecases for"| SKY

    PKG -->|"builds and packages"| CFG
    PKG -->|"builds and packages"| CAM
    PKG -->|"builds and packages"| IMG
    PKG -->|"builds and packages"| OPT
    PKG -->|"builds and packages"| OF
    PKG -->|"builds and packages"| PSF
    PKG -->|"builds and packages"| SKY

    ANC -->|"supports"| AST
    ANC -->|"supports"| CFG

    %% Click Events for Core Library Modules
    click CAM "https://github.com/astrohuntsman/gunagala/blob/develop/gunagala/camera.py"
    click IMG "https://github.com/astrohuntsman/gunagala/blob/develop/gunagala/imager.py"
    click OPT "https://github.com/astrohuntsman/gunagala/blob/develop/gunagala/optic.py"
    click OF "https://github.com/astrohuntsman/gunagala/blob/develop/gunagala/optical_filter.py"
    click PSF "https://github.com/astrohuntsman/gunagala/blob/develop/gunagala/psf.py"
    click SKY "https://github.com/astrohuntsman/gunagala/blob/develop/gunagala/sky.py"
    click CFG "https://github.com/astrohuntsman/gunagala/blob/develop/gunagala/config.py"
    click AST "https://github.com/astrohuntsman/gunagala/blob/develop/gunagala/_astropy_init.py"

    %% Click Events for Data Management
    click DATA "https://github.com/astrohuntsman/gunagala/tree/develop/gunagala/data"
    click DATA_SKY "https://github.com/astrohuntsman/gunagala/tree/develop/gunagala/data/sky_data"

    %% Click Event for Testing Suite
    click TEST "https://github.com/astrohuntsman/gunagala/tree/develop/gunagala/tests"

    %% Click Events for Documentation & Examples
    click DOC "https://github.com/astrohuntsman/gunagala/tree/develop/docs"
    click EX "https://github.com/astrohuntsman/gunagala/tree/develop/examples"

    %% Click Event for Packaging & Build Infrastructure
    click PKG "https://github.com/astrohuntsman/gunagala/blob/develop/setup.py"

    %% Click Event for Ancillary Tools
    click ANC "https://github.com/astrohuntsman/gunagala/tree/develop/astropy_helpers"

    %% Class Definitions for Colors
    classDef core fill:#cce5ff,stroke:#003399,stroke-width:2px;
    classDef data fill:#ccffcc,stroke:#228B22,stroke-width:2px;
    classDef test fill:#fff2cc,stroke:#d79922,stroke-width:2px;
    classDef doc fill:#e6ccff,stroke:#9933cc,stroke-width:2px;
    classDef pkg fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef anc fill:#d9edf7,stroke:#31708f,stroke-width:2px;
    classDef ext fill:#f9f2ec,stroke:#8a6d3b,stroke-width:2px;
```
