Skip to content

Instantly share code, notes, and snippets.

@maxkrieger
Created Mar 25, 2021
Embed
What would you like to do?
Neuro Max: a trio from https://penrose.ink
type Synapse
type Channel
type Vesicle
type Glutamate
type Calcium
type NMDAR
type AMPAR
predicate InsideVesicle : Glutamate g * Vesicle v
predicate VesicleOpen : Vesicle v
-- predicate IsOpen -- magnesium
forall Synapse A {
A.axon = Rectangle {
center: (0, 500)
w: 800
h: 100
strokeWidth: 0
color: hsva(155, 51, 100, 1)
}
A.axon.x = 0
A.axonText = Text {
string: "\text{Axon}"
}
A.dendrite = Rectangle {
center: (0, -100)
w: 800
h: 100
strokeWidth: 0
color: hsva(185, 51, 100, 1)
}
A.dendriteText = Text {
string: "\text{Dendrite}"
}
encourage centerLabel(A.axon, A.axonText)
layer A.axonText above A.axon
encourage centerLabel(A.dendrite, A.dendriteText)
layer A.dendriteText above A.dendrite
}
forall AMPAR A; Synapse S {
A.left = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(291, 75, 100, 1)
}
A.right = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(291, 75, 100, 1)
}
encourage equal(A.left.center[1], -50)
encourage equal(A.right.center[1], -50)
layer A.left above S.dendrite
layer A.right above S.dendrite
encourage nearPt(A.right, A.left.center[0] + 30, A.left.center[1])
}
forall NMDAR N; Synapse S {
N.left = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(42, 75, 100, 1)
}
N.right = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(42, 75, 100, 1)
}
encourage equal(N.left.center[1], -50)
encourage equal(N.right.center[1], -50)
layer N.left above S.dendrite
layer N.right above S.dendrite
encourage nearPt(N.right, N.left.center[0] + 30, N.left.center[1])
}
forall Channel C; Synapse S {
C.left = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(0, 0, 50, 1)
}
C.right = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(0, 0, 50, 1)
}
encourage equal(C.left.center[1], 450)
encourage equal(C.right.center[1], 450)
layer C.left above S.axon
layer C.right above S.axon
encourage nearPt(C.right, C.left.center[0] + 30, C.left.center[1])
}
forall Calcium C; Synapse S {
C.icon = Circle {
r: 10
strokeWidth: 0
color: hsva(291, 44, 100, 1)
}
layer C.icon above S.axon
layer C.icon above S.dendrite
}
forall Glutamate C; Synapse S {
C.icon = Circle {
r: 10
strokeWidth: 0
color: hsva(41, 100, 100, 1)
}
layer C.icon above S.axon
layer C.icon above S.dendrite
}
forall Glutamate G; Glutamate C {
-- encourage repel(G.icon, C.icon, 0.2)
}
forall Vesicle V; Synapse S {
V.x = ?
V.icon = Circle {
center: (?, 500.0)
r: 40
color: hsva(0,0,0,0)
strokeColor: hsva(0,20,0,1)
}
-- V.icon.center[1] = 500.0
layer V.icon above S.axon
-- encourage equal(V.icon.center[1], 500)
}
forall Vesicle V where VesicleOpen(V) {
-- BAD LINE
-- V.icon.center[1] = 0.0
}
forall Vesicle V; Glutamate G
where InsideVesicle(G, V) {
ensure contains(V.icon, G.icon)
}
Synapse S
AMPAR A
NMDAR N
Channel C
Vesicle V
Calcium Z
Glutamate Ga, Gb, Gc, Gd
InsideVesicle(Ga, V)
InsideVesicle(Gb, V)
InsideVesicle(Gc, V)
VesicleOpen(V)
-- inside vesicle G
-- open nmdar -> attract calcium
-- polarized: attract calcium to bottom
{"authorship":{"madeBy":"maxkrieger","name":"Neuro Max","avatar":"https://avatars.githubusercontent.com/u/2660634?v=4"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment