mirror of https://github.com/m-labs/artiq.git
wavesynth: handle short segments
This commit is contained in:
parent
269e9c600c
commit
94584bb8b1
|
@ -179,7 +179,7 @@ class SplineSource(CoefficientSource):
|
||||||
x = self.x[ia:ib]
|
x = self.x[ia:ib]
|
||||||
return np.r_[start, x, stop]
|
return np.r_[start, x, stop]
|
||||||
|
|
||||||
def scale_x(self, x, scale, min_duration=10, min_length=20):
|
def scale_x(self, x, scale, min_duration=1, min_length=20):
|
||||||
"""Enforce, round, and scale x to device-dependent values.
|
"""Enforce, round, and scale x to device-dependent values.
|
||||||
|
|
||||||
Due to minimum duration and/or minimum segment length constraints
|
Due to minimum duration and/or minimum segment length constraints
|
||||||
|
@ -202,11 +202,11 @@ class SplineSource(CoefficientSource):
|
||||||
dt = np.diff(t.astype(np.int))
|
dt = np.diff(t.astype(np.int))
|
||||||
|
|
||||||
valid = np.absolute(dt) >= min_duration
|
valid = np.absolute(dt) >= min_duration
|
||||||
dt = dt[valid]
|
if not np.any(valid):
|
||||||
t = t[np.r_[True, valid]]
|
valid[0] = True
|
||||||
if dt.shape[0] == 1:
|
|
||||||
dt[0] = max(dt[0], min_length)
|
dt[0] = max(dt[0], min_length)
|
||||||
x_sample = t[:-1]*scale
|
dt = dt[valid]
|
||||||
|
x_sample = t[:-1][valid]*scale
|
||||||
return x_sample, dt
|
return x_sample, dt
|
||||||
|
|
||||||
def __call__(self, x):
|
def __call__(self, x):
|
||||||
|
|
Loading…
Reference in New Issue