Fix domain logic check
This commit is contained in:
parent
bf13ec9a94
commit
c639752850
1 changed files with 7 additions and 3 deletions
|
@ -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)
|
||||||
|
finally:
|
||||||
return self._domain
|
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue