# ukexe/cognitive-function-simulation architecture

> Architecture diagram of the GitHub repository ukexe/cognitive-function-simulation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ukexe/cognitive-function-simulation
- Repository: https://github.com/ukexe/cognitive-function-simulation

## Overview

##### Main Components
- Simulation Engine: Represented by the primary simulation scripts (A1.py and A2.py) which configure and run the neural network simulations. This component will integrate Brian2 to simulate the biophysical models.
- Neural Model & STDP Module: A distinct logical unit or subcomponent within the simulation engine responsible for encapsulating the details of the neuronal model parameters (membrane capacitance, leak conductance, threshold, exponential sharpness) and synaptic plasticity rules.
- Visualization Suite: A separate module handling real-time raster plots, membrane potentials, and synaptic current flows. This component is evidenced by the inclusion of dynamic plots (temp-plot.html) and visualization notebooks that illustrate network behavior.
- Data & Parameter Configuration: A component responsible for setting up simulation parameters (as highlighted in the README) and possibly handling output data from simulation runs.
- Auxiliary/Support Components: This includes additional resources such as the “imgs” directory for storing visual assets, and notebooks for exploratory analysis (e.g., 2D.ipynb, 3D.ipynb, final-venn.ipynb).

##### Component Relationships & Data Flow
- The Simulation Engine then passes the computed neural network interactions to the Neural Model & STDP Module, which encapsulates the detailed computation of neuron dynamics.
- Outputs from the simulation core flow into the Visualization Suite, where data is represented in real-time or via post-simulation plots.

##### Architectural Patterns and Technologies
- Modular design (separating simulation logic from visualization and configuration management).
- Use of established scientific libraries (Brian2 for neuronal dynamics; NumPy for numerical computations; Matplotlib for plotting) as key technologies within the simulation engine and visualization modules.
- That the entire system is driven by parameterized scripts, with Jupyter notebooks serving as a flexible interface for analysis and demonstration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Configuration/Parameters
    subgraph "Configuration"
        CP["Configuration/Parameters"]:::config
    end

    %% Simulation Engine
    subgraph "Simulation Engine"
        A1["A1.py"]:::simulation
        A2["A2.py"]:::simulation
        SM["Neural Model & STDP"]:::simulation
    end

    %% Visualization Suite
    subgraph "Visualization Suite"
        Temp["temp-plot.html"]:::vis
        NB2D["2D.ipynb"]:::vis
        NB3D["3D.ipynb"]:::vis
        NBUnt["Untitled.ipynb"]:::vis
        NBFinal["final-venn.ipynb"]:::vis
    end

    %% Auxiliary/Support Components
    subgraph "Auxiliary/Support Components"
        Imgs["imgs (Visual Assets)"]:::aux
        NBUnt1["Untitled1.ipynb"]:::aux
        NBCheck["Notebook Checkpoints"]:::aux
    end

    %% Data Flow
    CP -->|"feeds"| A1
    CP -->|"feeds"| A2
    A1 -->|"configures"| SM
    A2 -->|"configures"| SM
    SM -->|"outputs to"| Temp
    Temp -->|"drives"| NB2D
    Temp -->|"drives"| NB3D
    Temp -->|"drives"| NBUnt
    Temp -->|"drives"| NBFinal
    NBFinal -->|"inspires"| NBUnt1
    NB3D -->|"inspires"| NBCheck
    NBUnt1 -.->|"feedback"| A1
    NBCheck -.->|"feedback"| A2

    %% Click Events for Simulation Engine
    click A1 "https://github.com/ukexe/cognitive-function-simulation/blob/main//A1.py"
    click A2 "https://github.com/ukexe/cognitive-function-simulation/blob/main//A2.py"

    %% Click Events for Configuration
    click CP "https://github.com/ukexe/cognitive-function-simulation/blob/main//README.md"

    %% Click Events for Visualization Suite
    click Temp "https://github.com/ukexe/cognitive-function-simulation/blob/main//temp-plot.html"
    click NB2D "https://github.com/ukexe/cognitive-function-simulation/blob/main//2D.ipynb"
    click NB3D "https://github.com/ukexe/cognitive-function-simulation/blob/main//3D.ipynb"
    click NBUnt "https://github.com/ukexe/cognitive-function-simulation/blob/main//Untitled.ipynb"
    click NBFinal "https://github.com/ukexe/cognitive-function-simulation/blob/main//final-venn.ipynb"

    %% Click Events for Auxiliary/Support Components
    click Imgs "https://github.com/ukexe/cognitive-function-simulation/tree/main//imgs"
    click NBUnt1 "https://github.com/ukexe/cognitive-function-simulation/blob/main//Untitled1.ipynb"
    click NBCheck "https://github.com/ukexe/cognitive-function-simulation/blob/main/.ipynb_checkpoints"

    %% Styles
    classDef config fill:#d9ead3,stroke:#38761d,stroke-width:2px;
    classDef simulation fill:#ead1dc,stroke:#8e7cc3,stroke-width:2px;
    classDef vis fill:#c9daf8,stroke:#1155cc,stroke-width:2px;
    classDef aux fill:#fff2cc,stroke:#bf9000,stroke-width:2px;
```
