def phys2dig(signal, dmin, dmax, pmin, pmax):
    """
    converts physical values to digital values

    Parameters
    ----------
    signal : np.ndarray or int
        A numpy array with int values (digital values) or an int.
    dmin : int
        digital minimum value of the edf file (eg -2048).
    dmax : int
        digital maximum value of the edf file (eg 2048).
    pmin : float
        physical maximum value of the edf file (eg -200.0).
    pmax : float
        physical maximum value of the edf file (eg 200.0).

    Returns
    -------
    digital : np.ndarray or int
        converted digital values

    """
    m = (dmax - dmin) / (pmax - pmin)
    digital = m * signal
    return digital
