def getexposureCM(self, trial_data, trialNum, expoNum):
    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])
    condi = self.subj_data[0]['Combinations']
    newcondi = []
    s1 = set(['NONSWAP', 'SWAP'])
    for subj in self.subj_data:
        s2 = set(subj.keys())
        for s in subj[list(s1.intersection(s2))[0]]:
            newcondi.append([x for (idx, x) in enumerate(condi[int(s)]) if ((idx >= expoNum[0]) and (idx < expoNum[1]))])
    if (len(newcondi) != len(trial_data)):
        print('trial number inconsistent')
    else:
        print(str(len(trial_data)))
    RV = []
    DV = []
    for subj in self.subj_data:
        models = np.unique(subj['Response'])
        self.models = []
        for idx in models:
            self.models.append(idx)
        models_idxs = {}
        for (idx, model) in enumerate(self.models):
            models_idxs[tuple(model)] = idx
        self.models_idxs = models_idxs
        for (r_idx, r) in enumerate(subj['Response']):
            if ((r_idx >= trialNum[0]) and (r_idx < trialNum[1])):
                RV.append(r)
        for (s_idx, s) in enumerate(subj['StimShown']):
            if ((s_idx >= trialNum[0]) and (s_idx < trialNum[1])):
                DV.append(s)
    new_data = []
    for (idx, shown) in enumerate(DV):
        model = shown
        CF_col_idx = self.models_idxs[tuple(model)]
        CF_row_idx = self.models_idxs[tuple(RV[idx])]
        new_data.append([CF_col_idx, CF_row_idx, [self.models_idxs[tuple(m)] for m in self.models]])
    return (newcondi, new_data)
def getexposureCM(self, trial_data, trialNum, expoNum):
    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])
    condi = self.subj_data[0]['Combinations']
    newcondi = []
    s1 = set(['NONSWAP', 'SWAP'])
    for subj in self.subj_data:
        s2 = set(subj.keys())
        for s in subj[list(s1.intersection(s2))[0]]:
            newcondi.append([x for (idx, x) in enumerate(condi[int(s)]) if ((idx >= expoNum[0]) and (idx < expoNum[1]))])
    if (len(newcondi) != len(trial_data)):
        print('trial number inconsistent')
    else:
        print(str(len(trial_data)))
    RV = []
    DV = []
    for subj in self.subj_data:
        models = np.unique(subj['Response'])
        self.models = []
        for idx in models:
            self.models.append(idx)
        models_idxs = {}
        for (idx, model) in enumerate(self.models):
            models_idxs[tuple(model)] = idx
        self.models_idxs = models_idxs
        for (r_idx, r) in enumerate(subj['Response']):
            if ((r_idx >= trialNum[0]) and (r_idx < trialNum[1])):
                RV.append(r)
        for (s_idx, s) in enumerate(subj['StimShown']):
            if ((s_idx >= trialNum[0]) and (s_idx < trialNum[1])):
                DV.append(s)
    new_data = []
    for (idx, shown) in enumerate(DV):
        model = shown
        CF_col_idx = self.models_idxs[tuple(model)]
        CF_row_idx = self.models_idxs[tuple(RV[idx])]
        new_data.append([CF_col_idx, CF_row_idx, [self.models_idxs[tuple(m)] for m in self.models]])
    return (newcondi, new_data)