creating a seamless signal / loop using interpolation
An alternate method is to create an array of two copies of your input signal

y = [ x , x ]         % MATLAB
y = hstack(( x , x )) # NUMPY


Run $x[k]$ through a LPF.  Then slice $N$ samples from the "middle" of $y[k]$ where $N$ is the length of $x[k]$.

xsmooth = y( o : o + N - 1) % MATLAB
xsmooth = y[ o : o + N ]    # NUMPY


Where $o$ is an appropriately chosen offset.  Be mindful of filter "tails" if you carry out the LPF through conventional convolution.