Reorganize flat-file repo into proper package directory structure#1
Merged
Merged
Conversation
…TURE.md Agent-Logs-Url: https://github.com/merrypranxter/reaction_diffusion/sessions/0cf7acfd-d2da-4316-a318-2bbc9d1e12e6 Co-authored-by: merrypranxter <159569959+merrypranxter@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
merrypranxter
April 9, 2026 15:45
View session
There was a problem hiding this comment.
Pull request overview
This PR reorganizes the repository into a proper Python package/module directory structure (core/cpu/gpu/models/tools/tests/etc.) and adds supporting assets (presets, shaders, docs, examples) plus CI configuration to make the project testable/installable.
Changes:
- Introduces structured Python packages for core simulation, CPU/GPU backends, models, and tooling (plus
__init__.pyfiles). - Adds presets, shader sources, documentation notes, and a Three.js WebGL example.
- Adds a GitHub Actions CI workflow to run formatting/type-check/tests and build wheels.
Reviewed changes
Copilot reviewed 1 out of 49 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/video_generator.py | CLI to generate an MP4 from a Gray-Scott run. |
| tools/profiler.py | CLI-ish utility to profile NumPy vs PyTorch implementations and emit a report. |
| tools/parameter_scanner.py | CLI to batch-render Pearson types and sweep (F,k) grids. |
| tools/init.py | Marks tools as a package. |
| tests/test_presets.py | Validates preset JSON structure/content. |
| tests/test_laplacian.py | Laplacian operator unit tests and equivalence checks. |
| tests/test_convergence.py | Numerical stability/pattern/convergence tests for the simulator. |
| tests/init.py | Marks tests as a package. |
| shaders/gray-scott-sim.frag | WebGL fragment shader implementing Gray-Scott step. |
| shaders/display-munafo.frag | WebGL fragment shader for Munafo-style visualization. |
| shaders/color-ramps.glsl | Shared GLSL color ramp utilities. |
| shaders/init.py | Marks shaders as a package. |
| presets/pearson-types.json | Pearson-type parameter presets for Gray-Scott. |
| presets/named-behaviors.json | Named (F,k) behaviors presets. |
| presets/init.py | Marks presets as a package. |
| models/schnakenberg.py | Schnakenberg model implementation. |
| models/fitzHugh_nagumo.py | FitzHugh–Nagumo model implementations (grid + network). |
| models/cahn_hilliard.py | Cahn–Hilliard spectral solver + noisy variant. |
| models/belousov_zhabotinsky.py | BZ/Oregonator and simplified excitable-medium model. |
| models/init.py | Exports models package surface (__all__). |
| gpu/webgpu/pipeline.js | WebGPU compute pipeline orchestration (resources, uniforms, dispatch). |
| gpu/webgpu/compute.wgsl | WebGPU compute shader for Gray-Scott. |
| gpu/pytorch/pearson_plot_gpu.py | PyTorch Pearson-plot (spatial parameter sweep) implementation. |
| gpu/pytorch/gray_scott_torch.py | PyTorch Gray-Scott implementation using conv2d Laplacian. |
| gpu/pytorch/init.py | Exposes PyTorch GPU implementations as a subpackage. |
| gpu/benchmarks/gpu_speedups.md | Documentation of observed GPU speedups. |
| gpu/init.py | Top-level GPU package import shim / optional exports. |
| cpu/numpy_vectorized.py | Vectorized NumPy Gray-Scott baseline implementation. |
| cpu/cython_accelerated.pyx | Cython-accelerated stepping implementation + wrapper class. |
| cpu/fortran_backend.f90 | Fortran backend routines (f2py target). |
| cpu/benchmarks/benchmark_results.md | CPU benchmark result write-up. |
| cpu/init.py | CPU package exports and optional Cython import. |
| core/seeding.py | Seed/initial-condition generators for simulations. |
| core/parameters.py | Dataclasses + canonical parameter presets (Pearson types, named behaviors). |
| core/laplacian.py | Laplacian kernels and implementations (5-pt, 9-pt, convolution). |
| core/gray_scott.py | Core NumPy Gray-Scott simulator + image/state helpers. |
| core/init.py | Core package exports and public API surface. |
| docs/01-mathematical-foundations.md | Theory reference: reaction-diffusion basics, Laplacians, stability. |
| docs/02-gray-scott-deep-dive.md | Theory reference: Gray-Scott equations, seeding, parameters. |
| docs/03-pearson-classification.md | Theory reference: Pearson taxonomy and parameter map. |
| docs/04-bifurcation-theory.md | Theory reference: bifurcation boundaries and implications. |
| docs/05-topological-defects.md | Theory reference: defect types and shader injection ideas. |
| docs/06-implementation-patterns.md | Reference on CPU/GPU implementations and kernels. |
| docs/07-coloring-strategies.md | Reference on visualization/coloring strategies. |
| docs/08-spatial-parameter-sweeps.md | Reference on Pearson plots/spatial parameter sweeps. |
| docs/09-alternative-models.md | Overview of alternative models included in models/. |
| docs/10-blur-sharpen-equivalence.md | Reference on blur+unsharp-mask equivalence to RD. |
| examples/threejs-webgl/index.html | Browser demo: Gray-Scott simulation via Three.js/WebGL. |
| .github/workflows/ci.yml | CI pipeline for lint/typecheck/tests/coverage + wheel builds + benchmarks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All source files were dumped flat in the repo root with prefixed names (e.g.
core_gray_scott.py,gpu_pearson_plot_gpu.py) instead of the intended subdirectory layout already documented inREPO_STRUCTURE.md.Changes
docs/— 10 numbered theory/reference markdown filescore/— Gray-Scott engine, Laplacian operators, parameters, seedingcpu/— NumPy, Cython, Fortran backends; benchmarks incpu/benchmarks/gpu/pytorch/— PyTorch CUDA impl + Pearson plotter; added missing__init__.py(required bygpu/__init__.py's relative imports)gpu/webgpu/— WGSL compute shader + JS pipelinegpu/benchmarks/— speedup resultsmodels/— BZ, FitzHugh-Nagumo, Cahn-Hilliard, Schnakenbergshaders/— GLSL/FRAG filespresets/— Pearson-types and named-behaviors JSONtests/— convergence, Laplacian, and preset test suitestools/— parameter scanner, video generator, profiler CLIsexamples/threejs-webgl/— interactive WebGL demo (index.html).github/workflows/— CI workflowAll moves done via
git mvto preserve history. No file contents modified except the newgpu/pytorch/__init__.py.