Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multicompartment models #196

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -2146,7 +2146,7 @@
<file>images/material-icons/toggle/svg/production/ic_star_border_24px.svg</file>
<file>images/material-icons/toggle/svg/production/ic_star_half_24px.svg</file>
<file>images/material-icons/toggle/svg/production/ic_star_half_48px.svg</file>
<file>qml/hud/TopCreationItem.qml</file>
<file>images/dashboard/integrate-and-fire.png</file>
<file>images/meters/amperemeter.png</file>
</qresource>
</RCC>
Binary file added images/meters/amperemeter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 14 additions & 8 deletions neuronify.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ HEADERS += \
src/core/graphengine.h \
src/core/nodebase.h \
src/core/nodeengine.h \
src/neurons/current.h \
src/neurons/neuronengine.h \
src/retina/androidmultimediautils.h \
src/retina/retinaengine.h \
src/retina/retinapainter.h \
src/retina/videosurface.h \
src/neurons/leakcurrent.h \
src/neurons/adaptationcurrent.h \
src/retina/kernel.h \
src/retina/kernels/gaborkernelengine.h \
src/retina/kernels/abstractkernelengine.h \
Expand All @@ -36,22 +33,25 @@ HEADERS += \
src/core/edgebase.h \
src/core/edgeengine.h \
src/io/downloadmanager.h \
src/io/neuronifyfile.h
src/io/neuronifyfile.h \
src/currents/current.h \
src/currents/leakcurrent.h \
src/currents/potassiumcurrent.h \
src/currents/sodiumcurrent.h \
src/currents/adaptationcurrent.h \
src/compartments/compartmentengine.h

SOURCES += \
src/io/fileio.cpp \
src/main.cpp \
src/core/nodebase.cpp \
src/core/nodeengine.cpp \
src/core/graphengine.cpp \
src/neurons/current.cpp \
src/neurons/neuronengine.cpp \
src/retina/retinaengine.cpp \
src/retina/retinapainter.cpp \
src/retina/videosurface.cpp \
src/retina/androidmultimediautils.cpp \
src/neurons/adaptationcurrent.cpp \
src/neurons/leakcurrent.cpp \
src/retina/kernel.cpp \
src/retina/kernels/gaborkernelengine.cpp \
src/retina/kernels/abstractkernelengine.cpp \
Expand All @@ -65,7 +65,13 @@ SOURCES += \
src/core/edgebase.cpp \
src/core/edgeengine.cpp \
src/io/downloadmanager.cpp \
src/io/neuronifyfile.cpp
src/io/neuronifyfile.cpp \
src/currents/leakcurrent.cpp \
src/currents/potassiumcurrent.cpp \
src/currents/sodiumcurrent.cpp \
src/currents/adaptationcurrent.cpp \
src/compartments/compartmentengine.cpp \
src/currents/current.cpp


RESOURCES += qml.qrc \
Expand Down
7 changes: 7 additions & 0 deletions qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@
<file>qml/menus/filemenu/AccountView.qml</file>
<file>qml/menus/filemenu/NewView.qml</file>
<file>qml/menus/filemenu/MySimulations.qml</file>
<file>qml/edges/CompartmentConnection.qml</file>
<file>qml/hud/TopCreationItem.qml</file>
<file>qml/compartments/SimpleCompartment.qml</file>
<file>qml/hud/CompartmentsList.qml</file>
<file>qml/compartments/CompartmentEngine.qml</file>
<file>qml/meters/Amperemeter.qml</file>
<file>qml/compartments/HHCompartment.qml</file>
<file>qml/menus/filemenu/AboutView.qml</file>
</qresource>
</RCC>
9 changes: 8 additions & 1 deletion qml/MainDesktop.qml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ Item {
}

function firstLoad() {
neuronify.loadSimulation("qrc:/simulations/tutorial/tutorial_1_intro/tutorial_1_intro.nfy") // TODO replace with open
// neuronify.loadSimulation("qrc:/simulations/tutorial/tutorial_1_intro/tutorial_1_intro.nfy") // TODO replace with open
open("file:///home/svenni/tmp/test.neuronify")
}

function tryClose() {
Expand Down Expand Up @@ -328,6 +329,12 @@ Item {
imageSource: "qrc:/images/generators/current_clamp.png"
listSource: "qrc:/qml/hud/GeneratorsList.qml"
}
ListElement {
name: "Compartments"
source: "qrc:/qml/compartments/HHCompartment.qml"
imageSource: "qrc:/images/generators/current_clamp.png"
listSource: "qrc:/qml/hud/CompartmentsList.qml"
}
ListElement {
name: "Annotation"
source: "qrc:/qml/annotations/Note.qml"
Expand Down
9 changes: 9 additions & 0 deletions qml/compartments/CompartmentEngine.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Neuronify 1.0

CompartmentEngineBase {
id: engine
savedProperties: PropertyGroup {
// property alias voltage: engine.voltage
// property alias capacitance: engine.capacitance
}
}
148 changes: 148 additions & 0 deletions qml/compartments/HHCompartment.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import QtQuick 2.0
import Neuronify 1.0
import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.1

import ".."
import "../edges"
import "../controls"

Node {
id: root
filename: "compartments/HHCompartment.qml"
name: "Hodgkin-Huxley compartment"

readonly property real voltage: engine.voltage
readonly property real leakCurrent: leakCurrent.current
readonly property real sodiumCurrent: sodiumCurrent.current
readonly property real potassiumCurrent: potassiumCurrent.current

width: 64
height: 64
color: "#dd5900"
canReceiveConnections: true
preferredEdge: CompartmentConnection {}

engine: CompartmentEngine {
id: engine

savedProperties: PropertyGroup {
// property alias currentOutput: engine.currentOutput
}

capacitance: 1e-6 * engine.area * 1e4

LeakCurrent {
id: leakCurrent
property real conductance: 0.3e-3 * engine.area * 1e4
resistance: (1.0 / conductance)
voltage: engine.voltage
restingPotential: -54.4e-3
}

SodiumCurrent {
id: sodiumCurrent
meanSodiumConductance: 120e-3 * engine.area * 1e4
voltage: engine.voltage
}

PotassiumCurrent {
id: potassiumCurrent
meanPotassiumConductance: 36e-3 * engine.area * 1e4
voltage: engine.voltage
}
}

controls: Rectangle {
color: Material.background
width: 480
height: 360

ColumnLayout {
anchors {
fill: parent
margins: 16
}

BoundSlider {
target: engine
property: "length"
text: "Length"
unit: "μm"
minimumValue: 1.0e-6
maximumValue: 300.0e-6
stepSize: 1.0e-6
unitScale: 1e-6
precision: 1
}
BoundSlider {
target: engine
property: "radiusA"
text: "Radius A"
unit: "μm"
minimumValue: 1.0e-6
maximumValue: 300.0e-6
stepSize: 1.0e-6
unitScale: 1e-6
precision: 1
}
BoundSlider {
target: engine
property: "radiusB"
text: "Radius B"
unit: "μm"
minimumValue: 1.0e-6
maximumValue: 300.0e-6
stepSize: 1.0e-6
unitScale: 1e-6
precision: 1
}

Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}


Rectangle {
anchors.fill: parent
radius: Math.min(width, height) / 10
color: "#6baed6"
border.color: selected ? "#08306b" : "#2171b5"
border.width: selected ? 3.0 : 1.0
}

Rectangle {
anchors.fill: parent
anchors.margins: 2.0
radius: Math.min(width, height) / 10
color: "#f7fbff"
opacity: (engine.voltage * 1e3 + 100) / (150)
}

Text {
anchors.centerIn: parent
text: (engine.voltage * 1e3).toFixed(1)
font.pixelSize: 14
}

DropArea {
id: dropArea
anchors {
fill: parent
margins: -16
}
keys: ["connector"]
onDropped: {
receivedDrop(drop.source.node)
}
}

Connector {
color: "#dd5000"
connectorColor: "#dd5000"
}
}
93 changes: 93 additions & 0 deletions qml/compartments/SimpleCompartment.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import QtQuick 2.0
import Neuronify 1.0

import ".."
import "../edges"

Node {
id: root
filename: "compartments/SimpleCompartment.qml"
name: "Simple compartment"

readonly property real voltage: engine.voltage
readonly property real leakCurrent: leakCurrent.current

width: 64
height: 64
color: "#dd5900"
canReceiveConnections: true
preferredEdge: CompartmentConnection {}

engine: CompartmentEngine {
id: engine

savedProperties: PropertyGroup {
// property alias currentOutput: engine.currentOutput
}

capacitance: 1e-6 * engine.area * 1e4

LeakCurrent {
id: leakCurrent
property real conductance: 0.3e-3 * engine.area * 1e4
resistance: (1.0 / conductance)
voltage: engine.voltage
restingPotential: -54.4e-3
}
}

// controls: Component {
// PropertiesPage {
// BoundSlider {
// target: engine
// property: "currentOutput"
// text: "Current output"
// unit: "nA"
// minimumValue: 0.0e-9
// maximumValue: 30.0e-9
// stepSize: 0.01e-9
// unitScale: 1e-9
// precision: 2
// }
// }
// }

Rectangle {
anchors.fill: parent
radius: Math.min(width, height) / 10
color: "#6baed6"
border.color: selected ? "#08306b" : "#2171b5"
border.width: selected ? 3.0 : 1.0
}

Rectangle {
anchors.fill: parent
anchors.margins: 2.0
radius: Math.min(width, height) / 10
color: "#f7fbff"
opacity: (engine.voltage * 1e3 + 100) / (150)
}

Text {
anchors.centerIn: parent
text: (engine.voltage * 1e3).toFixed(1)
font.pixelSize: 14
}

DropArea {
id: dropArea
anchors {
fill: parent
margins: -16
}
keys: ["connector"]
onDropped: {
receivedDrop(drop.source.node)
}
}

Connector {
color: "#dd5000"
connectorColor: "#dd5000"
}
}
Loading