Changeset 1030
- Timestamp:
- 12/13/11 15:04:42 (5 months ago)
- Location:
- branches/neo_output
- Files:
-
- 12 modified
-
examples/IF_cond_exp.py (modified) (1 diff)
-
examples/VAbenchmarks.py (modified) (2 diffs)
-
examples/VAbenchmarks2.py (modified) (3 diffs)
-
examples/VAbenchmarks3.py (modified) (3 diffs)
-
examples/simpleNetwork.py (modified) (1 diff)
-
examples/simpleRandomNetwork.py (modified) (2 diffs)
-
src/common/populations.py (modified) (2 diffs)
-
src/common/projections.py (modified) (1 diff)
-
src/connectors.py (modified) (1 diff)
-
src/neuron/cells.py (modified) (2 diffs)
-
src/neuron/recording.py (modified) (2 diffs)
-
src/recording/__init__.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/neo_output/examples/IF_cond_exp.py
r1025 r1030 35 35 connI = connect(spike_sourceI, ifcell, weight=0.02, synapse_type ='inhibitory',delay=4.0) 36 36 37 record_v(ifcell, "Results/IF_cond_exp_%s. v" % simulator_name)37 record_v(ifcell, "Results/IF_cond_exp_%s.h5" % simulator_name) 38 38 #try: 39 record_gsyn(ifcell, "Results/IF_cond_exp_%s.gsyn" % simulator_name)39 #record_gsyn(ifcell, "Results/IF_cond_exp_%s.gsyn" % simulator_name) 40 40 #except (NotImplementedError, RecordingError): 41 41 # pass -
branches/neo_output/examples/VAbenchmarks.py
r1006 r1030 168 168 simCPUTime = timer.diff() 169 169 170 E_count = exc_cells.mean SpikeCount()171 I_count = inh_cells.mean SpikeCount()170 E_count = exc_cells.mean_spike_count() 171 I_count = inh_cells.mean_spike_count() 172 172 173 173 # === Print results to file ==================================================== … … 178 178 os.mkdir('Results') 179 179 180 exc_cells.write_data(PyNNTextIO("Results/VAbenchmark_%s_exc_%s_np%d.ras" % (benchmark, simulator_name, np)), 'spikes') 181 inh_cells.write_data(PyNNTextIO("Results/VAbenchmark_%s_inh_%s_np%d.ras" % (benchmark, simulator_name, np)), 'spikes') 182 exc_cells[[0, 1]].write_data(PyNNTextIO("Results/VAbenchmark_%s_exc_%s_np%d.v" % (benchmark, simulator_name, np)), 'v') 180 exc_cells.write_data("Results/VAbenchmark_%s_exc_%s_np%d.txt" % (benchmark, simulator_name, np)) 181 inh_cells.write_data("Results/VAbenchmark_%s_inh_%s_np%d.txt" % (benchmark, simulator_name, np)) 183 182 writeCPUTime = timer.diff() 184 183 -
branches/neo_output/examples/VAbenchmarks2.py
r915 r1030 148 148 # === Setup recording ========================================================== 149 149 print "%s Setting up recording..." % node_id 150 all_cells.record( )151 exc_cells[[0, 1]].record _v()150 all_cells.record('spikes') 151 exc_cells[[0, 1]].record('v') 152 152 153 153 buildCPUTime = timer.diff() … … 167 167 simCPUTime = timer.diff() 168 168 169 E_count = exc_cells.mean SpikeCount()170 I_count = inh_cells.mean SpikeCount()169 E_count = exc_cells.mean_spike_count() 170 I_count = inh_cells.mean_spike_count() 171 171 172 172 # === Print results to file ==================================================== … … 177 177 os.mkdir('Results') 178 178 179 exc_cells.printSpikes("Results/VAbenchmark_%s_exc_%s_np%d.ras" % (benchmark, simulator_name, np)) 180 inh_cells.printSpikes("Results/VAbenchmark_%s_inh_%s_np%d.ras" % (benchmark, simulator_name, np)) 181 exc_cells[[0, 1]].print_v("Results/VAbenchmark_%s_exc_%s_np%d.v" % (benchmark, simulator_name, np)) 179 all_cells.write_data("Results/VAbenchmark_%s_%s_np%d.txt" % (benchmark, simulator_name, np)) 180 182 181 writeCPUTime = timer.diff() 183 182 -
branches/neo_output/examples/VAbenchmarks3.py
r915 r1030 149 149 # === Setup recording ========================================================== 150 150 print "%s Setting up recording..." % node_id 151 all_cells.record( )152 exc_cells[[0, 1]].record _v()151 all_cells.record('spikes') 152 exc_cells[[0, 1]].record('v') 153 153 154 154 buildCPUTime = timer.diff() … … 168 168 simCPUTime = timer.diff() 169 169 170 E_count = exc_cells.mean SpikeCount()171 I_count = inh_cells.mean SpikeCount()170 E_count = exc_cells.mean_spike_count() 171 I_count = inh_cells.mean_spike_count() 172 172 173 173 # === Print results to file ==================================================== … … 178 178 os.mkdir('Results') 179 179 180 exc_cells.printSpikes("Results/VAbenchmark_%s_exc_%s_np%d.ras" % (benchmark, simulator_name, np)) 181 inh_cells.printSpikes("Results/VAbenchmark_%s_inh_%s_np%d.ras" % (benchmark, simulator_name, np)) 182 exc_cells[[0, 1]].print_v("Results/VAbenchmark_%s_exc_%s_np%d.v" % (benchmark, simulator_name, np)) 180 all_cells.write_data("Results/VAbenchmark_%s_%s_np%d.txt" % (benchmark, simulator_name, np)) 181 183 182 writeCPUTime = timer.diff() 184 183 -
branches/neo_output/examples/simpleNetwork.py
r933 r1030 33 33 projection.setWeights(1.0) 34 34 35 input_population.record() 36 output_population.record() 37 output_population.record_v() 35 input_population.record('spikes') 36 output_population.record(('spikes', 'v')) 38 37 39 38 run(tstop) 40 39 41 output_population.printSpikes("Results/simpleNetwork_output_%s.ras" % simulator_name) 42 input_population.printSpikes("Results/simpleNetwork_input_%s.ras" % simulator_name) 43 output_population.print_v("Results/simpleNetwork_%s.v" % simulator_name) 40 output_population.write_data("Results/simpleNetwork_output_%s.h5" % simulator_name) 41 input_population.write_data("Results/simpleNetwork_input_%s.h5" % simulator_name) 44 42 45 43 end() -
branches/neo_output/examples/simpleRandomNetwork.py
r933 r1030 50 50 projection.saveConnections('%s.conn' % file_stem) 51 51 52 input_population.record( )53 output_population.record( )54 output_population.sample(n_record, rng).record _v()52 input_population.record('spikes') 53 output_population.record('spikes') 54 output_population.sample(n_record, rng).record('v') 55 55 56 56 print "[%d] Running simulation" % node … … 58 58 59 59 print "[%d] Writing spikes to disk" % node 60 output_population. printSpikes('%s_output.ras' % file_stem)61 input_population. printSpikes('%s_input.ras' % file_stem)60 output_population.write_data('%s_output.ras' % file_stem, 'spikes') 61 input_population.write_data('%s_input.ras' % file_stem) 62 62 print "[%d] Writing Vm to disk" % node 63 output_population. print_v('%s.v' % file_stem)63 output_population.write_data('%s.v' % file_stem, 'v') 64 64 65 65 print "[%d] Finishing" % node -
branches/neo_output/src/common/populations.py
r1008 r1030 14 14 import tempfile 15 15 from pyNN import random, recording, errors, standardmodels, core, space, descriptions 16 from pyNN.recording import files17 16 from itertools import chain 18 17 … … 501 500 simulated on the local node. 502 501 """ 503 self.recorder.get(variables, gather, self.record_filter)502 return self.recorder.get(variables, gather, self.record_filter) 504 503 505 504 @deprecated("write_data(file, 'spikes')") -
branches/neo_output/src/common/projections.py
r1000 r1030 11 11 import operator 12 12 from pyNN import random, recording, errors, models, core, descriptions 13 from pyNN.recording import files14 13 from populations import BasePopulation, Assembly, is_conductance 15 14 -
branches/neo_output/src/connectors.py
r1003 r1030 12 12 from pyNN import errors, common, core, random, utility, recording, descriptions 13 13 from pyNN.space import Space 14 from pyNN.recording import files14 #from pyNN.recording import files 15 15 from pyNN.random import RandomDistribution 16 16 from numpy import arccos, arcsin, arctan, arctan2, ceil, cos, cosh, e, exp, \ -
branches/neo_output/src/neuron/cells.py
r957 r1030 288 288 # insert Brette-Gerstner spike mechanism 289 289 self.adexp = h.AdExpIF(0.5, sec=self) 290 self.source = self. seg._ref_v290 self.source = self.adexp 291 291 292 292 self.parameter_names = ['c_m', 'tau_m', 'v_rest', 'v_thresh', 't_refrac', … … 330 330 def record(self, active): 331 331 if active: 332 self.rec = h.NetCon(self.s ource, None,332 self.rec = h.NetCon(self.seg._ref_v, None, 333 333 self.get_threshold(), 0.0, 0.0, 334 334 sec=self) -
branches/neo_output/src/neuron/recording.py
r1026 r1030 144 144 get_signal = lambda id: id._cell.gsyn_trace['inhibitory'] 145 145 else: 146 signal = lambda id: id._cell.traces[variable]146 get_signal = lambda id: id._cell.traces[variable] 147 147 segment.analogsignals.extend( 148 148 neo.AnalogSignal(get_signal(id), # assuming not using cvode, otherwise need to use IrregularlySampledAnalogSignal … … 154 154 source_id=int(id)) 155 155 for id in self.filter_recorded(variable, filter_ids)) 156 assert segment.analogsignals[0].t_stop - simulator.state.t*pq.ms < simulator.state.dt*pq.ms156 assert segment.analogsignals[0].t_stop - simulator.state.t*pq.ms < 2*simulator.state.dt*pq.ms 157 157 # need to add `Unit` and `RecordingChannel` objects 158 158 return segment -
branches/neo_output/src/recording/__init__.py
r1025 r1030 90 90 def normalize_variables_arg(variables): 91 91 """If variables is a single string, encapsulate it in a list.""" 92 if isinstance(variables, basestring) :92 if isinstance(variables, basestring) and variables != 'all': 93 93 return [variables] 94 94 else: … … 99 99 Return a Neo IO instance, guessing the type based on the filename suffix. 100 100 """ 101 if os.path.splitext(filename)[0] in ('.txt', '.ras', '.v', '.gsyn'): 102 return neo.io.PyNNTextIO(filename) 101 extension = os.path.splitext(filename)[1] 102 if extension in ('.txt', '.ras', '.v', '.gsyn'): 103 return neo.io.PyNNTextIO(filename=filename) 104 elif extension in ('.h5',): 105 return neo.io.NeoHdf5IO(filename=filename) 103 106 else: # function to be improved later 104 r eturn neo.io.PyNNTextIO(filename)107 raise Exception("file extension %s not supported" % extension) 105 108 106 109 … … 167 170 if self._simulator.state.mpi_rank == 0 or gather == False: 168 171 # Open the output file, if necessary and write the data 169 logger.debug("Writing data to file %s" % file)170 file.write(data)172 logger.debug("Writing data to file %s" % io) 173 io.write(data) 171 174 172 175 @property
