Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moose
Manage
Activity
Members
Labels
Plan
Issues
9
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sahil Moza
moose
Commits
0015fd23
Commit
0015fd23
authored
8 years ago
by
HarshaRani
Browse files
Options
Downloads
Patches
Plain Diff
Resolved merge conflict
parent
15733245
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
moose-examples/snippets/intfire.py
+128
-0
128 additions, 0 deletions
moose-examples/snippets/intfire.py
moose-examples/snippets/loadKineticModel.py
+100
-0
100 additions, 0 deletions
moose-examples/snippets/loadKineticModel.py
with
228 additions
and
0 deletions
moose-examples/snippets/intfire.py
0 → 100644
+
128
−
0
View file @
0015fd23
<<<<<<<
HEAD
=======
>>>>>>>
0e491
aa41584cf7a66c0e242374d8ee61660eb7b
# intfire.py ---
#
# Filename: intfire.py
# Description:
# Author:Subhasis Ray
# Maintainer:
# Created: Thu Jun 21 16:40:25 2012 (+0530)
# Version:
# Last-Updated: Sat Jun 23 13:44:10 2012 (+0530)
# By: subha
# Update #: 35
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
# Code snippet to show some operations on IntFire.
#
#
# Change log:
#
#
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth
# Floor, Boston, MA 02110-1301, USA.
#
#
# Code:
import
moose
def
connect_two_intfires
():
"""
Connect two IntFire neurons so that spike events in one gets
transmitted to synapse of the other.
<<<<<<< HEAD
=======
>>>
>>>>
0e491
aa41584cf7a66c0e242374d8ee61660eb7b
"""
if1
=
moose
.
IntFire
(
'
if1
'
)
if2
=
moose
.
IntFire
(
'
if2
'
)
sf1
=
moose
.
SimpleSynHandler
(
'
if1/sh
'
)
moose
.
connect
(
sf1
,
'
activationOut
'
,
if1
,
'
activation
'
)
sf1
.
synapse
.
num
=
1
syn1
=
moose
.
element
(
sf1
.
synapse
)
# Connect the spike message of if2 to the first synapse on if1
moose
.
connect
(
if2
,
'
spikeOut
'
,
syn1
,
'
addSpike
'
)
def
connect_spikegen
():
"""
Connect a SpikeGen object to an IntFire neuron such that spike
events in spikegen get transmitted to the synapse of the IntFire
neuron.
<<<<<<< HEAD
"""
if3
=
moose
.
IntFire
(
'
if3
'
)
=======
if3
=
moose
.
IntFire
(
'
if3
'
)
"""
>>>
>>>>
0e491
aa41584cf7a66c0e242374d8ee61660eb7b
sf3
=
moose
.
SimpleSynHandler
(
'
if3/sh
'
)
moose
.
connect
(
sf3
,
'
activationOut
'
,
if3
,
'
activation
'
)
sf3
.
synapse
.
num
=
1
sg
=
moose
.
SpikeGen
(
'
sg
'
)
syn
=
moose
.
element
(
sf3
.
synapse
)
moose
.
connect
(
sg
,
'
spikeOut
'
,
syn
,
'
addSpike
'
)
def setup_synapse():
"""
Create
an
intfire
object
and
create
two
synapses
on
it
.
<<<<<<<
HEAD
=======
>>>>>>>
0e491
aa41584cf7a66c0e242374d8ee61660eb7b
"""
if4 = moose.IntFire(
'
if4
'
)
sf4 = moose.SimpleSynHandler(
'
if4/sh
'
)
sg1 = moose.SpikeGen(
'
sg1
'
)
sg2 = moose.SpikeGen(
'
sg2
'
)
sf4.synapse.num = 2 # set synapse count to 2
sf4.synapse[0].weight = 0.5
sf4.synapse[0].delay = 1e-3
sf4.synapse[1].weight = 2.0
sf4.synapse[1].delay = 2e-3
moose.connect(sg1,
'
spikeOut
'
, sf4.synapse[0],
'
addSpike
'
)
moose.connect(sg2,
'
spikeOut
'
, sf4.synapse[1],
'
addSpike
'
)
def main():
"""
Demonstrates
connection
between
2
IntFire
neurons
to
observe
spike
generation
.
<<<<<<<
HEAD
=======
>>>>>>>
0e491
aa41584cf7a66c0e242374d8ee61660eb7b
"""
connect_two_intfires()
connect_spikegen()
setup_synapse()
if __name__ ==
'
__main__
'
:
main()
#
# intfire.py ends here
This diff is collapsed.
Click to expand it.
moose-examples/snippets/loadKineticModel.py
0 → 100644
+
100
−
0
View file @
0015fd23
# loadKineticModel.py ---
#
# Filename: loadKineticModel.py
# Description:
# Author: Upi Bhalla
# Maintainer:
# Created: Sat Oct 04 12:14:15 2014 (+0530)
# Version:
# Last-Updated:
# By:
# Update #: 0
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
#
#
#
# Change log:
#
#
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth
# Floor, Boston, MA 02110-1301, USA.
#
#
# Code:
import
moose
import
pylab
import
numpy
import
sys
def
main
():
"""
This example illustrates loading, running, and saving a kinetic
model defined in kkit format. It uses a default kkit model but
you can specify another using the command line
<<<<<<< HEAD
``python filename runtime solver``.
=======
``python filename runtime solver``.
>>>
>>>>
0e491
aa41584cf7a66c0e242374d8ee61660eb7b
We
use
the
gsl
solver
here
.
The
model
already
defines
a
couple
of
plots
and
sets
the
runtime
20
secs
.
"""
solver
=
"
gsl
"
# Pick any of gsl, gssa, ee..
mfile
=
'
../genesis/kkit_objects_example.g
'
runtime
=
20.0
if
(
len
(
sys
.
argv
)
>=
3
):
if
sys
.
argv
[
1
][
0
]
==
'
/
'
:
mfile
=
sys
.
argv
[
1
]
else
:
mfile
=
'
../genesis/
'
+
sys
.
argv
[
1
]
runtime
=
float
(
sys
.
argv
[
2
]
)
if
(
len
(
sys
.
argv
)
==
4
):
solver
=
sys
.
argv
[
3
]
modelId
=
moose
.
loadModel
(
mfile
,
'
model
'
,
solver
)
# Increase volume so that the stochastic solver gssa
# gives an interesting output
#compt = moose.element( '/model/kinetics' )
#compt.volume = 1e-19
moose
.
reinit
()
moose
.
start
(
runtime
)
# Display all plots.
for
x
in
moose
.
wildcardFind
(
'
/model/#graphs/conc#/#
'
):
t
=
numpy
.
arange
(
0
,
x
.
vector
.
size
,
1
)
*
x
.
dt
pylab
.
plot
(
t
,
x
.
vector
,
label
=
x
.
name
)
pylab
.
legend
()
pylab
.
show
()
quit
()
# Run the 'main' if this script is executed standalone.
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment