# rongmon/rbcodes architecture

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

- Interactive diagram: https://gitdiagram.com/rongmon/rbcodes
- Repository: https://github.com/rongmon/rbcodes

## Overview

##### Project type and purpose
- This is an open-source Python toolkit (“rbcodes”) for astrophysical research and spectral analysis.
- It bundles a collection of core processing modules (continuum fitting, equivalent width computation, halo profiling, lens separation, etc.), GUI front-ends for interactive work, command-line scripts, example data, and tests.

##### File structure
- Top-level directories:
- GUIs: multiple GUI front-ends (abstools, multispecviewer, specgui, spectral_gui, zgui).
- IGM: core routines for intergalactic medium (continuum fitting, equivalent width).
- halo, lensing, catalog, rbstat: astrophysics-specific processing modules.
- utils: shared utilities (FITS I/O, region writing, SNR, etc.).
- tests: unit tests organized per module.
- docs: user and developer documentation for each component.
- Configuration files (environment.yml, requirements_simple.txt) declare dependencies.
- Example data sits under example-data for integration and demonstration.

##### README for additional insights
- Purpose: consolidate commonly used research codes into a single package, with GUIs and CLIs.
- Documentation lives in docs/main_readme.md.
- MIT-licensed, community contributions welcome.

##### Elements
- “calls” relationships (e.g. GUIs → IGM module)
- “reads/writes” data flows (e.g. IGM → FITS files)
- Presentation (blue)
- Domain logic (green)
- Utilities (yellow)
- Data sources (gray)

##### Detailed capturing of essential elements
- Testing layer invoking both GUIs and core modules.
- Documentation (docs/) as a side artifact depending on the codebase.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Abstools["AbsTools GUI"]:::presentation
        MultiSpecViewer["Multi-Spec Viewer GUI"]:::presentation
        SpecGUI["SpecGUI"]:::presentation
        SpectralGUI["Spectral GUI"]:::presentation
        ZGUI["ZGUI"]:::presentation
        computeEW["Equivalent Width CLI"]:::presentation
        contFit["Continuum Fitting CLI"]:::presentation
        lensSep["Lens Separation CLI (IGM)"]:::presentation
        lensAngSep["Lens Separation CLI (Lensing)"]:::presentation
        catalogSearch["Catalog Search CLI"]:::presentation
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        IGM["Intergalactic Medium (IGM)"]:::domain
        Halo["Halo Profiling"]:::domain
        Lensing["Gravitational Lensing"]:::domain
        Catalog["Catalog Operations"]:::domain
        RBStat["Statistical Routines"]:::domain
    end

    %% Utility Layer
    subgraph "Utility Layer"
        direction TB
        Utils["Shared Utilities"]:::utility
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        ExampleData["Example Data Sets"]:::data
    end

    %% Testing Layer
    subgraph "Testing Layer"
        direction TB
        TestGUI["Unit Tests for GUIs"]:::test
        TestIGM["Unit Tests for IGM"]:::test
        OtherTests["Other Module Tests"]:::test
    end

    %% Documentation
    Docs["Documentation (docs/)"]:::docs

    %% Relationships
    Abstools -->|"calls"| IGM
    MultiSpecViewer -->|"calls"| IGM
    SpecGUI -->|"calls"| IGM
    SpectralGUI -->|"calls"| IGM
    ZGUI -->|"calls"| IGM

    computeEW -->|"calls"| IGM
    contFit -->|"calls"| IGM
    lensSep -->|"calls"| IGM
    lensAngSep -->|"calls"| Lensing
    catalogSearch -->|"calls"| Catalog

    IGM -->|"uses"| Utils
    Halo -->|"uses"| Utils
    Lensing -->|"uses"| Utils
    Catalog -->|"uses"| Utils
    RBStat -->|"uses"| Utils

    ExampleData -->|"reads"| IGM
    ExampleData -->|"reads"| Halo
    ExampleData -->|"reads"| Lensing
    ExampleData -->|"reads"| Catalog
    ExampleData -->|"reads"| RBStat

    IGM -->|"writes outputs"| ExampleData

    TestGUI -->|"tests"| Abstools
    TestGUI -->|"tests"| MultiSpecViewer
    TestGUI -->|"tests"| SpecGUI
    TestGUI -->|"tests"| SpectralGUI
    TestGUI -->|"tests"| ZGUI

    TestIGM -->|"tests"| IGM
    OtherTests -->|"tests"| Halo
    OtherTests -->|"tests"| Lensing
    OtherTests -->|"tests"| Catalog
    OtherTests -->|"tests"| RBStat

    Docs -.->|“documents”| Abstools
    Docs -.->|“documents”| IGM
    Docs -.->|“documents”| Utils
    Docs -.->|“documents”| example-data

    %% Click Events
    click Abstools "https://github.com/rongmon/rbcodes/tree/master/GUIs/abstools/"
    click MultiSpecViewer "https://github.com/rongmon/rbcodes/tree/master/GUIs/multispecviewer/"
    click SpecGUI "https://github.com/rongmon/rbcodes/tree/master/GUIs/specgui/"
    click SpectralGUI "https://github.com/rongmon/rbcodes/tree/master/GUIs/spectral_gui/"
    click ZGUI "https://github.com/rongmon/rbcodes/tree/master/GUIs/zgui/"
    click computeEW "https://github.com/rongmon/rbcodes/blob/master/IGM/compute_EW.py"
    click contFit "https://github.com/rongmon/rbcodes/blob/master/IGM/cont_fit_poly_ransac.py"
    click lensSep "https://github.com/rongmon/rbcodes/blob/master/IGM/lens_sep.py"
    click lensAngSep "https://github.com/rongmon/rbcodes/blob/master/lensing/lens_ang_sep.py"
    click catalogSearch "https://github.com/rongmon/rbcodes/blob/master/catalog/rb_search.py"
    click IGM "https://github.com/rongmon/rbcodes/tree/master/IGM/"
    click Halo "https://github.com/rongmon/rbcodes/tree/master/halo/"
    click Lensing "https://github.com/rongmon/rbcodes/tree/master/lensing/"
    click Catalog "https://github.com/rongmon/rbcodes/tree/master/catalog/"
    click RBStat "https://github.com/rongmon/rbcodes/tree/master/rbstat/"
    click Utils "https://github.com/rongmon/rbcodes/tree/master/utils/"
    click ExampleData "https://github.com/rongmon/rbcodes/tree/master/example-data/"
    click TestGUI "https://github.com/rongmon/rbcodes/tree/master/tests/test_gui/"
    click TestIGM "https://github.com/rongmon/rbcodes/tree/master/tests/test_igm/"
    click Docs "https://github.com/rongmon/rbcodes/tree/master/docs/"

    %% Styles
    classDef presentation fill:#D0E8F2,stroke:#333,stroke-width:1px
    classDef domain fill:#D0F2D0,stroke:#333,stroke-width:1px
    classDef utility fill:#F2E0A0,stroke:#333,stroke-width:1px
    classDef data fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef test fill:#F2D0E8,stroke:#333,stroke-width:1px
    classDef docs fill:#F2CFC2,stroke:#333,stroke-width:1px
```
