# $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/src/tiptilt_ctrl/bcu/util/interp.py 3457 2020-09-14 10:42:41Z depa $
from scipy import signal
import numpy as np

""" INPUT from embedding C++ code
dataHistory
upFactor
downFactor
OUTPUT to embedding C++ code
dataHistoryFinal
"""
FIRCoeff = [.5, 1, .5]


dataHistoryFinal = signal.upfirdn(FIRCoeff, dataArrayDev, up=upFactor, down=downFactor, axis=0)

# dataInterpX = scipy.signal.upfirdn(FIRCoeff, vecXHistory, up=upFactor, down=downFactor) # rate upFactor/downFactor
# dataInterpY = scipy.signal.upfirdn(FIRCoeff, vecYHistory, up=upFactor, down=downFactor) # rate upFactor/downFactor

# conversion to float32 for embedding C++ code
# dataInterpX2 = dataInterpX.astype(np.float32, order='C')
# dataInterpY2 = dataInterpY.astype(np.float32, order='C')



# dataInterpX2 = dataInterpX2[0:dataInterpX2.size/2]
# dataInterpY2 = dataInterpY2[0:dataInterpY2.size/2]
