Changeset 462

Show
Ignore:
Timestamp:
09/19/08 08:29:29 (2 months ago)
Author:
JensKremkow
Message:

added in getSpikes/v/c compatible_output flag. Now one can get the offical format returned. However, it is still specific to NEST2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/nest2/__init__.py

    r458 r462  
    154154            nest.SetSynapseContext(original_synapse_context) 
    155155     
    156     def get(self, gather=False): 
     156    def get(self, gather=False, compatible_output=True): 
    157157        """Returns the recorded data.""" 
    158158        if self._device is None: 
     
    171171        elif nest.GetStatus(self._device,'to_memory')[0]: 
    172172            data = nest.GetStatus(self._device,'events')[0] 
    173             data = recording.convert_compatible_output(data, self.population, self.variable
     173            data = recording.convert_compatible_output(data, self.population, self.variable,compatible_output
    174174        return data 
    175175     
     
    903903        self.recorders['spikes'].write(filename, gather, compatible_output) 
    904904 
    905     def getSpikes(self, gather=True): 
     905    def getSpikes(self, gather=True, compatible_output=True): 
    906906        """ 
    907907        Return a 2-column numpy array containing cell ids and spike times for 
     
    913913        because they mangle simulator recorder files. 
    914914        """ 
    915         return self.recorders['spikes'].get(gather
    916  
    917     def get_v(self, gather=True): 
     915        return self.recorders['spikes'].get(gather, compatible_output
     916 
     917    def get_v(self, gather=True, compatible_output=True): 
    918918        """ 
    919919        Return a 2-column numpy array containing cell ids and spike times for 
     
    925925        because they mangle simulator recorder files. 
    926926        """ 
    927         return self.recorders['v'].get(gather
     927        return self.recorders['v'].get(gather, compatible_output
    928928             
    929     def get_c(self, gather=True): 
     929    def get_c(self, gather=True, compatible_output=True): 
    930930        """ 
    931931        Return a 2-column numpy array containing cell ids and spike times for 
     
    937937        because they mangle simulator recorder files. 
    938938        """ 
    939         return self.recorders['conductance'].get(gather
     939        return self.recorders['conductance'].get(gather, compatible_output
    940940     
    941941    def meanSpikeCount(self, gather=True): 
  • trunk/src/recording.py

    r444 r462  
    4747        logging.warning("File %s already exists. Renaming the original file to %s_old" % (filename, filename)) 
    4848 
    49 def convert_compatible_output(data, population, variable): 
     49def convert_compatible_output(data, population, variable,compatible_output=True): 
    5050    """ 
    5151    !!! NEST specific !!! 
     
    5959        return numpy.array((data['times'],data['senders']- padding)).T 
    6060    elif variable == 'v': 
    61         return numpy.array((data['times'],data['senders']- padding,data['potentials'])).T 
     61        if compatible_output: 
     62            return numpy.array((data['potentials'],data['senders']- padding)).T 
     63        else: 
     64            return numpy.array((data['times'],data['senders']- padding,data['potentials'])).T 
    6265    elif variable == 'conductance': 
    63         return numpy.array((data['times'],data['senders']- padding,data['exc_conductance'],data['inh_conductance'])).T 
     66        if compatible_output: 
     67            return numpy.array((data['exc_conductance'],data['inh_conductance'],data['senders']- padding)).T 
     68        else: 
     69            return numpy.array((data['times'],data['senders']- padding,data['exc_conductance'],data['inh_conductance'])).T 
    6470             
    6571