def getPopCM(self, trial_data, order=[]):
    if (len(trial_data[0][2]) != len(self.trial_data[0][2])):
        numResp = len(trial_data[0][2])
    else:
        numResp = len(self.trial_data[0][2])
    obj_inds = []
    for t in trial_data:
        if (len(np.unique(obj_inds)) == self.numObjs):
            break
        else:
            obj_inds.append(t[0])
    if (len(np.unique(obj_inds)) != self.numObjs):
        obj_inds = range(self.numObjs)
    else:
        obj_inds = obj_inds
    combs = list(itertools.combinations(np.unique(obj_inds), numResp))
    CMs = [np.zeros((numResp, numResp)) for i in range(0, len(combs))]
    for trial in trial_data:
        distractor = [m for m in trial[2] if (m != trial[0])]
        target = trial[0]
        pick = trial[1]
        possCombs = [[comb, idx] for (idx, comb) in enumerate(combs) if (target in comb)]
        for comb in possCombs:
            if set(distractor).issubset(set(comb[0])):
                if (len(order) > 0):
                    comb[0] = order
                if (pick == target):
                    idx = comb[0].index(pick)
                    CMs[comb[1]][(idx, idx)] += 1
                elif (pick != target):
                    CMs[comb[1]][(comb[0].index(pick), comb[0].index(target))] += 1
                else:
                    print('Matrix Error')
    return (CMs, combs)
def getPopCM(self, trial_data, order=[]):
    if (len(trial_data[0][2]) != len(self.trial_data[0][2])):
        numResp = len(trial_data[0][2])
    else:
        numResp = len(self.trial_data[0][2])
    obj_inds = []
    for t in trial_data:
        if (len(np.unique(obj_inds)) == self.numObjs):
            break
        else:
            obj_inds.append(t[0])
    if (len(np.unique(obj_inds)) != self.numObjs):
        obj_inds = range(self.numObjs)
    else:
        obj_inds = obj_inds
    combs = list(itertools.combinations(np.unique(obj_inds), numResp))
    CMs = [np.zeros((numResp, numResp)) for i in range(0, len(combs))]
    for trial in trial_data:
        distractor = [m for m in trial[2] if (m != trial[0])]
        target = trial[0]
        pick = trial[1]
        possCombs = [[comb, idx] for (idx, comb) in enumerate(combs) if (target in comb)]
        for comb in possCombs:
            if set(distractor).issubset(set(comb[0])):
                if (len(order) > 0):
                    comb[0] = order
                if (pick == target):
                    idx = comb[0].index(pick)
                    CMs[comb[1]][(idx, idx)] += 1
                elif (pick != target):
                    CMs[comb[1]][(comb[0].index(pick), comb[0].index(target))] += 1
                else:
                    print('Matrix Error')
    return (CMs, combs)