def smooth(df_master, win = 1):
    """
    Remove outliers in measurement data by smoothing master curve.

    A moving median filter with variable window size is applied to remove 
    outliers from the measurement data. 
    
    Parameters
    ----------
    df_master : pandas.DataFrame
        Contains the master curve data.
    win : int, default = 1 
        Window size of the median filter. A window size of 1 means that no 
        filtering procedure is performed and the input data are returned.

    Return
    ------
    df_master : pandas.DataFrame
        Contains the master curve data, including the filtered arrays.
    """
    modul = df_master.modul
    stor = '{}_stor'.format(modul)
    loss = '{}_loss'.format(modul)
    relax = '{}_relax'.format(modul)
    stor_filt = '{}_stor_filt'.format(modul)
    loss_filt = '{}_loss_filt'.format(modul)
    relax_filt = '{}_relax_filt'.format(modul)

    if df_master.domain == 'freq':
        df_master[stor_filt] = df_master[stor].rolling(win, center=True, min_periods=1).median()
        df_master[loss_filt] = df_master[loss].rolling(win, center=True, min_periods=1).median()
    elif df_master.domain == 'time':
        df_master[relax_filt] = df_master[relax].rolling(win, center=True, min_periods=1).median()
    return df_master