def compute_fw_at_frac_max_1d_simple(Y, xc, X=None, f=0.5):
    """Compute the full width at fraction f of the maximum"""

    yy = np.asarray(Y)

    if yy.ndim != 1:
        raise ValueError('array must be 1-d')

    if yy.size == 0:
        raise ValueError('array is empty')

    if X is None:
        xx = np.arange(yy.shape[0])
    else:
        xx = X

    xpix = coor_to_pix_1d(xc - xx[0])

    try:
        peak = yy[xpix]
    except IndexError:
        raise ValueError('peak is out of array')

    fwhm_x, _codex, _msgx = compute_fwhm_1d(xx, yy - f * peak, xc, xpix)
    return peak, fwhm_x
Compute the full width at fraction f of the maximum