Changeset 1031 for branches

Show
Ignore:
Timestamp:
12/13/11 15:58:05 (5 months ago)
Author:
apdavison
Message:

In neo_output branch, we now use AnalogSignalArrays (one per variable) rather than lists of individual AnalogSignals

Location:
branches/neo_output
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • branches/neo_output/src/nest/recording.py

    r1026 r1031  
    420420                    for id in self.filter_recorded('spikes', filter_ids)] 
    421421            else: 
    422                 data = self._multimeter.get_data(variable, 
    423                                                  self.filter_recorded(variable, filter_ids)) 
    424                 segment.analogsignals.extend( 
    425                     neo.AnalogSignal(data[id], 
    426                                      units=recording.UNITS_MAP.get(variable, 'dimensionless'), 
    427                                      t_start=simulator.state.t_start*pq.ms, 
    428                                      sampling_period=simulator.state.dt*pq.ms, 
    429                                      name=variable, 
    430                                      source_population=self.population.label, 
    431                                      source_id=int(id)) 
    432                     for id in self.filter_recorded(variable, filter_ids)) 
     422                ids = self.filter_recorded(variable, filter_ids) 
     423                data = self._multimeter.get_data(variable, ids) 
     424                segment.analogsignalarrays.append( 
     425                    neo.AnalogSignalArray( 
     426                        data.T, 
     427                        units=recording.UNITS_MAP.get(variable, 'dimensionless'), 
     428                        t_start=simulator.state.t_start*pq.ms, 
     429                        sampling_period=simulator.state.dt*pq.ms, 
     430                        name=variable, 
     431                        source_population=self.population.label, 
     432                        source_ids=numpy.fromiter(ids, dtype=int)) 
     433                ) 
    433434        return segment 
    434435 
  • branches/neo_output/src/neuron/recording.py

    r1030 r1031  
    145145                else: 
    146146                    get_signal = lambda id: id._cell.traces[variable] 
    147                 segment.analogsignals.extend( 
    148                     neo.AnalogSignal(get_signal(id), # assuming not using cvode, otherwise need to use IrregularlySampledAnalogSignal 
    149                                      units=recording.UNITS_MAP.get(variable, 'dimensionless'), 
    150                                      t_start=simulator.state.t_start*pq.ms, 
    151                                      sampling_period=simulator.state.dt*pq.ms, 
    152                                      name=variable, 
    153                                      source_population=self.population.label, 
    154                                      source_id=int(id)) 
    155                     for id in self.filter_recorded(variable, filter_ids)) 
    156                 assert segment.analogsignals[0].t_stop - simulator.state.t*pq.ms < 2*simulator.state.dt*pq.ms 
    157                 # need to add `Unit` and `RecordingChannel` objects 
     147                ids = self.filter_recorded(variable, filter_ids) 
     148                signal_array = numpy.vstack((get_signal(id) for id in ids)) 
     149                segment.analogsignalarrays.append( 
     150                    neo.AnalogSignalArray( 
     151                        signal_array.T, # assuming not using cvode, otherwise need to use IrregularlySampledAnalogSignal 
     152                        units=recording.UNITS_MAP.get(variable, 'dimensionless'), 
     153                        t_start=simulator.state.t_start*pq.ms, 
     154                        sampling_period=simulator.state.dt*pq.ms, 
     155                        name=variable, 
     156                        source_population=self.population.label, 
     157                        source_ids=numpy.fromiter(ids, dtype=int)) 
     158                ) 
     159                assert segment.analogsignalarrays[0].t_stop - simulator.state.t*pq.ms < 2*simulator.state.dt*pq.ms 
     160                # need to add `Unit` and `RecordingChannelGroup` objects 
    158161        return segment 
    159162