def get_frequency_modes(seq_len, modes=64, mode_select_method='random'):
    """
    get modes on frequency domain:
    'random' means sampling randomly;
    'else' means sampling the lowest modes;
    """
    modes = min(modes, seq_len//2)
    if mode_select_method == 'random':
        index = list(range(0, seq_len // 2))
        np.random.shuffle(index)
        index = index[:modes]
    else:
        index = list(range(0, modes))
    index.sort()
    return index

    get modes on frequency domain:
    'random' means sampling randomly;
    'else' means sampling the lowest modes;
    
PatchTST_supervised/Formers/FEDformer/layers/FourierCorrelation.py