Skip to content

Fixes to scripts #72

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

Open
wants to merge 25 commits into
base: osx
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5f3ac96
nml2 issue is fixed.
Mar 10, 2020
6bd2dce
Merge branch 'master' of https://github.com/BhallaLab/moose-examples
Apr 7, 2020
3c98691
FAILED.txt file has issue format.
Apr 8, 2020
92abaf8
rxdReacDiffusion is fixed. Set diffLenght before setting x1.
Apr 8, 2020
86d165d
Updated a little bit more.
Apr 11, 2020
c44c69f
Solved the metaclass problem. Thanks http://www.phyast.pitt.edu/~mich…
Apr 11, 2020
a950c40
Fixed metaclass issue one more place.
Apr 11, 2020
24ab80b
Updates to scripts for new bindings.
Apr 12, 2020
2a26a69
Squid tutorial needs debugging.
Apr 14, 2020
d7ec818
temp commit [skip ci]
Apr 14, 2020
ea2d2c0
Some progress but gna and gk still doesn't show any activity.
Apr 14, 2020
d27170e
Merge branch 'master' of github.com:dilawar/moose-examples
Apr 15, 2020
3386866
Using default ticks.
Apr 15, 2020
94c186f
squid is still working.
Apr 15, 2020
d45fc5f
Works with new bindings as well.
Apr 15, 2020
a5f2566
Merge branch 'pybind11' into squid_no_subclass
Apr 15, 2020
cf1631c
Merged pybind11.
Apr 15, 2020
36be3fe
Fixed figure fig_a2 and fig_a3.
Apr 15, 2020
f58b31f
This fixes all traub scripts.
Apr 15, 2020
89592ea
Fixes to another failing test.
Apr 15, 2020
4734b2a
Merge pull request #71 from dilawar/pybind11
dilawar Apr 15, 2020
f69155a
Delete index.md
dilawar Apr 15, 2020
0ea9dd3
replace mooseReadSBML->readSBML, mooseWriteSBML->writeSBML,mooseAddCh…
hrani Sep 8, 2020
7b43ad5
Merge branch 'master' into osx
dilawar Oct 14, 2020
abd1c31
Some more fixes to example scripts
dilawar Oct 14, 2020
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 .ci/execute_travis_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def print_results():
for k in result_:
with open("%s.txt" % k, 'w') as f:
for fl, r in result_[k]:
f.write('- %s\n' % fl)
f.write('- [ ] %s\n' % fl)
f.write('```')
try:
r = r.decode('utf8')
Expand Down
286 changes: 0 additions & 286 deletions index.md

This file was deleted.

5 changes: 3 additions & 2 deletions neuroml/lobster_pyloric/STG_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ def loadRunSTGNeuroML_L123(filename):
for child in soma2.children:
print((child.className, child.path))
if graded_syn:
syn_path = soma2_path+'/DoubExpSyn_Ach__cells-0-_AB_PD_0-0-_Soma_0'
# syn_path = soma2_path+'/DoubExpSyn_Ach__cells-0-_AB_PD_0-0-_Soma_0' # # version < 3.2
syn_path = soma2_path+'/DoubExpSyn_Ach__cells_AB_PD_0_Soma_0' # version 3.2 +
syn = moose.element(syn_path)
else:
syn_path = soma2_path+'/DoubExpSyn_Ach'
syn = moose.element(syn_path)
syn_Ik = setupTable('DoubExpSyn_Ach_Ik',syn,'Ik')
syn_Ik = setupTable('DoubExpSyn_Ach_Ik', syn, 'Ik')

print("Reinit MOOSE ... ")
resetSim(['/elec',cells_path], simdt, plotdt, simmethod='hsolve')
Expand Down
12 changes: 0 additions & 12 deletions neuroml2/run_hhcell.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@
import numpy as np
import matplotlib.pyplot as plt


# NOTE: This script does not work with python3
# See https://github.com/NeuroML/NeuroML2/issues/116 . If this bug is fixed then
# remove this code block.
import neuroml as nml
a = nml.nml.nml.IonChannel()
try:
b = {a : 1 }
except TypeError as e:
print( 'Failed due to https://github.com/NeuroML/NeuroML2/issues/116' )
quit( 0 )

def test_channel_gates():
"""Creates prototype channels under `/library` and plots the time
constants (tau) and activation (minf, hinf, ninf) parameters for the
Expand Down
2 changes: 1 addition & 1 deletion snippets/convert_Genesis2Sbml.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def main():
moose.loadModel('../genesis/Kholodenko.g','/Kholodenko')

#Writes model to xml file
written = moose.mooseWriteSBML('/Kholodenko','../genesis/Kholodenko_tosbml.xml')
written = moose.writeSBML('/Kholodenko','../genesis/Kholodenko_tosbml.xml')
print(written)

if __name__ == '__main__':
Expand Down
8 changes: 4 additions & 4 deletions snippets/crossComptSimpleReac.py.BROKEN
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def makeModel():
compt0.y0 += side
compt2.x1 += side
compt2.x0 += side
print(('Volumes = ', compt0.volume, compt1.volume, compt2.volume))
print('Volumes = ', compt0.volume, compt1.volume, compt2.volume)

# create molecules and reactions
a = moose.Pool( '/model/compt0/a' )
Expand Down Expand Up @@ -101,9 +101,9 @@ def makeModel():
stoich0.ksolve = ksolve0
stoich1.ksolve = ksolve1
stoich2.ksolve = ksolve2
stoich0.path = '/model/compt0/#'
stoich1.path = '/model/compt1/#'
stoich2.path = '/model/compt2/#'
stoich0.reacSystemPath = '/model/compt0/#'
stoich1.reacSystemPath = '/model/compt1/#'
stoich2.reacSystemPath = '/model/compt2/#'
stoich1.buildXreacs( stoich0 )
stoich1.buildXreacs( stoich2 )
stoich0.filterXreacs()
Expand Down
2 changes: 1 addition & 1 deletion snippets/funcInputToPools.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def main():
"""

makeModel()
moose.seed()
moose.seed(10)

moose.reinit()
moose.start( 50.0 ) # Run the model for 100 seconds.
Expand Down
13 changes: 7 additions & 6 deletions snippets/loadSbmlmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# Maintainer:
# Created: Fri Jan 29 11:43:15 2016 (+0530)
# Version:
# Last-Updated:
# By:
# Last-Updated: Wed Sep 09 01:32:12 2020 (+0530)
# By: HarshaRani
# Update #: 0
# URL:
# Keywords:
Expand All @@ -21,6 +21,7 @@
#

# Change log:
# updated function calls
#
#
#
Expand Down Expand Up @@ -77,14 +78,14 @@ def main():
runtime = float(sys.argv[2])
sbmlId = moose.element('/')
# Loading the sbml file into MOOSE, models are loaded in path/model
sbmlId = moose.mooseReadSBML(filepath,'/sbml')
sbmlId = moose.readSBML(filepath,'/sbml')[0]
if isinstance(sbmlId, (list, tuple)):
print(sbmlId)

elif sbmlId.path != '/':

s1 = moose.element('/sbml/model/compartment/S1')
s2= moose.element('/sbml/model/compartment/S2')
s1 = moose.element('/sbml/compartment/S1')
s2 = moose.element('/sbml/compartment/S2')

# Creating MOOSE Table, Table2 is for the chemical model
graphs = moose.Neutral( '/sbml/graphs' )
Expand All @@ -96,7 +97,7 @@ def main():
moose.connect( outputs2,'requestOut', s2, 'getConc' );

# gsl solver is added, default is ee
moose.mooseAddChemSolver(sbmlId.path,"ee")
moose.addChemSolver(sbmlId.path,"ee")

# Reset and Run
moose.reinit()
Expand Down
2 changes: 1 addition & 1 deletion snippets/rxdReacDiffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def main():
# define the geometry
compt = moose.CylMesh( '/cylinder' )
compt.r0 = compt.r1 = 1
compt.x1 = 100
compt.diffLength = 0.2
compt.x1 = 100
assert( compt.numDiffCompts == compt.x1/compt.diffLength )

#define the molecule. Its geometry is defined by its parent volume, cylinder
Expand Down
2 changes: 1 addition & 1 deletion snippets/scriptKineticSolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def main():
stoich = moose.Stoich( '/model/compartment/stoich' )
stoich.compartment = moose.element( '/model/compartment' )
stoich.ksolve = ksolve
stoich.path = "/model/compartment/##"
stoich.reacSystemPath = "/model/compartment/##"
#solver.method = "rk5"
#mesh = moose.element( "/model/compartment/mesh" )
#moose.connect( mesh, "remesh", solver, "remesh" )
Expand Down
3 changes: 3 additions & 0 deletions snippets/showmsg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def main():
synapse = syn.synapse.vec
mid = moose.connect(net, 'spikeOut', synapse, 'addSpike', 'Sparse') # This creates a `Sparse` message from `spikeOut` source of net to `addSpike` destination on synapse.
msg = moose.element(mid)
print(msg.setRandomConnectivity,'xx')
msg.setRandomConnectivity(connectionProbability, 5)
quit()
msg.setRandomConnectivity(connectionProbability, 5)
for n in net.vec:
print(('Messages from %s.spikeOut' % (n.path)))
Expand Down
85 changes: 35 additions & 50 deletions squid/electronics.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,16 @@
# electronics.py ---
#
# electronics.py ---
#
# Filename: electronics.py
# Description:
# Description:
# Author: Subhasis Ray
# Maintainer:
# Created: Wed Feb 22 00:53:38 2012 (+0530)
# Version:
# Last-Updated: Tue Jul 10 10:28:40 2012 (+0530)
# By: subha
# Update #: 221
# URL:
# Keywords:
# Compatibility:
#
#
# Maintainer: Dilawar Singh

# Commentary:
#
#
#
#

# Change log:
#
# 2012-02-22 23:22:30 (+0530) Subha - the circuitry put in a class.
#

# Code:

import numpy
import numpy as np
import moose

class ClampCircuit(moose.Neutral):
class ClampCircuit(object):
"""Container for a Voltage-Clamp/Current clamp circuit."""

defaults = {
'level1': 25.0,
'width1': 50.0,
Expand All @@ -41,48 +19,59 @@ class ClampCircuit(moose.Neutral):
'trigMode': 0,
'delay3': 1e9
}
def __init__(self, path, compartment):
moose.Neutral.__init__(self, path)
def __init__(self, path, squid):
self.path = path
moose.Neutral(path)
self.pulsegen = moose.PulseGen(path+"/pulse") # holding voltage/current generator
self.pulsegen.count = 2
self.pulsegen.firstLevel = 25.0
self.pulsegen.firstWidth = 50.0
self.pulsegen.firstDelay = 2.0
self.pulsegen.secondDelay = 0.0
self.pulsegen.trigMode = 2
self.gate = moose.PulseGen(path+"/gate") # holding voltage/current generator
self.gate = moose.PulseGen(path + "/gate") # holding voltage/current generator
self.gate.level[0] = 1.0
self.gate.delay[0] = 0.0
self.gate.width[0] = 1e9
moose.connect(self.gate, 'output', self.pulsegen, 'input')
self.lowpass = moose.RC(path+"/lowpass") # lowpass filter
moose.connect(self.gate, "output", self.pulsegen, "input")
self.lowpass = moose.RC(path + "/lowpass") # lowpass filter
self.lowpass.R = 1.0
self.lowpass.C = 0.03
self.vclamp = moose.DiffAmp(path+"/vclamp")
self.vclamp = moose.DiffAmp(path + "/vclamp")
self.vclamp.gain = 0.0
self.vclamp.saturation = 1e10
self.iclamp = moose.DiffAmp(path+"/iclamp")
self.iclamp = moose.DiffAmp(path + "/iclamp")
self.iclamp.gain = 0.0
self.iclamp.saturation = 1e10
self.pid = moose.PIDController(path+"/pid")
self.pid = moose.PIDController(path + "/pid")
self.pid.gain = 0.5
self.pid.tauI = 0.02
self.pid.tauD = 0.005
self.pid.saturation = 1e10
# Connect current clamp circuitry
moose.connect(self.pulsegen, "output", self.iclamp, "plusIn")
moose.connect(self.iclamp, "output", compartment, "injectMsg")
moose.connect(self.iclamp, "output", squid.C, "injectMsg")
# Connect voltage clamp circuitry
moose.connect(self.pulsegen, "output", self.lowpass, "injectIn")
moose.connect(self.lowpass, "output", self.vclamp, "plusIn")
moose.connect(self.vclamp, "output", self.pid, "commandIn")
moose.connect(compartment, "VmOut", self.pid, "sensedIn")
moose.connect(self.pid, "output", compartment, "injectMsg")
moose.connect(squid.C, "VmOut", self.pid, "sensedIn")
moose.connect(self.pid, "output", squid.C, "injectMsg")
current_table = moose.Table("/data/Im")
moose.connect(current_table, "requestOut", compartment, "getIm")
moose.connect(current_table, "requestOut", squid.C, "getIm")

def configure_pulses(self, baseLevel=0.0, firstLevel=0.1, firstDelay=5.0, firstWidth=40.0, secondLevel=0.0, secondDelay=1e6, secondWidth=0.0, singlePulse=True):
"""Set up the pulse generator."""
def configure_pulses(
self,
baseLevel=0.0,
firstLevel=0.1,
firstDelay=5.0,
firstWidth=40.0,
secondLevel=0.0,
secondDelay=1e6,
secondWidth=0.0,
singlePulse=True,
):
"""Set up the pulse generator."""
self.pulsegen.baseLevel = baseLevel
self.pulsegen.firstLevel = firstLevel
self.pulsegen.firstWidth = firstWidth
Expand All @@ -91,10 +80,10 @@ def configure_pulses(self, baseLevel=0.0, firstLevel=0.1, firstDelay=5.0, firstW
self.pulsegen.secondDelay = secondDelay
self.pulsegen.secondWidth = secondWidth
if singlePulse:
self.pulsegen.trigMode = 1
self.pulsegen.trigMode = 1
else:
self.pulsegen.trigMode = 0

def do_voltage_clamp(self):
"""Switch to voltage clamp circuitry. After this the simdt may
need to be changed for correct performance."""
Expand All @@ -103,14 +92,10 @@ def do_voltage_clamp(self):
self.pid.gain = 0.5
self.pid.tauD = 0.005
self.pid.tauI = 0.02

def do_current_clamp(self):
"""Switch to current clamp circuitry. After this the simdt may
need to be changed for correct performance."""
self.iclamp.gain = 1.0
self.vclamp.gain = 0.0
self.pid.gain = 0.0


#
# electronics.py ends here
Loading