Пример #1
0
def plot_pcqs(session_num, folder='./_iblrig_tasks_ephysChoiceWorld/sessions'):
    num = session_num
    pcqs = np.load(folder + f'/pcqs_session_{num}.npy')
    len_block = np.load(folder + f'/pcqs_session_{num}_len_blocks.npy')

    with plt.xkcd(scale=1, length=100, randomness=2):
        f = plt.figure(figsize=(16, 12), dpi=80)
        f.suptitle(f'Session number: {num}')
        ax_position = plt.subplot2grid(
            [2, 2], [0, 0], rowspan=1, colspan=1, fig=f)
        ax_contrast = plt.subplot2grid(
            [2, 2], [0, 1], rowspan=1, colspan=1, fig=f, sharex=ax_position)
        ax_qperiod = plt.subplot2grid(
            [2, 2], [1, 0], rowspan=1, colspan=1, fig=f, sharex=ax_position)
        ax_sphase = plt.subplot2grid(
            [2, 2], [1, 1], rowspan=1, colspan=1, fig=f, sharex=ax_position)

    ax_position.plot(pcqs[:, 0], '.', label='Position', color='b')
    ax_position.plot(
        smooth(pcqs[:, 0], window_len=20, window='blackman'),
        alpha=0.5, color='k')

    ax_contrast.plot(pcqs[:, 1] * 100, '.', label='Contrasts')

    ax_qperiod.plot(pcqs[:, 2], '.', label='Quiescent period')

    ax_sphase.plot(pcqs[:, 3], '.', label='Stimulus phase')

    [ax.set_ylabel(l) for ax, l in zip(f.axes, ['Position (º)',
                                                'Contrasts (%)',
                                                'Quiescent period (s)',
                                                'Stimulus phase (rad)'])]
    [ax.axvline(x, alpha=0.5) for x in np.cumsum(len_block) for ax in f.axes]
    f.show()
    return pcqs, len_block
Пример #2
0
def plot_pcqs(session_num,
              folder="./tasks/_iblrig_tasks_ephysChoiceWorld/sessions"):
    iblrig_path = Path(ph.get_iblrig_folder())
    folder_path = Path(folder)
    folder = str(iblrig_path / folder_path)
    num = session_num
    pcqs = np.load(folder + f"/pcqs_session_{num}.npy")
    len_block = np.load(folder + f"/pcqs_session_{num}_len_blocks.npy")

    with plt.xkcd(scale=1, length=100, randomness=2):
        f = plt.figure(figsize=(16, 12), dpi=80)
        f.suptitle(f"Session number: {num}")
        ax_position = plt.subplot2grid([2, 2], [0, 0],
                                       rowspan=1,
                                       colspan=1,
                                       fig=f)
        ax_contrast = plt.subplot2grid([2, 2], [0, 1],
                                       rowspan=1,
                                       colspan=1,
                                       fig=f,
                                       sharex=ax_position)
        ax_qperiod = plt.subplot2grid([2, 2], [1, 0],
                                      rowspan=1,
                                      colspan=1,
                                      fig=f,
                                      sharex=ax_position)
        ax_sphase = plt.subplot2grid([2, 2], [1, 1],
                                     rowspan=1,
                                     colspan=1,
                                     fig=f,
                                     sharex=ax_position)

    ax_position.plot(pcqs[:, 0], ".", label="Position", color="b")
    ax_position.plot(smooth(pcqs[:, 0], window_len=20, window="blackman"),
                     alpha=0.5,
                     color="k")

    ax_contrast.plot(pcqs[:, 1] * 100, ".", label="Contrasts")

    ax_qperiod.plot(pcqs[:, 2], ".", label="Quiescent period")

    ax_sphase.plot(pcqs[:, 3], ".", label="Stimulus phase")

    [
        ax.set_ylabel(l) for ax, l in zip(
            f.axes,
            [
                "Position (º)",
                "Contrasts (%)",
                "Quiescent period (s)",
                "Stimulus phase (rad)",
            ],
        )
    ]
    [ax.axvline(x, alpha=0.5) for x in np.cumsum(len_block) for ax in f.axes]
    f.show()
    return pcqs, len_block