Changeset 443
- Timestamp:
- 01/18/10 16:45:34 (2 years ago)
- Location:
- trunk/src
- Files:
-
- 3 modified
-
datastore/keygenerators.py (modified) (1 diff)
-
signals/analogs.py (modified) (3 diffs)
-
signals/spikes.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/datastore/keygenerators.py
r385 r443 2 2 Key generators for data store objects 3 3 """ 4 import hashlib, pickle 4 import hashlib, pickle, sys, os.path 5 5 6 6 def full_type(component): 7 7 """Returns a string representing the full type of the component.""" 8 8 if component.__class__.__name__ == 'module': # component is a module 9 return component.__name__ 9 if component.__name__ == "__main__": 10 return os.path.basename(sys.argv[0][:-3]) 11 else: 12 return component.__name__ 10 13 else: 11 14 return component.__module__ + '.' + component.__class__.__name__ -
trunk/src/signals/analogs.py
r390 r443 209 209 210 210 t = self.time_axis() 211 i_start = int( (t_start-self.t_start)/self.dt)212 i_stop = int( (t_stop-self.t_start)/self.dt)211 i_start = int(round((t_start-self.t_start)/self.dt)) 212 i_stop = int(round((t_stop-self.t_start)/self.dt)) 213 213 signal = self.signal[i_start:i_stop] 214 214 result = AnalogSignal(signal, self.dt, t_start, t_stop) … … 471 471 errmsgs = [] 472 472 for attr in "dt", "t_start", "t_stop": 473 if getattr(val, attr) != getattr(self, attr): 474 errmsgs.append("%s: %g != %g" % (attr, getattr(val, attr), getattr(self, attr))) 473 if getattr(self, attr) == 0: 474 if getattr(val, attr) != 0: 475 errmsgs.append("%s: %g != %g (diff=%g)" % (attr, getattr(val, attr), getattr(self, attr), getattr(val, attr)-getattr(self, attr))) 476 elif (getattr(val, attr) - getattr(self, attr))/getattr(self, attr) > 1e-12: 477 errmsgs.append("%s: %g != %g (diff=%g)" % (attr, getattr(val, attr), getattr(self, attr), getattr(val, attr)-getattr(self, attr))) 475 478 if len(val) != self.signal_length: 476 479 errmsgs.append("signal length: %g != %g" % (len(val), self.signal_length)) … … 703 706 mean 704 707 """ 705 result = numpy.zeros((len(self), int( (self.t_stop - self.t_start)/self.dt)),float)708 result = numpy.zeros((len(self), int(round((self.t_stop - self.t_start)/self.dt))), float) 706 709 for count, id in enumerate(self.id_list()): 707 710 try: -
trunk/src/signals/spikes.py
r436 r443 1686 1686 if len(self.dimensions) == 2: 1687 1687 x = (id-offset) % self.dimensions[1] 1688 y = self.dimensions[0] - 1 - int(numpy.floor((id-offset)/self.dimensions[1]))1688 y = self.dimensions[0] - 1 - numpy.floor((id-offset)/self.dimensions[1]).astype(int) 1689 1689 return (x,y) 1690 1690
