Created
March 4, 2014 15:26
-
-
Save whilo/9348487 to your computer and use it in GitHub Desktop.
Simple Example of PyNN in Hy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import [toolz.itertoolz.core [concat cons count drop mapcat partition partial take-nth]]) | |
(import [toolz.functoolz.core [compose complement]]) | |
; (import [pyrsistent [pvec pmap pset]]) ; persistent data structures for python | |
(import [matplotlib [pyplot :as plt]]) | |
(import [pylab :as p]) | |
(import [numpy :as np]) | |
;(import [scipy [optimize :as opt]]) | |
(import [pyNN.nest [setup | |
create | |
connect | |
IF_curr_exp | |
IF_cond_alpha | |
IF_cond_exp | |
SpikeSourceArray | |
StepCurrentSource | |
record_v | |
record_gsyn | |
run | |
end]]) | |
(defn IF-curr-exp-exp [cell-conf step-curr file] | |
(setup) | |
(let [[cell (create IF_cond_alpha cell-conf)] | |
[curr (StepCurrentSource (first step-curr) | |
(second step-curr))]] | |
(.inject cell curr) | |
(record_v cell file) | |
(run 250.0) | |
(end) | |
(.loadtxt np file))) | |
(def v-rest 0.515) | |
(def res (IF-curr-exp-exp | |
{"v_thresh" -55.0 | |
"v_rest" v-rest | |
"v_reset" -80 | |
"tau_m" 50 | |
"tau_refrac" 0.01} | |
[[50.0 60.0] | |
[1 0]] | |
"StepCurrentSource_nest.v")) | |
(do (.plot plt res) | |
(.show plt)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment