Fix domain logic check

This commit is contained in:
Eryn Wells 2018-03-27 07:21:22 -07:00
parent bf13ec9a94
commit c639752850

View file

@ -20,13 +20,17 @@ class Time:
@property @property
def domain(self): def domain(self):
if self._domain == None: # TODO: This a really dumb hack around numpy arrays not supporting None testing. There must be a better way...
try:
self._domain.size
except AttributeError:
self._domain = np.linspace(0, self.sec, num=self.samples + 1) self._domain = np.linspace(0, self.sec, num=self.samples + 1)
return self._domain finally:
return self._domain
@property @property
def rate(self): def rate(self):
'''Number of samples per second.''' '''Number of samples per second, in Hertz.'''
return self.samples / self.sec return self.samples / self.sec
@property @property