- Timestamp:
- 12/09/11 02:22:43 (6 months ago)
- Location:
- trunk/src
- Files:
-
- 3 modified
-
nemo/simulator.py (modified) (6 diffs)
-
nemo/standardmodels/cells.py (modified) (2 diffs)
-
nest/__init__.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/nemo/simulator.py
r1023 r1027 60 60 self.simulation = None 61 61 self.stdp = None 62 self.verbose = False 63 64 def progressbar(self, N): 65 self.prog = utility.ProgressBar(0, N, 20, mode='fixed') 62 self.time = 0 63 self._fired = [] 66 64 67 65 @property 68 66 def sim(self): 69 if self.simulation is False:67 if self.simulation is None: 70 68 raise Exception("Simulation object is empty, run() needs to be called first") 71 69 else: … … 74 72 @property 75 73 def t(self): 76 return self. sim.elapsed_simulation()74 return self.time 77 75 78 76 def set_stdp(self, stdp): … … 88 86 def run(self, simtime): 89 87 90 self.simulation = nemo.Simulation(self.net, self.conf) 91 if self.verbose: 92 self.progressbar(simtime) 88 if self.simulation is None: 89 self.simulation = nemo.Simulation(self.net, self.conf) 93 90 94 91 poissons_sources = [] 95 92 arrays_sources = [] 96 fired = []97 93 98 94 for source in spikes_array_list: … … 104 100 for t in numpy.arange(0, simtime, self.dt): 105 101 spikes = [] 106 currents = [] 107 for source in poissons_sources: 102 currents = [] 103 for source in poissons_sources: 108 104 if source.player.do_spike(t): 109 105 spikes += [source] … … 112 108 source.player.update() 113 109 spikes += [source] 114 115 110 for recorder in recorder_list: 116 111 if recorder.variable is "spikes": 117 recorder._add_spike( fired, self.t)112 recorder._add_spike(self._fired, self.t) 118 113 if recorder.variable is "v": 119 114 recorder._add_vm(self.t) 120 115 121 fired = self.sim.step(spikes, currents) 122 116 self._fired = self.sim.step(spikes, currents) 117 self.time += self.sim.elapsed_simulation() 118 123 119 if self.stdp: 124 120 self.simulation.apply_stdp(1.0) 125 126 if self.verbose: 127 self.prog.update_amount(t) 128 print self.prog, "\r", 129 sys.stdout.flush() 130 121 131 122 @property 132 123 def next_id(self): … … 139 130 """Reset the state of the current network to time t = 0.""" 140 131 state.net.reset_timer() 132 self.time = 0 133 self._fired = [] 141 134 142 135 # --- For implementation of access to individual neurons' parameters ----------- -
trunk/src/nemo/standardmodels/cells.py
r1017 r1027 61 61 self.rng = numpy.random.RandomState() 62 62 self.precision = precision 63 self.rate_Hz = self.rate * self.precision /1000.63 self.rate_Hz = self.rate * self.precision / 1000. 64 64 self.stop_time = self.start + self.duration 65 65 self.buffer = 1000 … … 72 72 else: 73 73 if self.idx == (self.buffer - 1): 74 self.do_spikes = self.rng.rand(self.buffer) < self.rate_Hz74 self.do_spikes = self.rng.rand(self.buffer) <= self.rate_Hz 75 75 self.idx = 0 76 76 self.idx += 1 -
trunk/src/nest/__init__.py
r1021 r1027 124 124 125 125 # set resolution 126 nest.SetKernelStatus({'resolution': timestep})126 nest.SetKernelStatus({'resolution': float(timestep)}) 127 127 128 128 # Set min_delay and max_delay for all synapse models 129 129 for synapse_model in NEST_SYNAPSE_TYPES: 130 nest.SetDefaults(synapse_model, {'delay' : min_delay,131 'min_delay': min_delay,132 'max_delay': max_delay})130 nest.SetDefaults(synapse_model, {'delay' : float(min_delay), 131 'min_delay': float(min_delay), 132 'max_delay': float(max_delay)}) 133 133 simulator.reset() 134 134
