Load a .mod file (sometimes also called volt.dat or data.crt). This file
    contains the number of measurements in the first line, and in the following
    lines measurements. Each line consists of 4 columns:

    * the first column contains the current injection electrodes a and b,
      stored as one integer using the equation: a * 1e4 + b
    * the second column contains the voltage measurement electrodes m and n,
      stored as one integer using the equation: m * 1e4 + n
    * the third column contains the measured resistance [Ohm]
    * the fourth column contains the measured phase value [mrad]

    Parameters
    ----------
    filename : string
        Path of filename to import

    Returns
    -------
    df : pandas.DataFrame
        A reda-conform DataFrame

    Examples
    --------

        import reda
        import reda.importers.crtomo as cexp
        df = cexp.load_mod_file('volt_01_0.1Hz.crt')
        ert = reda.ERT(data=df)

def load_mod_file(filename):
    """Load a .mod file (sometimes also called volt.dat or data.crt). This file
    contains the number of measurements in the first line, and in the following
    lines measurements. Each line consists of 4 columns:

    * the first column contains the current injection electrodes a and b,
      stored as one integer using the equation: a * 1e4 + b
    * the second column contains the voltage measurement electrodes m and n,
      stored as one integer using the equation: m * 1e4 + n
    * the third column contains the measured resistance [Ohm]
    * the fourth column contains the measured phase value [mrad]

    Parameters
    ----------
    filename : string
        Path of filename to import

    Returns
    -------
    df : pandas.DataFrame
        A reda-conform DataFrame

    Examples
    --------

        import reda
        import reda.importers.crtomo as cexp
        df = cexp.load_mod_file('volt_01_0.1Hz.crt')
        ert = reda.ERT(data=df)

    """
    df_raw = pd.read_csv(
        filename, skiprows=1, delim_whitespace=True,
        names=['ab', 'mn', 'r', 'rpha']
    )
    df_raw['Zt'] = df_raw['r'] * np.exp(1j * df_raw['rpha'] / 1000.0)
    df_raw['a'] = np.floor(df_raw['ab'] / 1e4).astype(int)
    df_raw['b'] = (df_raw['ab'] % 1e4).astype(int)
    df_raw['m'] = np.floor(df_raw['mn'] / 1e4).astype(int)
    df_raw['n'] = (df_raw['mn'] % 1e4).astype(int)

    df = df_raw.drop(['ab', 'mn'], axis=1)
    return df