# jsnowacki/xppy architecture

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

- Interactive diagram: https://gitdiagram.com/jsnowacki/xppy
- Repository: https://github.com/jsnowacki/xppy

## Overview

##### Project type and purpose
- Type: Open-source Python library (tool)
- Purpose: Provide a Python interface to Bard Ermentrout’s XPP simulator—parse and modify XPP ODE/SET files, launch simulations, wrap simulation outputs in Python objects, and supply plotting utilities.

##### File structure
- Top-level:
- setup.py, README.txt, COPYING.txt, MANIFEST.in, Doxyfile (build, packaging, docs)
- xppyDemo.py (example script)
- xppy/ (main package)
- xppy/parser/
- parse.py (read/.ode/.set files)
- run.py (invoke XPP executable, manage simulation lifecycle)
- xppy/utils/
- data.py, allinfo.py, solution.py (classes wrapping different XPP output types)
- output.py, allutils.py (I/O helpers, shared utilities)
- No network/UI layers; core is a library + wrapper around an external CLI tool.

##### README for additional insights
- External dependencies: NumPy (data arrays), Matplotlib (optional plotting).
- Must have XPP in PATH (external process to spawn).
- Doxygen folder (doc/) for API docs—indicates a documentation generation step.

## Diagram (Mermaid)

```mermaid
graph TD
    %% User Code
    UserCode["User Code\n(xppyDemo.py)"]:::user
    click UserCode "https://github.com/jsnowacki/xppy/blob/master/xppyDemo.py"

    %% Parser and Runner
    subgraph "Parser Layer" 
        Parse["parse.py\n(read/.ode/.set)"]:::core
        click Parse "https://github.com/jsnowacki/xppy/blob/master/xppy/parser/parse.py"
    end

    subgraph "Runner Layer"
        Run["run.py\n(subprocess adapter)"]:::core
        click Run "https://github.com/jsnowacki/xppy/blob/master/xppy/parser/run.py"
    end

    %% External Process
    XPPExec["XPP Executable\n(xppaut CLI)"]:::external

    %% Data Wrappers
    subgraph "Data Wrappers"
        DataObj["data.py\n(raw data objects)"]:::core
        click DataObj "https://github.com/jsnowacki/xppy/blob/master/xppy/utils/data.py"
        AllInfo["allinfo.py\n(all-info objects)"]:::core
        click AllInfo "https://github.com/jsnowacki/xppy/blob/master/xppy/utils/allinfo.py"
        Solution["solution.py\n(solution objects)"]:::core
        click Solution "https://github.com/jsnowacki/xppy/blob/master/xppy/utils/solution.py"
    end

    %% Visualization
    subgraph "Visualization Tools"
        Plot["plot.py\n(Matplotlib plots)"]:::core
        click Plot "https://github.com/jsnowacki/xppy/blob/master/xppy/utils/plot.py"
        Diagram["diagram.py\n(diagram utilities)"]:::core
        click Diagram "https://github.com/jsnowacki/xppy/blob/master/xppy/utils/diagram.py"
    end

    %% Utilities
    subgraph "Utilities"
        Output["output.py\n(I/O helpers)"]:::core
        click Output "https://github.com/jsnowacki/xppy/blob/master/xppy/utils/output.py"
        AllUtils["allutils.py\n(shared utilities)"]:::core
        click AllUtils "https://github.com/jsnowacki/xppy/blob/master/xppy/utils/allutils.py"
    end

    %% External Libraries
    NumPy["NumPy"]:::third
    Matplotlib["Matplotlib"]:::third

    %% Build and Docs
    Setup["setup.py\n(package entry)"]:::build
    click Setup "https://github.com/jsnowacki/xppy/blob/master/setup.py"
    Doxygen["Doxyfile\n(doc config)"]:::build
    click Doxygen "https://github.com/jsnowacki/xppy/tree/master/Doxyfile"

    %% Connections
    UserCode -->|imports API| Parse
    Parse -->|writes temp .ode/.set files| Run
    Run -->|subprocess call| XPPExec
    XPPExec -->|generates .dat/.allinfo files| DataObj
    XPPExec -->|generates .dat/.allinfo files| AllInfo
    XPPExec -->|generates .dat/.allinfo files| Solution

    DataObj -->|"NumPy arrays"| Plot
    AllInfo -->|"NumPy arrays"| Plot
    Solution -->|"NumPy arrays"| Plot

    DataObj -->|provides data| Diagram
    AllInfo -->|provides data| Diagram
    Solution -->|provides data| Diagram

    DataObj -->|"I/O calls"| Output
    AllInfo -->|"I/O calls"| Output
    Solution -->|"I/O calls"| Output

    Parse -->|uses| NumPy
    DataObj -->|uses| NumPy
    AllInfo -->|uses| NumPy
    Solution -->|uses| NumPy

    Plot -->|uses| Matplotlib
    Diagram -->|uses| Matplotlib

    Setup -->|setup| UserCode
    Setup -->|setup| Parse
    Doxygen -->|docs| UserCode
    Doxygen -->|docs| Parse

    %% Styles
    classDef core fill:#cce5ff,stroke:#004085,color:#004085;
    classDef external fill:#d4edda,stroke:#155724,color:#155724,stroke-dasharray: 5 5;
    classDef third fill:#fff3cd,stroke:#856404,color:#856404;
    classDef build fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
    classDef user fill:#f8d7da,stroke:#721c24,color:#721c24;
```
