def METHOD_NAME(timeseries, segmentlength, noverlap=0, window='hann'):
    """Calculate a Rayleigh statistic spectrum
    Parameters
    ----------
    timeseries : `~gwpy.timeseries.TimeSeries`
        input `TimeSeries` data.
    segmentlength : `int`
        number of samples in single average.
    noverlap : `int`
        number of samples to overlap between segments, passing `None` will
        choose based on the window method, default: ``0``
    window : `str`, `numpy.ndarray`, optional
        window function to apply to ``timeseries`` prior to FFT,
        see :func:`scipy.signal.get_window` for details on acceptable
        formats
    Returns
    -------
    spectrum : `~gwpy.frequencyseries.FrequencySeries`
        average power `FrequencySeries`
    """
    stepsize = segmentlength - noverlap
    if noverlap:
        numsegs = 1 + int((timeseries.size - segmentlength) / float(noverlap))
    else:
        numsegs = int(timeseries.size // segmentlength)
    tmpdata = numpy.ndarray((numsegs, int(segmentlength//2 + 1)))
    for i in range(numsegs):
        tmpdata[i, :] = welch(
            timeseries[i*stepsize:i*stepsize+segmentlength],
            segmentlength, window=window)
    std = tmpdata.std(axis=0)
    mean = tmpdata.mean(axis=0)
    return FrequencySeries(std/mean, unit='', copy=False, f0=0,
                           epoch=timeseries.epoch,
                           df=timeseries.sample_rate.value/segmentlength,
                           channel=timeseries.channel,
                           name='Rayleigh spectrum of %s' % timeseries.name)