def rayleigh(timeseries, segmentlength, noverlap=<NUM_LIT:0>):
stepsize = segmentlength - noverlap<EOL>if noverlap:<EOL><INDENT>numsegs = <NUM_LIT:1> + int((timeseries.size - segmentlength) / float(noverlap))<EOL><DEDENT>else:<EOL><INDENT>numsegs = int(timeseries.size // segmentlength)<EOL><DEDENT>tmpdata = numpy.ndarray((numsegs, int(segmentlength//<NUM_LIT:2> + <NUM_LIT:1>)))<EOL>for i in range(numsegs):<EOL><INDENT>tmpdata[i, :] = welch(<EOL>timeseries[i*stepsize:i*stepsize+segmentlength],<EOL>segmentlength)<EOL><DEDENT>std = tmpdata.std(axis=<NUM_LIT:0>)<EOL>mean = tmpdata.mean(axis=<NUM_LIT:0>)<EOL>return FrequencySeries(std/mean, unit='<STR_LIT>', copy=False, f0=<NUM_LIT:0>,<EOL>epoch=timeseries.epoch,<EOL>df=timeseries.sample_rate.value/segmentlength,<EOL>channel=timeseries.channel,<EOL>name='<STR_LIT>' % timeseries.name)<EOL>
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, defaults to 50%.

    Returns
    -------
    spectrum : `~gwpy.frequencyseries.FrequencySeries`
        average power `FrequencySeries`