Пример #1
0
 def __getattr__(self, name):
     if name == 'schedule':
         if self.initialized:
             return Global.config['dt'] * self.cyInstance.get_schedule()
         else:
             return self.init['schedule']
     elif name == 'rates':
         if self.initialized:
             if len(self.geometry) > 1:
                 # unflatten the data
                 flat_values = self.cyInstance.get_rates()
                 values = np.zeros(
                     tuple([len(self.schedule)] + list(self.geometry)))
                 for x in range(len(self.schedule)):
                     values[x] = np.reshape(flat_values[x], self.geometry)
                 return values
             else:
                 return self.cyInstance.get_rates()
         else:
             return self.init['rates']
     elif name == 'period':
         if self.initialized:
             return self.cyInstance.get_period() * Global.config['dt']
         else:
             return self.init['period']
     else:
         return Population.__getattribute__(self, name)
Пример #2
0
 def __getattr__(self, name):
     if name == 'schedule':
         if self.initialized:
             return Global.config['dt'] * self.cyInstance.get_schedule()
         else:
             return self.init['schedule']
     elif name == 'rates':
         if self.initialized:
             if len(self.geometry) > 1:
                 # unflatten the data
                 flat_values = self.cyInstance.get_rates()
                 values = np.zeros( tuple( [len(self.schedule)] + list(self.geometry) ) )
                 for x in range(len(self.schedule)):
                     values[x] = np.reshape( flat_values[x], self.geometry)
                 return values
             else:
                 return self.cyInstance.get_rates()
         else:
             return self.init['rates']
     elif name == 'period':
         if self.initialized:
             return self.cyInstance.get_period() * Global.config['dt']
         else:
             return self.init['period']
     else:
         return Population.__getattribute__(self, name)
Пример #3
0
 def __getattr__(self, name):
     if name == 'spike_times':
         if self.initialized:
             return [ [Global.config['dt']*time for time in neur] for neur in self.cyInstance.get_spike_times()]
         else:
             return self.init['spike_times']
     else:
         return Population.__getattribute__(self, name)
Пример #4
0
 def __getattr__(self, name):
     if name == 'spike_times':
         if self.initialized:
             return [[Global.config['dt'] * time for time in neur]
                     for neur in self.cyInstance.get_spike_times()]
         else:
             return self.init['spike_times']
     else:
         return Population.__getattribute__(self, name)
Пример #5
0
 def __getattr__(self, name):
     if name == 'spike_times':
         if self.initialized:
             return self.cyInstance.get_spike_times()
         else:
             return object.__getattribute__(self, name)
     else:
         return Population.__getattribute__(self, name)