The goal of this function is to create a function, f(r),
that will generate the original 2D envelopeImage.mrc
The function will contain 1D points and use linear interpolation
to fill in the gaps. The function is also monotonically decreasing.
Numpy has an linear interpolation function: numpy.interp
http://docs.scipy.org/doc/numpy/reference/generated/numpy.interp.html
Scipy has non-linear interpolation functions: scipy.interpolate
http://docs.scipy.org/doc/scipy/reference/interpolate.html
including cubic spline, which is probably ideal.
I need to decide the resolution of the 1D and
I decided that 1 pixel was enough ranging between 0 and 2896
to fill a complete 4k image
Create two numpy arrays one for sums and a second for weight. Loop through all
pixels and make their contribution to the relevant pixels (+/- 3 pixels).
At the end, divide the sums by the weights and we obtain the 1D function, f(r).
For each integer in r, I will then calculate a mean based on all nearby values
+/- 2 pixels. Probably with a Gaussian weighting, error function in python
from scipy.special import erfc
weight = erfc( abs(r-r_i)/Sqrt(2) )
f(0) = 265.20575 based on linear extrapolation involving first 4 points
f(2896) = 185.45721 based on linear extrapolation involving last 4 points