def make_ephysCW_pc(): """make_ephysCW_pc Makes positions, contrasts and block lengths for ephysCW Generates ~2000 trias :return: pc :rtype: [type] """ contrasts = [1.0, 0.25, 0.125, 0.0625, 0.0] len_block = [90] pos = [-35] * int(len_block[0] / 2) + [35] * int(len_block[0] / 2) cont = np.sort(contrasts * 10)[::-1][:-5].tolist() prob = [0.5] * len_block[0] pc = np.array([pos, cont + cont, prob]).T np.random.shuffle(pc) # only shuffles on the first dimension prob_left = 0.8 if blocks.draw_position([-35, 35], 0.5) < 0 else 0.2 while len(pc) < 2001: len_block.append(blocks.get_block_len(60, min_=20, max_=100)) for x in range(len_block[-1]): p = blocks.draw_position([-35, 35], prob_left) c = misc.draw_contrast(contrasts, prob_type='uniform') pc = np.append(pc, np.array([[p, c, prob_left]]), axis=0) # do this in PC space prob_left = np.round(np.abs(1 - prob_left), 1) return pc, len_block
def make_pc(): contrasts = [1., 0.25, 0.125, 0.0625, 0.0] len_block = [90] pos = [-35] * int(len_block[0] / 2) + [35] * int(len_block[0] / 2) cont = np.sort(contrasts * 10)[::-1][:-5].tolist() pc = np.array([pos, cont + cont]).T np.random.shuffle(pc) # only shuffles on the first dimension prob_left = 0.8 if blocks.draw_position([-35, 35], 0.5) < 0 else 0.2 while len(pc) < 2001: len_block.append(blocks.get_block_len(60, min_=20, max_=100)) for x in range(len_block[-1]): p = blocks.draw_position([-35, 35], prob_left) c = misc.draw_contrast(contrasts, prob_type='uniform') pc = np.append(pc, np.array([[p, c]]), axis=0) # do this in PC space prob_left = np.round(np.abs(1 - prob_left), 1) return pc, len_block