Skip to main content

JAX Field Neural Equations: a source-to-field neurophysiology engine for TFNE models.

Project description

jaxfne

PyPI version Docs Release

jaxfne is a compact JAX-first scaffold for Tensor-Field Neural Equations (TFNE): a source-to-field/readout grammar for computational neurophysiology.

Config -> Net -> Paradigm -> Objective -> Trainer -> Signals -> Vis/Export

The package is built for tutorial-scale evidence generation with explicit scope, status, and metadata at every stage: laminar and multi-area neural emitters, source bookkeeping, proxy field/readout operators, objective reports, optimization workflows, and strict JSON-safe run manifests. Kernels are JAX-first, with deterministic seeds and a float32 default.

Why it exists

Neural models often stop at spikes, voltages, or population rates. TFNE adds an explicit bridge from emitter dynamics to declared source tensors, field/proxy maps, probe operators, objective reports, and reproducible metadata.

jaxfne focuses on that bridge. It keeps emitters, source maps, field/proxy operators, probes, objectives, optimizers, and validation reports separated enough that each assumption can be inspected, named, and tested.

Scientific framing

Emitters generate state trajectories. Source maps convert those trajectories into declared current / source tensors under explicit bookkeeping (one source mode per run, with a synaptic double-count guard). Field/proxy layers map source tensors into extracellular observable variables using a quasi-static resistive framing — a row-normalized laminar projection, not a Maxwell or boundary-value field solve. Probe operators then sample named readouts: spike rasters, voltage traces, source traces, LFP-proxy and CSD-proxy laminar proxies, EEG-proxy and MEG-proxy linear-projection proxies, and an EMM-proxy within-run activity/source/field cost summary.

The v0.3.x line uses simulated / proxy readouts designed for computational scaffolds. Readout amplitudes are normalized proxy units; the EMM-proxy is an internal normalized activity summary.

Install

pip install jaxfne

Visualization extras, when needed:

pip install "jaxfne[viz]"

Development checkout:

git clone https://github.com/HNXJ/jaxfne.git
cd jaxfne
pip install -e ".[dev,viz]"

The canonical import is:

import jaxfne as jtfne

0.3.28+ object model

Object Role
Config Declarative circuit/task/training spec; the bio-circuit PCB sketch.
Net Compiled biophysical circuit from Config.
Paradigm Task/trial/stimulus schedule, from constant DC to sequence tasks.
Objective Metrics, gates, and scores computed from Signals.
Trainer AGSDR or other tuning loop over declared trainables.
Signals Tensor outputs and query/layout API.
FlatNet JAX/JIT/pmap-friendly array form with tracking maps.

Compatibility aliases may remain during migration:

Configuration -> Config
Model -> Net
FlatModel -> FlatNet

Minimal workflow

import jaxfne as jtfne

cfg = (
    jtfne.Config(schema_version="0.3.28")
    .runtime(seed=7, dtype="float32", duration_ms=1000.0, dt_ms=0.1)
    .areas(["V1"])
    .layers(["L2/3"])
    .cells({"E": 1.0})
    .cell_params({"E": {"drive": 4.5, "noise": 0.5}})
    .mechanisms({})
    .connections([])
    .probes(["spk", "vm", "source", "lfp_proxy", "csd_proxy"])
)

net = jtfne.construct(cfg)
paradigm = jtfne.Paradigm.constant_dc(target={"area": "V1"}, amplitude=1.0)
signals = net.simulate(paradigm=paradigm, seed=7)
print(signals.get("spikes", layout="time_node").shape)

Querying signals

Named readouts are addressable by alias, and neuron-indexed signals (Vm, spikes, sources) can be filtered with semantic selectors over the declared area / layer / cell-type / id metadata. Selection requires a run that carries a neuron-identity table; otherwise the call raises rather than guessing.

import jaxfne as jtfne

cfg = jtfne.suite2_four_celltype_config(seed=0)
model = jtfne.construct(cfg)
signals = jtfne.simulate(model, duration_ms=10, dt_ms=0.1, seed=0)

vm = signals.get("vm")                      # alias for V_m
vm_excit = signals.get("vm", cell_type="E") # selector over neuron axis
idx = model.select(cell_type="E")           # resolve selector to indices

Readout status

Readout Role Image Reference
spk spike / event readout spk
vm voltage / emitter state trace vm
source declared source tensor or source proxy raster
lfp_proxy local potential laminar proxy lfp_proxy
csd_proxy laminar source-profile / second-derivative proxy csd_proxy
eeg_proxy linear scalp-channel projection proxy eeg_proxy
meg_proxy current-orientation / magnetic projection proxy meg_proxy
spectrolaminar_proxy depth x frequency power proxy spectrolaminar_proxy
agsdr synaptic gain matrix tuning agsdr
emm_proxy normalized within-run activity / source / field cost (derived cost summary)

Validate a checkout

python -m compileall -q jaxfne tests examples scripts
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONPATH=. python -m pytest tests/ -q --tb=line
PYTHONPATH=. python scripts/audit_notebooks_and_assets.py --check
mkdocs build --strict

Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jaxfne-0.3.39.tar.gz (8.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jaxfne-0.3.39-py3-none-any.whl (240.6 kB view details)

Uploaded Python 3

File details

Details for the file jaxfne-0.3.39.tar.gz.

File metadata

  • Download URL: jaxfne-0.3.39.tar.gz
  • Upload date:
  • Size: 8.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for jaxfne-0.3.39.tar.gz
Algorithm Hash digest
SHA256 3cb9c2811daedd331449a837ab2fcef0b4e1cef087fa36953a34ed9aed80e674
MD5 b7cfbdb13f6ace0101a97b798e3e47cd
BLAKE2b-256 256d41f7e283360f977a5efb936c58409aca7220246832d55812e79342e8e459

See more details on using hashes here.

File details

Details for the file jaxfne-0.3.39-py3-none-any.whl.

File metadata

  • Download URL: jaxfne-0.3.39-py3-none-any.whl
  • Upload date:
  • Size: 240.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for jaxfne-0.3.39-py3-none-any.whl
Algorithm Hash digest
SHA256 a46a7d5fcda54f702b6f5292b63f604d32a279557296469d0594a34bab265514
MD5 6ba64d152c8e1d4db06d0b97cd6f99e4
BLAKE2b-256 388e1b0e7e5af9625e36dc100169ad1d51fdaf8657b8757cb438247d4c25bcef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page