diff --git a/artiq/devices/pdq2/driver.py b/artiq/devices/pdq2/driver.py index 851adb5c8..aa8b8ae31 100644 --- a/artiq/devices/pdq2/driver.py +++ b/artiq/devices/pdq2/driver.py @@ -6,7 +6,7 @@ import struct import serial -from artiq.wavesynth.interpolate import discrete_compensate +from artiq.wavesynth.coefficients import discrete_compensate logger = logging.getLogger(__name__) diff --git a/artiq/wavesynth/interpolate.py b/artiq/wavesynth/coefficients.py similarity index 90% rename from artiq/wavesynth/interpolate.py rename to artiq/wavesynth/coefficients.py index 8e133c1c7..c19c4f7a5 100644 --- a/artiq/wavesynth/interpolate.py +++ b/artiq/wavesynth/coefficients.py @@ -24,11 +24,14 @@ def _interpolate(time, data, sample_times, order=3): def discrete_compensate(c): - if len(c) > 2: - c[1] += c[2]/2 - if len(c) > 3: - c[1] += c[3]/6 + l = len(c) + if l > 2: + c[1] += c[2]/2. + if l > 3: + c[1] += c[3]/6. c[2] += c[3] + if l > 4: + raise ValueError("only third-order splines supported") def _zip_program(times, channels, target): diff --git a/artiq/wavesynth/compute_samples.py b/artiq/wavesynth/compute_samples.py index 76841c35e..c615c9dd1 100644 --- a/artiq/wavesynth/compute_samples.py +++ b/artiq/wavesynth/compute_samples.py @@ -1,7 +1,7 @@ from copy import copy from math import cos, pi -from artiq.wavesynth.interpolate import discrete_compensate +from artiq.wavesynth.coefficients import discrete_compensate class Spline: