'**SUMMARY**
Finds the running average by either using a uniform kernel or using a gaussian kernel.
The gaussian kernelis calculated from the standard normal distribution formulae.
**PARAMETERS**
* *diameter* - Size of the window (should be odd int) - int
* *algo* - "uniform" (default) / "gaussian" - used to decide the kernel - string
**RETURNS**
A LineScan object with the kernel of the provided algorithm applied.
**EXAMPLE**
>>> ls = img.getLineScan(x=10)
>>> ra = ls.runningAverage()
>>> rag = ls.runningAverage(15,algo="gaussian")
>>> plt.plot(ls)
>>> plt.plot(ra)
>>> plt.plot(rag)
>>> plt.show()'

def runningAverage(self, diameter=3, algo='uniform'):

    if ((diameter % 2) == 0):
        warnings.warn('Diameter    must    be    an    odd    integer')
        return None
    if (algo == 'uniform'):
        kernel = list(((1 / float(diameter)) * np.ones(diameter)))
    elif (algo == 'gaussian'):
        kernel = list()
        r = (float(diameter) / 2)
        for i in range((- int(r)), (int(r) + 1)):
            kernel.append((np.exp(((- (i ** 2)) / (2 * ((r / 3) ** 2)))) / (np.sqrt((2 * np.pi)) * (r / 3))))
    retVal = LineScan(map(int, self.convolve(kernel)))
    retVal._update(self)
    return retVal
