def _sample_pair(self):
    'Sample a pair of two windows.\n        '
    (win_ind1, rec_ind1) = self.sample_window()
    ts1 = self.metadata.iloc[win_ind1]['i_start_in_trial']
    ts = self.info.iloc[rec_ind1]['i_start_in_trial']
    pair_type = self.rng.binomial(1, 0.5)
    win_ind2 = None
    if (pair_type == 0):
        if self.same_rec_neg:
            mask = (((ts <= (ts1 - self.tau_neg)) & (ts >= (ts1 - self.tau_max))) | ((ts >= (ts1 + self.tau_neg)) & (ts <= (ts1 + self.tau_max))))
        else:
            rec_ind2 = rec_ind1
            while (rec_ind2 == rec_ind1):
                (win_ind2, rec_ind2) = self.sample_window()
    elif (pair_type == 1):
        mask = ((ts >= (ts1 - self.tau_pos)) & (ts <= (ts1 + self.tau_pos)))
    if (win_ind2 is None):
        mask[(ts == ts1)] = False
        if (sum(mask) == 0):
            raise NotImplementedError
        win_ind2 = self.rng.choice(self.info.iloc[rec_ind1]['index'][mask])
    return (win_ind1, win_ind2, float(pair_type))
Sample a pair of two windows.
def _sample_pair(self):
    '\n        '
    (win_ind1, rec_ind1) = self.sample_window()
    ts1 = self.metadata.iloc[win_ind1]['i_start_in_trial']
    ts = self.info.iloc[rec_ind1]['i_start_in_trial']
    pair_type = self.rng.binomial(1, 0.5)
    win_ind2 = None
    if (pair_type == 0):
        if self.same_rec_neg:
            mask = (((ts <= (ts1 - self.tau_neg)) & (ts >= (ts1 - self.tau_max))) | ((ts >= (ts1 + self.tau_neg)) & (ts <= (ts1 + self.tau_max))))
        else:
            rec_ind2 = rec_ind1
            while (rec_ind2 == rec_ind1):
                (win_ind2, rec_ind2) = self.sample_window()
    elif (pair_type == 1):
        mask = ((ts >= (ts1 - self.tau_pos)) & (ts <= (ts1 + self.tau_pos)))
    if (win_ind2 is None):
        mask[(ts == ts1)] = False
        if (sum(mask) == 0):
            raise NotImplementedError
        win_ind2 = self.rng.choice(self.info.iloc[rec_ind1]['index'][mask])
    return (win_ind1, win_ind2, float(pair_type))