<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Q1
Step1:  astropy convolution
How do you convolve fast?
see, e.g., http
Step2:  Speed of DFT
Step3:  faster fftw
Step4:  Q3
Install a module, then keep editing it.
python setup.py develop
Use https
<ASSISTANT_TASK:>
Python Code:
x = StringIO.StringIO()
arr = np.arange(10)
np.savetxt(x,arr, header='test', comments="")
x.seek(0)
print(x.read())
with open('file.txt','w') as f:
    f.write(x.getvalue())
%%bash
cat file.txt
Explanation: Q1:
Saving a table to text with a header with no preceding "#"
Also, demo StringIO
End of explanation
from astropy.convolution import convolve, convolve_fft
Explanation: astropy convolution
How do you convolve fast?
see, e.g., http://keflavich.github.io/blog/fft-comparisons-in-python.html
End of explanation
import scipy.fftpack, scipy.ndimage, scipy.signal
scipy.ndimage.convolve
scipy.signal.fftconvolve??
%%bash
factor 9216
Explanation: Speed of DFT: $O(n^2)$
Speed of FFT: $O(n log(n))$
End of explanation
x = np.random.randn(64) + 5 + np.sin(np.arange(64))*3
f = np.fft.fft(x)
pl.plot(x)
%matplotlib inline
import pylab as pl
pl.plot(np.abs(f))
f[0] = 0
f[10] = 0
f[64-10] = 0
pl.plot(np.abs(f))
xi = np.fft.ifft(f)
pl.plot(xi.real)
pl.plot(x)
Explanation: faster fftw: --enable-avx for "advanced vector instructions".  8x FLOPs at a time!
What does it mean to "remove" fft modes?
End of explanation
%%bash
cd ~/repos/astropy
ls
ls build/
Explanation: Q3
Install a module, then keep editing it.
python setup.py develop
Use https://github.com/astropy/package-template to get everything set up in a cool way.  develop doesn't do much good for C code.
Within an interactive session, use reload(package) (python2) or import importlib; importlib.reload(package) to reload the package.  This finnicky.
Other option, which works with C extensions: python setup.py build_ext --inplace.  Or you can use python setup.py build to build into the build/ directory, which will then be accessible using import if you've used python setup.py develop
End of explanation
<END_TASK>