

def medianBin(time, flux, medianWidth):
    '\n    Produce median binning of a flux vector\n\n    Parameters\n    ----------\n    time : list or numpy.ndarray\n        List of times in time series\n\n    flux : list or numpy.ndarray\n        List of fluxes, one for each time in `time` vector\n\n    medianWidth : int\n        Width of each bin in units of data points\n\n    Returns\n    -------\n    [binnedTime, binnedFlux, binnedStd] : [list, list, list]             or [numpy.ndarray, numpy.ndarray, numpy.ndarray]\n        The times, fluxes and uncertainties on each binned point,\n        where `binnedTime` is the time for each bin, `binnedFlux`\n        is the median flux in each bin, and `binnedStd` is the standard\n        deviation of the points within each bin\n    '
    numberBins = int(math.ceil((len(time) / float(medianWidth))))
    binnedTime = np.arange(numberBins, dtype=float)
    binnedFlux = np.arange(numberBins, dtype=float)
    binnedStd = np.arange(numberBins, dtype=float)
    for i in range(numberBins):
        fluxInBin = flux[(i * medianWidth):((i + 1) * medianWidth)]
        binnedTime[i] = np.median(time[(i * medianWidth):((i + 1) * medianWidth)])
        binnedFlux[i] = np.median(fluxInBin)
        binnedStd[i] = (np.std(fluxInBin) / np.sqrt(len(fluxInBin)))
    return (binnedTime, binnedFlux, binnedStd)

dataset/ETHPy150Open OSCAAR/OSCAAR/oscaar/mathMethods.py medianBin/original