Bio — Biological Computing Substrates¶
Biological computing interfaces: DNA-based weight storage, gene regulatory network modulation, and neuromodulatory dynamics (dopamine, serotonin, norepinephrine).
DNAEncoder — DNA Data Storage¶
Maps bitstreams to nucleotide sequences and back. Encoding: pairs of bits → nucleotides (00→A, 01→C, 10→G, 11→T). Decoding includes a configurable mutation rate that simulates sequencing errors.
| Parameter | Default | Meaning |
|---|---|---|
mutation_rate |
0.001 | Per-nucleotide mutation probability during decode |
Odd-length bitstreams are zero-padded to even length.
GeneticRegulatoryLayer — Gene Expression Modulation¶
Neural activity drives protein production; protein levels modulate neuron thresholds. Implements a first-order ODE: dP/dt = α * spikes - β * P, clipped to [0, 10].
| Parameter | Default | Meaning |
|---|---|---|
n_neurons |
(required) | Number of neurons |
production_rate |
0.01 | Protein production rate (α) |
decay_rate |
0.005 | Protein decay rate (β) |
get_threshold_modulators() returns current protein levels — higher protein → higher effective threshold (inhibitory feedback).
NeuromodulatorSystem — Global Emotional System¶
Three neuromodulators with environmental feedback:
| Chemical | Baseline | Effect |
|---|---|---|
| Dopamine (DA) | 0.5 | Lowers threshold (excitation) |
| Serotonin (5-HT) | 0.5 | Reduces noise (stabilization) |
| Norepinephrine (NE) | 0.1 | Increases noise + gain (exploration) |
update_levels(reward, stress) adjusts chemicals. modulate_neuron(params) returns modified parameters.
Usage¶
from sc_neurocore.bio import DNAEncoder, GeneticRegulatoryLayer, NeuromodulatorSystem
import numpy as np
# DNA storage roundtrip
enc = DNAEncoder(mutation_rate=0.0)
bits = np.array([1, 0, 0, 1, 1, 1, 0, 0], dtype=np.uint8)
dna = enc.encode(bits) # "GCTA"
recovered = enc.decode(dna)
assert np.array_equal(bits, recovered)
# Gene regulation
grn = GeneticRegulatoryLayer(n_neurons=100)
for _ in range(50):
spikes = (np.random.rand(100) < 0.3).astype(float)
grn.step(spikes)
thresholds = grn.get_threshold_modulators()
# Neuromodulation
nm = NeuromodulatorSystem()
nm.update_levels(reward=0.8, stress=0.2)
params = nm.modulate_neuron({"v_threshold": 1.0, "noise_std": 0.1})
sc_neurocore.bio.dna_storage
¶
DNAEncoder
dataclass
¶
Interface for DNA Data Storage. Maps Bitstreams to Nucleotides (A, C, T, G).
Source code in src/sc_neurocore/bio/dna_storage.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
encode(bitstream)
¶
Converts uint8 {0,1} bitstream to DNA string.
Source code in src/sc_neurocore/bio/dna_storage.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
decode(dna_str)
¶
Converts DNA string back to bitstream.
Source code in src/sc_neurocore/bio/dna_storage.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
sc_neurocore.bio.grn
¶
GeneticRegulatoryLayer
dataclass
¶
Bio-Hybrid Layer. Neural Activity -> Gene Expression (Protein) -> Neural Param Modulation.
Source code in src/sc_neurocore/bio/grn.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
step(spikes)
¶
Update protein levels based on spike activity.
Source code in src/sc_neurocore/bio/grn.py
27 28 29 30 31 32 33 34 | |
get_threshold_modulators()
¶
Protein acts as inhibitor: Higher protein -> Higher threshold.
Source code in src/sc_neurocore/bio/grn.py
36 37 38 39 40 | |
sc_neurocore.bio.neuromodulation
¶
NeuromodulatorSystem
dataclass
¶
Global Emotional/Chemical System. Modulates neuron parameters based on Dopamine (DA), Serotonin (5HT), Norepinephrine (NE).
Source code in src/sc_neurocore/bio/neuromodulation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
update_levels(reward, stress)
¶
Adjust chemicals based on environmental feedback.
Source code in src/sc_neurocore/bio/neuromodulation.py
24 25 26 27 28 29 30 31 32 33 34 | |
modulate_neuron(neuron_params)
¶
Returns modified parameters for a StochasticLIFNeuron.
Source code in src/sc_neurocore/bio/neuromodulation.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |