def associate_segments(self, tseries):
        dtw_dist, dtw, path = dynamic_time_warping(self.average, tseries)

        # table telling us which elements of the time series are identified with a specific element of the DBA average
        assoc_table = []
        for i in range(self.average.shape[0]):
            assoc_table.append([])

        i = self.average.shape[0] - 1
        j = tseries.shape[0] - 1

        while i >= 0 and j >= 0:
            assoc_table[i].append(j)
            if path[i, j] == 0:
                i -= 1
                j -= 1
            elif path[i, j] == 1:
                j -= 1
            elif path[i, j] == 2:
                i -= 1
            else:
                # should not happen, but just in case make sure we bail once path[i, j] = -1
                break

        return assoc_table
Identify the indices of the inputs time series that are associated with each element of the average time series.
dataset/ETHPy150Open brandonckelly/bck_stats/bck_stats/dba.py/DBA.associate_segments