def max_inmask(maxima, mask, withvalue=1.0):
    """Get the maxima located where the mask have a specific value (e.g., 1)
    
    Parameters
    ----------
    maxima : pd.DataFrame
        Pandas DataFrame with the information of the maxima. Has to contain at least the column 'Pixel number'.
    mask : np.ndarray
        A Healpix map to be used as mask. **Its ``nside`` should be the same as the original map.**
    withvalue : float, optional
        Value to be matched. Only maxima that have this value on the ``mask`` will be returned.

    Returns
    -------
    pd.DataFrame
        The same Pandas DataFrame as the input ``maxima``, but containing only the maxima located at points where the
        ``mask`` has the value ``withvalue`` (1 by default).
    """
    filtered_maxima = maxima.loc[mask[maxima['Pixel number']] == withvalue]
    return filtered_maxima
