# neuralmodeling/vismotion architecture

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

- Interactive diagram: https://gitdiagram.com/neuralmodeling/vismotion
- Repository: https://github.com/neuralmodeling/vismotion

## Overview

#### Purpose and execution surface
This is a Python research repository implementing the paper’s primate-informed neural dynamic model for motion-perception decision making, alongside a comparison CNN and experiment/visualization code. There is no package directory or declared CLI; execution is likely script/notebook-style through model modules and experiment drivers:
- `vismodel.py`
- `psych_vismodel.py`
- `motnet.py`

#### Neural dynamic-model stack
The biologically motivated model is assembled from explicit neuron and synapse dynamics, with CUDA-oriented implementations for simulation performance:
- `LIF_cuda.py` — leaky integrate-and-fire neural dynamics.
- `Syn_cuda.py` — synaptic dynamics/connectivity operations.
- `vismodel.py` — visual neural model composition and task-facing model behavior.

The key architectural boundary is between low-level stateful neural simulation (membrane/synapse state, likely timestep updates) and the visual-decision model that organizes those populations into a perception pipeline.

#### Visual decision and psychophysics layer
`psych_vismodel.py` appears to adapt or extend the visual model for psychophysical experiments: presenting motion stimuli, obtaining decisions, and measuring behavioral effects under experimental conditions. This is the likely primary control-flow layer for robustness/perturbation studies described in the README.
- `psych_vismodel.py`
- `vismodel.py`
- `base.py`

#### Comparison-model path
A separate motion-network implementation provides the CNN-style baseline used for performance comparison, rather than sharing the spiking/dynamic simulation path:
- `motnet.py`
- `simplified.py`
- `logistic.py`

`motnet.py` is the likely main comparison architecture; `simplified.py` and `logistic.py` likely provide reduced or readout/classification variants. The important boundary is that these models consume comparable visual/task inputs but use conventional differentiable network/readout components instead of explicit LIF/synapse dynamics.

#### Common model abstractions and outputs
`base.py` is the probable shared abstraction layer for model state, interfaces, or reusable experiment-facing behavior. It should be treated as the integration point when connecting neural dynamics, CNN baselines, and evaluation code.
- `base.py`
- `vismodel.py`
- `motnet.py`

The expected high-level flow is: construct model → generate/provide motion stimulus → run neural/CNN inference or temporal simulation → produce a decision/readout → aggregate results for comparison or perturbation analysis.

#### Runtime, acceleration, and result inspection
The repository is Python-based and materially depends on CUDA-capable execution for the dynamic neuron and synapse path, as indicated by:
- `LIF_cuda.py`
- `Syn_cuda.py`

`visualize.py` is the results-inspection boundary, separating plotting/analysis from model execution:
- `visualize.py`

No deployment infrastructure, web service, database, or external API integration is represented in the supplied tree. The principal external dependency class is the Python numerical/deep-learning stack required to execute CUDA model code; exact libraries are not declared in the provided files.

Main entry points: [`vismodel.py`](https://github.com/neuralmodeling/vismotion/blob/main/vismodel.py) (Visual dynamic model), [`motnet.py`](https://github.com/neuralmodeling/vismotion/blob/main/motnet.py) (MotNet baseline), [`base.py`](https://github.com/neuralmodeling/vismotion/blob/main/base.py) (Shared model base), [`LIF_cuda.py`](https://github.com/neuralmodeling/vismotion/blob/main/LIF_cuda.py) (LIF dynamics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dynamic["Neural dynamics"]
  node_lif{{"LIF dynamics<br/>neuron simulator<br/>[LIF_cuda.py]"}}
  node_syn{{"Synapse dynamics<br/>synapse simulator<br/>[Syn_cuda.py]"}}
  node_cuda["CUDA execution<br/>accelerated runtime"]
end

subgraph group_models["Decision models"]
  node_base["Shared model base<br/>abstraction<br/>[base.py]"]
  node_visual["Visual dynamic model<br/>spiking decision model<br/>[vismodel.py]"]
  node_motnet["MotNet baseline<br/>CNN comparison model<br/>[motnet.py]"]
  node_simplified["Simplified variant<br/>reduced model<br/>[simplified.py]"]
  node_logistic["Logistic readout<br/>classifier variant<br/>[logistic.py]"]
end

subgraph group_experiments["Experiments and analysis"]
  node_psych["Psychophysics driver<br/>experiment controller<br/>[psych_vismodel.py]"]
  node_stimulus["Motion stimulus<br/>task input"]
  node_decision["Decision outputs<br/>model output"]
  node_visualize["Results visualization<br/>analysis<br/>[visualize.py]"]
end

node_cuda -->|"accelerates"| node_lif
node_cuda -->|"accelerates"| node_syn
node_lif -->|"neuron updates"| node_visual
node_syn -->|"synaptic updates"| node_visual
node_base -.->|"shared interface"| node_visual
node_base -.->|"shared interface"| node_motnet
node_stimulus -->|"presented by"| node_psych
node_psych -->|"runs dynamic model"| node_visual
node_stimulus -->|"comparison input"| node_motnet
node_simplified -.->|"variant"| node_motnet
node_logistic -.->|"readout variant"| node_motnet
node_visual -->|"produces"| node_decision
node_motnet -->|"produces"| node_decision
node_decision -->|"analyzed by"| node_visualize

click node_base "https://github.com/neuralmodeling/vismotion/blob/main/base.py"
click node_lif "https://github.com/neuralmodeling/vismotion/blob/main/LIF_cuda.py"
click node_syn "https://github.com/neuralmodeling/vismotion/blob/main/Syn_cuda.py"
click node_visual "https://github.com/neuralmodeling/vismotion/blob/main/vismodel.py"
click node_psych "https://github.com/neuralmodeling/vismotion/blob/main/psych_vismodel.py"
click node_motnet "https://github.com/neuralmodeling/vismotion/blob/main/motnet.py"
click node_simplified "https://github.com/neuralmodeling/vismotion/blob/main/simplified.py"
click node_logistic "https://github.com/neuralmodeling/vismotion/blob/main/logistic.py"
click node_visualize "https://github.com/neuralmodeling/vismotion/blob/main/visualize.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_lif,node_syn,node_cuda toneBlue
class node_base,node_visual,node_motnet,node_simplified,node_logistic toneAmber
class node_psych,node_stimulus,node_decision,node_visualize toneMint
```

## Components

### Neural dynamics

CUDA-oriented stateful simulation.

- [LIF dynamics](https://github.com/neuralmodeling/vismotion/blob/main/LIF_cuda.py): neuron simulator · Leaky integrate-and-fire state updates. · `LIF_cuda.py`
- [Synapse dynamics](https://github.com/neuralmodeling/vismotion/blob/main/Syn_cuda.py): synapse simulator · Connectivity and synaptic state operations. · `Syn_cuda.py`
- **CUDA execution**: accelerated runtime · Acceleration boundary for neural simulation.

### Decision models

Dynamic and conventional comparison paths.

- [Shared model base](https://github.com/neuralmodeling/vismotion/blob/main/base.py): abstraction · Common experiment-facing model behavior. · `base.py`
- [Visual dynamic model](https://github.com/neuralmodeling/vismotion/blob/main/vismodel.py): spiking decision model · Composes neural populations into visual decisions. · `vismodel.py`
- [MotNet baseline](https://github.com/neuralmodeling/vismotion/blob/main/motnet.py): CNN comparison model · Conventional motion-network inference path. · `motnet.py`
- [Simplified variant](https://github.com/neuralmodeling/vismotion/blob/main/simplified.py): reduced model · `simplified.py`
- [Logistic readout](https://github.com/neuralmodeling/vismotion/blob/main/logistic.py): classifier variant · `logistic.py`

### Experiments and analysis

Task control and result inspection.

- [Psychophysics driver](https://github.com/neuralmodeling/vismotion/blob/main/psych_vismodel.py): experiment controller · Runs motion-stimulus decision experiments. · `psych_vismodel.py`
- **Motion stimulus**: task input
- **Decision outputs**: model output · Choices and task readouts for evaluation.
- [Results visualization](https://github.com/neuralmodeling/vismotion/blob/main/visualize.py): analysis · Plots and inspects experiment results. · `visualize.py`

## Connections

- CUDA execution → LIF dynamics: accelerates
- CUDA execution → Synapse dynamics: accelerates
- LIF dynamics → Visual dynamic model: neuron updates
- Synapse dynamics → Visual dynamic model: synaptic updates
- Shared model base → Visual dynamic model: shared interface
- Shared model base → MotNet baseline: shared interface
- Motion stimulus → Psychophysics driver: presented by
- Psychophysics driver → Visual dynamic model: runs dynamic model
- Motion stimulus → MotNet baseline: comparison input
- Simplified variant → MotNet baseline: variant
- Logistic readout → MotNet baseline: readout variant
- Visual dynamic model → Decision outputs: produces
- MotNet baseline → Decision outputs: produces
- Decision outputs → Results visualization: analyzed by
