forked from M-Labs/artiq
1
0
Fork 0

wavesynth: interpolate->coefficients

This commit is contained in:
Robert Jördens 2015-04-05 04:42:28 -06:00
parent 0bab73eece
commit 7ea9250b31
3 changed files with 9 additions and 6 deletions

View File

@ -6,7 +6,7 @@ import struct
import serial import serial
from artiq.wavesynth.interpolate import discrete_compensate from artiq.wavesynth.coefficients import discrete_compensate
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -24,11 +24,14 @@ def _interpolate(time, data, sample_times, order=3):
def discrete_compensate(c): def discrete_compensate(c):
if len(c) > 2: l = len(c)
c[1] += c[2]/2 if l > 2:
if len(c) > 3: c[1] += c[2]/2.
c[1] += c[3]/6 if l > 3:
c[1] += c[3]/6.
c[2] += c[3] c[2] += c[3]
if l > 4:
raise ValueError("only third-order splines supported")
def _zip_program(times, channels, target): def _zip_program(times, channels, target):

View File

@ -1,7 +1,7 @@
from copy import copy from copy import copy
from math import cos, pi from math import cos, pi
from artiq.wavesynth.interpolate import discrete_compensate from artiq.wavesynth.coefficients import discrete_compensate
class Spline: class Spline: