def make_spt_list(spike_index, n_channels):
    """
    Change a data structure of spike_index from an array of two
    columns to a list

    Parameters
    ----------

    spike_index: numpy.ndarray (n_spikes, 2)
       A 2D array containing spikes information with two columns,
       where the first column is spike time and the second is channel.

    n_channels: int
       the number of channels in recording (or length of output list)

    Returns
    -------
    spike_index_list: list (n_channels)
        A list such that spike_index_list[c] cointains all spike times
        whose channel is c
    """
    spike_index_list = [None] * n_channels
    for c in range(n_channels):
        spike_index_list[c] = spike_index[spike_index[:, (1)] == c, 0]
    return spike_index_list
