Esempio n. 1
0
    def run(self):
        self.create_dir_in_workspace('reports')

        frequency_plot_data = self.get_passed_object('frequency_plot')
        centralized_frequency_plot_data = self.get_passed_object('centralized_frequency_plot')
        frequency_region_plot_data = self.get_passed_object('frequency_region_plot')
        frequency_frequency_plot_data = self.get_passed_object('frequency_frequency_plot')

        panel_plot = PanelPlot(xfigsize=11, yfigsize=11, i_max=1, j_max=1, title='', ytitle=self.params.output_title, ytitle_fontsize=16, wspace=0.3, hspace=0.3)

        pdc = PlotDataCollection(legend_on=True)
        pdc.xlabel = 'Burst Frequency (Hz)'
        pdc.xlabel_fontsize = 16
        for v,p in frequency_plot_data.iteritems():
            p.xhline_pos=0.0
            pdc.add_plot_data(p)
        panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace('reports/ps3_frequency_aggregate_plots.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        panel_plot = PanelPlot(xfigsize=15, yfigsize=7.5, i_max=1, j_max=2, title='', ytitle=self.params.output_title, wspace=0.3, hspace=0.3)
        panel_plot.add_plot_data(0, 0, plot_data=frequency_region_plot_data)
        panel_plot.add_plot_data(0, 1, plot_data=frequency_frequency_plot_data)
        plot = panel_plot.generate_plot()
        plot_out_fname = self.get_path_to_resource_in_workspace('reports/ps3_frequency_projection_plots.pdf')
        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')
Esempio n. 2
0
    def run(self):
        subject = self.pipeline.subject
        task = self.pipeline.task

        self.create_dir_in_workspace('reports')

        session_summary_array = self.get_passed_object('session_summary_array')

        serial_positions = np.arange(1,13)

        for session_summary in session_summary_array:
            panel_plot = PanelPlot(xfigsize=15, yfigsize=7.5, i_max=1, j_max=2, title='', wspace=0.3, hspace=0.3)

            pd1 = PlotData(x=serial_positions, y=session_summary.prob_recall, xlim=(0,12), ylim=(0.0, 1.0), xlabel='Serial position\n(a)', ylabel='Probability of recall')
            pd2 = PlotData(x=serial_positions, y=session_summary.prob_first_recall, xlim=(0,12), ylim=(0.0, 1.0), xlabel='Serial position\n(b)', ylabel='Probability of first recall')

            panel_plot.add_plot_data(0, 0, plot_data=pd1)
            panel_plot.add_plot_data(0, 1, plot_data=pd2)

            plot = panel_plot.generate_plot()

            plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + task + '-' + subject + '-prob_recall_plot_' + session_summary.name + '.pdf')

            plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

            if task == 'RAM_CatFR1':
                panel_plot = PanelPlot(xfigsize=6.0, yfigsize=6.0, i_max=1, j_max=1, title='', wspace=0.3, hspace=0.3)
                pd = BarPlotData(x=[0,1], y=[session_summary.irt_within_cat,  session_summary.irt_between_cat], ylabel='IRT (msec)', x_tick_labels=['Within Cat', 'Between Cat'], barcolors=['grey','grey'], barwidth=0.5)
                panel_plot.add_plot_data(0, 0, plot_data=pd)
                plot = panel_plot.generate_plot()
                plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + task + '-' + subject + '-irt_plot_' + session_summary.name + '.pdf')
                plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

            panel_plot = PanelPlot(xfigsize=10.0, yfigsize=10.0, i_max=1, j_max=1, title='', xlabel='List', ylabel='# of items')

            pdc = PlotDataCollection()

            n_lists = len(session_summary.n_stims_per_list)

            print 'Number of lists', n_lists

            bpd_1 = BarPlotData(x=np.arange(n_lists), y=session_summary.n_stims_per_list, title='', alpha=0.1)
            pd_1 = PlotData(x=np.where(session_summary.is_stim_list)[0], y=session_summary.n_recalls_per_list[session_summary.is_stim_list],
                    title='', linestyle='', color='red', marker='o')
            pd_2 = PlotData(x=np.where(~session_summary.is_stim_list)[0], y=session_summary.n_recalls_per_list[~session_summary.is_stim_list],
                    title='', linestyle='', color='blue', marker='o')

            pdc.add_plot_data(pd_1)
            pdc.add_plot_data(pd_2)
            pdc.add_plot_data(bpd_1)

            panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

            plot = panel_plot.generate_plot()

            plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + task + '-' + subject + '-stim_and_recall_plot_' + session_summary.name + '.pdf')

            plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        cumulative_summary = self.get_passed_object('cumulative_summary')

        panel_plot = PanelPlot(xfigsize=15, yfigsize=7.5, i_max=1, j_max=2, title='', wspace=0.3, hspace=0.3)

        pd1 = PlotData(x=serial_positions, y=cumulative_summary.prob_recall, xlim=(0, 12), ylim=(0.0, 1.0), xlabel='Serial position\n(a)', ylabel='Probability of recall')
        pd2 = PlotData(x=serial_positions, y=cumulative_summary.prob_first_recall, xlim=(0, 12), ylim=(0.0, 1.0), xlabel='Serial position\n(b)', ylabel='Probability of first recall')

        panel_plot.add_plot_data(0, 0, plot_data=pd1)
        panel_plot.add_plot_data(0, 1, plot_data=pd2)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + task + '-' + subject + '-prob_recall_plot_combined.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        if task == 'RAM_CatFR1':
            panel_plot = PanelPlot(xfigsize=6.0, yfigsize=6.0, i_max=1, j_max=1, title='', wspace=0.3, hspace=0.3)
            pd = BarPlotData(x=[0,1], y=[cumulative_summary.irt_within_cat, cumulative_summary.irt_between_cat], ylabel='IRT (msec)', x_tick_labels=['Within Cat', 'Between Cat'], barcolors=['grey','grey'], barwidth=0.5)
            panel_plot.add_plot_data(0, 0, plot_data=pd)
            plot = panel_plot.generate_plot()
            plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + task + '-' + subject + '-irt_plot_combined.pdf')
            plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')
    def run(self):
        #experiment = self.pipeline.experiment

        self.create_dir_in_workspace('reports')

        xval_output = self.get_passed_object('xval_output')
        fr1_summary = xval_output[-1]

        panel_plot = PanelPlot(xfigsize=15, yfigsize=7.5, i_max=1, j_max=2, title='', wspace=0.3, hspace=0.3)

        pd1 = PlotData(x=fr1_summary.fpr, y=fr1_summary.tpr, xlim=[0.0,1.0], ylim=[0.0,1.0], xlabel='False Alarm Rate\n(a)', ylabel='Hit Rate', levelline=((0.0,1.0),(0.0,1.0)))

        pc_diff_from_mean = (fr1_summary.low_pc_diff_from_mean, fr1_summary.mid_pc_diff_from_mean, fr1_summary.high_pc_diff_from_mean)

        ylim = np.max(np.abs(pc_diff_from_mean)) + 5.0
        if ylim > 100.0:
            ylim = 100.0
        # pd2 = BarPlotData(x=(0,1,2), y=pc_diff_from_mean, ylim=[-ylim,ylim], xlabel='Tercile of Classifier Estimate\n(b)', ylabel='Recall Change From Mean (%)', x_tick_labels=['Low', 'Middle', 'High'], xhline_pos=0.0, barcolors=['grey','grey', 'grey'], barwidth=0.5)
        pd2 = BarPlotData(x=(0,1,2), y=pc_diff_from_mean, ylim=[-ylim,ylim], xlabel='Tercile of Classifier Estimate\n(b)', ylabel='Recall Change From Mean (%)', x_tick_labels=['Low', 'Middle', 'High'], xhline_pos=0.0, barcolors=['grey','grey', 'grey'], barwidth=0.5)

        panel_plot.add_plot_data(0, 0, plot_data=pd1)
        panel_plot.add_plot_data(0, 1, plot_data=pd2)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + self.pipeline.subject + '-roc_and_terc_plot_combined.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        session_summary_array = self.get_passed_object('session_summary_array')
        param1_name = self.get_passed_object('param1_name')
        param1_unit = self.get_passed_object('param1_unit')
        param1_title = '%s (%s)' % (param1_name,param1_unit)


        for session_summary in session_summary_array:
            # panel_plot = PanelPlot(i_max=1, j_max=1, title='', xtitle=param1_title, xtitle_fontsize=24, ytitle='$\Delta$ Post-Pre Classifier Output',ytitle_fontsize=24, wspace=0.3, hspace=0.3)

            panel_plot = PanelPlot(i_max=1, j_max=1, title='', ytitle='$\Delta$ Post-Pre Classifier Output',ytitle_fontsize=24, wspace=0.3, hspace=0.3)

            pdc = PlotDataCollection(legend_on=True)
            pdc.xlabel = param1_title
            pdc.xlabel_fontsize = 24

            for v,p in session_summary.plots.iteritems():
                p.xhline_pos=0.0
                pdc.add_plot_data(p)


            panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

            plot = panel_plot.generate_plot()

            plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + self.pipeline.experiment + '-' + self.pipeline.subject + '-report_plot_' + session_summary.name + '.pdf')

            plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        cumulative_plots = self.get_passed_object('cumulative_plots')



        # panel_plot = PanelPlot(i_max=1, j_max=1, title='', xtitle=param1_title, y_axis_title='$\Delta$ Post-Pre Classifier Output')
        panel_plot = PanelPlot(i_max=1, j_max=1, title='',ytitle='$\Delta$ Post-Pre Classifier Output', ytitle_fontsize=24)

        pdc = PlotDataCollection(legend_on=True)
        pdc.xlabel = param1_title
        pdc.xlabel_fontsize = 24

        for v,p in cumulative_plots.iteritems():
            p.xhline_pos=0.0
            pdc.add_plot_data(p)

        panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + self.pipeline.experiment + '-' + self.pipeline.subject + '-report_plot_Cumulative.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')
    def run(self):
        subject = self.pipeline.subject
        task = self.pipeline.task

        self.create_dir_in_workspace("reports")

        session_summary_array = self.get_passed_object("session_summary_array")

        serial_positions = np.arange(1, 13)

        for session_summary in session_summary_array:
            panel_plot = PanelPlot(
                xfigsize=15, yfigsize=7.5, i_max=1, j_max=2, title="", wspace=0.3, hspace=0.3, labelsize=20
            )

            pd1 = PlotData(
                x=serial_positions,
                y=session_summary.prob_recall,
                xlim=(0, 12),
                ylim=(0.0, 1.0),
                xlabel="Serial position\n(a)",
                ylabel="Probability of recall",
            )
            pd1.xlabel_fontsize = 20
            pd1.ylabel_fontsize = 20
            pd2 = PlotData(
                x=serial_positions,
                y=session_summary.prob_first_recall,
                xlim=(0, 12),
                ylim=(0.0, 1.0),
                xlabel="Serial position\n(b)",
                ylabel="Probability of first recall",
            )
            pd2.xlabel_fontsize = 20
            pd2.ylabel_fontsize = 20

            # panel_plot.add_plot_data(0, 0, plot_data=pd1)
            # panel_plot.add_plot_data(0, 1, plot_data=pd2)
            #
            # plot = panel_plot.generate_plot()

            panel_plot.add_plot_data(0, 0, plot_data=pd1)

            panel_plot.add_plot_data(0, 1, plot_data=pd2)

            plot = panel_plot.generate_plot()

            plot_out_fname = self.get_path_to_resource_in_workspace(
                "reports/" + task + "-" + subject + "-prob_recall_plot_" + session_summary.name + ".pdf"
            )

            plot.savefig(plot_out_fname, dpi=300, bboxinches="tight")

            if task == "RAM_CatFR1":
                panel_plot = PanelPlot(xfigsize=6.0, yfigsize=6.0, i_max=1, j_max=1, title="", wspace=0.3, hspace=0.3)
                pd = BarPlotData(
                    x=[0, 1],
                    y=[session_summary.irt_within_cat, session_summary.irt_between_cat],
                    ylabel="IRT (msec)",
                    x_tick_labels=["Within Cat", "Between Cat"],
                    barcolors=["grey", "grey"],
                    barwidth=0.5,
                )
                panel_plot.add_plot_data(0, 0, plot_data=pd)
                plot = panel_plot.generate_plot()
                plot_out_fname = self.get_path_to_resource_in_workspace(
                    "reports/" + task + "-" + subject + "-irt_plot_" + session_summary.name + ".pdf"
                )
                plot.savefig(plot_out_fname, dpi=300, bboxinches="tight")

            panel_plot = PanelPlot(
                xfigsize=10.0,
                yfigsize=10.0,
                i_max=1,
                j_max=1,
                title="",
                xlabel="List",
                ylabel="# of items",
                labelsize=20,
            )

            pdc = PlotDataCollection()
            # ----------------- FORMATTING
            pdc.xlabel = "List number"
            pdc.xlabel_fontsize = 20
            pdc.ylabel = "# recalled words"
            pdc.ylabel_fontsize = 20

            n_lists = len(session_summary.n_stims_per_list)

            print "Number of lists", n_lists

            bpd_1 = BarPlotData(x=np.arange(n_lists), y=session_summary.n_stims_per_list, title="", alpha=0.1)
            pd_1 = PlotData(
                x=np.where(session_summary.is_stim_list)[0],
                y=session_summary.n_recalls_per_list[session_summary.is_stim_list],
                title="",
                linestyle="",
                color="red",
                marker="o",
                markersize=20,
            )
            pd_2 = PlotData(
                x=np.where(~session_summary.is_stim_list)[0],
                y=session_summary.n_recalls_per_list[~session_summary.is_stim_list],
                title="",
                linestyle="",
                color="blue",
                marker="o",
                markersize=20,
            )
            print "np.where(session_summary.is_stim_list)[0]=", np.where(session_summary.is_stim_list)[0]
            print "np.where(~session_summary.is_stim_list)[0]=", np.where(~session_summary.is_stim_list)[0]
            pdc.add_plot_data(pd_1)
            pdc.add_plot_data(pd_2)
            pdc.add_plot_data(bpd_1)

            panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

            plot = panel_plot.generate_plot()

            plot_out_fname = self.get_path_to_resource_in_workspace(
                "reports/" + task + "-" + subject + "-stim_and_recall_plot_" + session_summary.name + ".pdf"
            )

            plot.savefig(plot_out_fname, dpi=300, bboxinches="tight")

        cumulative_summary = self.get_passed_object("cumulative_summary")

        panel_plot = PanelPlot(xfigsize=15, yfigsize=7.5, i_max=1, j_max=2, title="", wspace=0.3, hspace=0.3)

        pd1 = PlotData(
            x=serial_positions,
            y=cumulative_summary.prob_recall,
            xlim=(0, 12),
            ylim=(0.0, 1.0),
            xlabel="Serial position\n(a)",
            ylabel="Probability of recall",
        )
        pd2 = PlotData(
            x=serial_positions,
            y=cumulative_summary.prob_first_recall,
            xlim=(0, 12),
            ylim=(0.0, 1.0),
            xlabel="Serial position\n(b)",
            ylabel="Probability of first recall",
        )

        panel_plot.add_plot_data(0, 0, plot_data=pd1)
        panel_plot.add_plot_data(0, 1, plot_data=pd2)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace(
            "reports/" + task + "-" + subject + "-prob_recall_plot_combined.pdf"
        )

        plot.savefig(plot_out_fname, dpi=300, bboxinches="tight")

        if task == "RAM_CatFR1":
            panel_plot = PanelPlot(xfigsize=6.0, yfigsize=6.0, i_max=1, j_max=1, title="", wspace=0.3, hspace=0.3)
            pd = BarPlotData(
                x=[0, 1],
                y=[cumulative_summary.irt_within_cat, cumulative_summary.irt_between_cat],
                ylabel="IRT (msec)",
                x_tick_labels=["Within Cat", "Between Cat"],
                barcolors=["grey", "grey"],
                barwidth=0.5,
            )
            panel_plot.add_plot_data(0, 0, plot_data=pd)
            plot = panel_plot.generate_plot()
            plot_out_fname = self.get_path_to_resource_in_workspace(
                "reports/" + task + "-" + subject + "-irt_plot_combined.pdf"
            )
            plot.savefig(plot_out_fname, dpi=300, bboxinches="tight")
Esempio n. 5
0
    def run(self):
        #experiment = self.pipeline.experiment

        self.create_dir_in_workspace('reports')

        xval_output = self.get_passed_object('xval_output')
        fr1_summary = xval_output[-1]

        panel_plot = PanelPlot(xfigsize=15,
                               yfigsize=7.5,
                               i_max=1,
                               j_max=2,
                               title='',
                               wspace=0.3,
                               hspace=0.3)

        pd1 = PlotData(x=fr1_summary.fpr,
                       y=fr1_summary.tpr,
                       xlim=[0.0, 1.0],
                       ylim=[0.0, 1.0],
                       xlabel='False Alarm Rate\n(a)',
                       ylabel='Hit Rate',
                       levelline=((0.0, 1.0), (0.0, 1.0)))

        pc_diff_from_mean = (fr1_summary.low_pc_diff_from_mean,
                             fr1_summary.mid_pc_diff_from_mean,
                             fr1_summary.high_pc_diff_from_mean)

        ylim = np.max(np.abs(pc_diff_from_mean)) + 5.0
        if ylim > 100.0:
            ylim = 100.0
        # pd2 = BarPlotData(x=(0,1,2), y=pc_diff_from_mean, ylim=[-ylim,ylim], xlabel='Tercile of Classifier Estimate\n(b)', ylabel='Recall Change From Mean (%)', x_tick_labels=['Low', 'Middle', 'High'], xhline_pos=0.0, barcolors=['grey','grey', 'grey'], barwidth=0.5)
        pd2 = BarPlotData(x=(0, 1, 2),
                          y=pc_diff_from_mean,
                          ylim=[-ylim, ylim],
                          xlabel='Tercile of Classifier Estimate\n(b)',
                          ylabel='Recall Change From Mean (%)',
                          x_tick_labels=['Low', 'Middle', 'High'],
                          xhline_pos=0.0,
                          barcolors=['grey', 'grey', 'grey'],
                          barwidth=0.5)

        panel_plot.add_plot_data(0, 0, plot_data=pd1)
        panel_plot.add_plot_data(0, 1, plot_data=pd2)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace(
            'reports/' + self.pipeline.subject +
            '-roc_and_terc_plot_combined.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        session_summary_array = self.get_passed_object('session_summary_array')
        param1_name = self.get_passed_object('param1_name')
        param1_unit = self.get_passed_object('param1_unit')
        param1_title = '%s (%s)' % (param1_name, param1_unit)

        for session_summary in session_summary_array:
            # panel_plot = PanelPlot(i_max=1, j_max=1, title='', xtitle=param1_title, xtitle_fontsize=24, ytitle='$\Delta$ Post-Pre Classifier Output',ytitle_fontsize=24, wspace=0.3, hspace=0.3)

            panel_plot = PanelPlot(
                i_max=1,
                j_max=1,
                title='',
                ytitle='$\Delta$ Post-Pre Classifier Output',
                ytitle_fontsize=24,
                wspace=0.3,
                hspace=0.3)

            pdc = PlotDataCollection(legend_on=True)
            pdc.xlabel = param1_title
            pdc.xlabel_fontsize = 24

            for v, p in session_summary.plots.iteritems():
                p.xhline_pos = 0.0
                pdc.add_plot_data(p)

            panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

            plot = panel_plot.generate_plot()

            plot_out_fname = self.get_path_to_resource_in_workspace(
                'reports/' + self.pipeline.experiment + '-' +
                self.pipeline.subject + '-report_plot_' +
                session_summary.name + '.pdf')

            plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        cumulative_plots = self.get_passed_object('cumulative_plots')

        # panel_plot = PanelPlot(i_max=1, j_max=1, title='', xtitle=param1_title, y_axis_title='$\Delta$ Post-Pre Classifier Output')
        panel_plot = PanelPlot(i_max=1,
                               j_max=1,
                               title='',
                               ytitle='$\Delta$ Post-Pre Classifier Output',
                               ytitle_fontsize=24)

        pdc = PlotDataCollection(legend_on=True)
        pdc.xlabel = param1_title
        pdc.xlabel_fontsize = 24

        for v, p in cumulative_plots.iteritems():
            p.xhline_pos = 0.0
            pdc.add_plot_data(p)

        panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace(
            'reports/' + self.pipeline.experiment + '-' +
            self.pipeline.subject + '-report_plot_Cumulative.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')
Esempio n. 6
0
    def run(self):
        self.create_dir_in_workspace('reports')

        frequency_plot_data = self.get_passed_object('frequency_plot')
        centralized_frequency_plot_data = self.get_passed_object('centralized_frequency_plot')
        frequency_region_plot_data = self.get_passed_object('frequency_region_plot')
        frequency_frequency_plot_data = self.get_passed_object('frequency_frequency_plot')

        low_freq_duration_plot_data = self.get_passed_object('low_freq_duration_plot')
        high_freq_duration_plot_data = self.get_passed_object('high_freq_duration_plot')
        low_freq_amplitude_plot_data = self.get_passed_object('low_freq_amplitude_plot')
        high_freq_amplitude_plot_data = self.get_passed_object('high_freq_amplitude_plot')


        # panel_plot = PanelPlot(xfigsize=11, yfigsize=11, i_max=1, j_max=1, title='', ytitle=self.params.output_title, ytitle_fontsize=16, wspace=0.3, hspace=0.3)
        #
        # panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)
        #
        # plot = panel_plot.generate_plot()
        #
        # plot_out_fname = self.get_path_to_resource_in_workspace('reports/ps_frequency_aggregate_plots.pdf')
        #
        # plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        pdc = PlotDataCollection(legend_on=True)
        pdc.xlabel = 'Pulse Frequency (Hz)'
        pdc.xlabel_fontsize = 16
        for v,p in frequency_plot_data.iteritems():
            p.xhline_pos=0.0
            pdc.add_plot_data(p)


        # panel_plot = PanelPlot(xfigsize=15, yfigsize=7.5, i_max=1, j_max=3, title='', ytitle=self.params.output_title, wspace=0.3, hspace=0.3)
        panel_plot = PanelPlot(xfigsize=18.5, yfigsize=7.5, i_max=1, j_max=3, title='', ytitle=self.params.output_title, labelsize=20, ytitle_fontsize = 20)
        min_y_list =[]
        max_y_list =[]

        r =pdc.get_yrange()
        min_y_list.append(r[0])
        max_y_list.append(r[1])

        r =frequency_region_plot_data.get_yrange()
        min_y_list.append(r[0])
        max_y_list.append(r[1])

        r =frequency_frequency_plot_data.get_yrange()
        min_y_list.append(r[0])
        max_y_list.append(r[1])

        y_min = np.min(min_y_list)
        y_max = np.max(max_y_list)
        r = y_max - y_min
        y_min -= 0.05*r
        y_max += 0.15*r

        pdc.ylim=[y_min,y_max]
        frequency_region_plot_data.ylim=[y_min,y_max]
        frequency_frequency_plot_data.ylim=[y_min,y_max]

        pdc.xhline_pos = 0.0
        frequency_region_plot_data.xhline_pos = 0.0
        frequency_frequency_plot_data.xhline_pos = 0.0

        # label fontsize
        pdc.xlabel_fontsize = 20
        pdc.ylabel_fontsize = 20
        frequency_region_plot_data.xlabel_fontsize = 20
        frequency_region_plot_data.ylabel_fontsize = 20
        frequency_frequency_plot_data.xlabel_fontsize = 20
        frequency_frequency_plot_data.ylabel_fontsize = 20


        print '[y_min,y_max]=',[y_min,y_max]



        panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)
        panel_plot.add_plot_data(0, 1, plot_data=frequency_region_plot_data)
        panel_plot.add_plot_data(0, 2, plot_data=frequency_frequency_plot_data)


        plot = panel_plot.generate_plot()
        plot_out_fname = self.get_path_to_resource_in_workspace('reports/ps_frequency_projection_plots.pdf')
        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        panel_plot = PanelPlot(i_max=1, j_max=1, title='', ytitle=self.params.output_title, ytitle_fontsize=24, wspace=0.3, hspace=0.3)

        pdc = PlotDataCollection(legend_on=True)
        pdc.xlabel = 'Duration (ms)'
        pdc.xlabel_fontsize = 24
        for v,p in low_freq_duration_plot_data.iteritems():
            p.xhline_pos=0.0
            pdc.add_plot_data(p)
        panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace('reports/ps_duration_low_aggregate_plots.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')


        panel_plot = PanelPlot(i_max=1, j_max=1, title='', ytitle=self.params.output_title, ytitle_fontsize=24, wspace=0.3, hspace=0.3)

        pdc = PlotDataCollection(legend_on=True)
        pdc.xlabel = 'Duration (ms)'
        pdc.xlabel_fontsize = 24
        for v,p in high_freq_duration_plot_data.iteritems():
            p.xhline_pos=0.0
            pdc.add_plot_data(p)
        panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace('reports/ps_duration_high_aggregate_plots.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')


        panel_plot = PanelPlot(i_max=1, j_max=1, title='', ytitle=self.params.output_title, ytitle_fontsize=24, wspace=0.3, hspace=0.3)

        pdc = PlotDataCollection(legend_on=True)
        pdc.xlabel = 'Amplitude (mA)'
        pdc.xlabel_fontsize = 24
        for v,p in low_freq_amplitude_plot_data.iteritems():
            p.xhline_pos=0.0
            pdc.add_plot_data(p)
        panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace('reports/ps_amplitude_low_aggregate_plots.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')


        panel_plot = PanelPlot(i_max=1, j_max=1, title='', ytitle=self.params.output_title, ytitle_fontsize=24, wspace=0.3, hspace=0.3)

        pdc = PlotDataCollection(legend_on=True)
        pdc.xlabel = 'Amplitude (mA)'
        pdc.xlabel_fontsize = 24
        for v,p in high_freq_amplitude_plot_data.iteritems():
            p.xhline_pos=0.0
            pdc.add_plot_data(p)
        panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace('reports/ps_amplitude_high_aggregate_plots.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')
Esempio n. 7
0
    def run(self):
        subject = self.pipeline.subject
        task = self.pipeline.task

        self.create_dir_in_workspace('reports')

        session_summary_array = self.get_passed_object('session_summary_array')

        serial_positions = np.arange(1,13)

        for session_summary in session_summary_array:
            panel_plot = PanelPlot(xfigsize=15, yfigsize=7.5, i_max=1, j_max=2, title='', wspace=0.3, hspace=0.3, labelsize=20)

            pd1 = PlotData(x=serial_positions, y=session_summary.prob_recall, xlim=(0,12), ylim=(0.0, 1.0), xlabel='Serial position\n(a)', ylabel='Probability of recall')
            pd1.xlabel_fontsize = 20
            pd1.ylabel_fontsize = 20
            pd2 = PlotData(x=serial_positions, y=session_summary.prob_first_recall, xlim=(0,12), ylim=(0.0, 1.0), xlabel='Serial position\n(b)', ylabel='Probability of first recall')
            pd2.xlabel_fontsize = 20
            pd2.ylabel_fontsize = 20

            # panel_plot.add_plot_data(0, 0, plot_data=pd1)
            # panel_plot.add_plot_data(0, 1, plot_data=pd2)
            #
            # plot = panel_plot.generate_plot()

            panel_plot.add_plot_data(0, 0, plot_data=pd1)

            panel_plot.add_plot_data(0, 1, plot_data=pd2)

            plot = panel_plot.generate_plot()




            plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + task + '-' + subject + '-prob_recall_plot_' + session_summary.name + '.pdf')

            plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

            if task == 'RAM_CatFR1':
                panel_plot = PanelPlot(xfigsize=6.0, yfigsize=6.0, i_max=1, j_max=1, title='', wspace=0.3, hspace=0.3)
                pd = BarPlotData(x=[0,1], y=[session_summary.irt_within_cat,  session_summary.irt_between_cat], ylabel='IRT (msec)', x_tick_labels=['Within Cat', 'Between Cat'], barcolors=['grey','grey'], barwidth=0.5)
                panel_plot.add_plot_data(0, 0, plot_data=pd)
                plot = panel_plot.generate_plot()
                plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + task + '-' + subject + '-irt_plot_' + session_summary.name + '.pdf')
                plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

            panel_plot = PanelPlot(xfigsize=10.0, yfigsize=10.0, i_max=1, j_max=1, title='', xlabel='List', ylabel='# of items', labelsize=20)

            pdc = PlotDataCollection()
            #----------------- FORMATTING
            pdc.xlabel = 'List number'
            pdc.xlabel_fontsize = 20
            pdc.ylabel ='# recalled words'
            pdc.ylabel_fontsize = 20

            n_lists = len(session_summary.n_stims_per_list)

            print 'Number of lists', n_lists

            bpd_1 = BarPlotData(x=np.arange(n_lists), y=session_summary.n_stims_per_list, title='', alpha=0.1)
            pd_1 = PlotData(x=np.where(session_summary.is_stim_list)[0], y=session_summary.n_recalls_per_list[session_summary.is_stim_list],
                    title='', linestyle='', color='red', marker='o',markersize=20)
            pd_2 = PlotData(x=np.where(~session_summary.is_stim_list)[0], y=session_summary.n_recalls_per_list[~session_summary.is_stim_list],
                    title='', linestyle='', color='blue', marker='o',markersize=20)
            print 'np.where(session_summary.is_stim_list)[0]=',np.where(session_summary.is_stim_list)[0]
            print 'np.where(~session_summary.is_stim_list)[0]=',np.where(~session_summary.is_stim_list)[0]
            pdc.add_plot_data(pd_1)
            pdc.add_plot_data(pd_2)
            pdc.add_plot_data(bpd_1)

            panel_plot.add_plot_data_collection(0, 0, plot_data_collection=pdc)

            plot = panel_plot.generate_plot()



            plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + task + '-' + subject + '-stim_and_recall_plot_' + session_summary.name + '.pdf')

            plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        cumulative_summary = self.get_passed_object('cumulative_summary')

        panel_plot = PanelPlot(xfigsize=15, yfigsize=7.5, i_max=1, j_max=2, title='', wspace=0.3, hspace=0.3)

        pd1 = PlotData(x=serial_positions, y=cumulative_summary.prob_recall, xlim=(0, 12), ylim=(0.0, 1.0), xlabel='Serial position\n(a)', ylabel='Probability of recall')
        pd2 = PlotData(x=serial_positions, y=cumulative_summary.prob_first_recall, xlim=(0, 12), ylim=(0.0, 1.0), xlabel='Serial position\n(b)', ylabel='Probability of first recall')

        panel_plot.add_plot_data(0, 0, plot_data=pd1)
        panel_plot.add_plot_data(0, 1, plot_data=pd2)

        plot = panel_plot.generate_plot()

        plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + task + '-' + subject + '-prob_recall_plot_combined.pdf')

        plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')

        if task == 'RAM_CatFR1':
            panel_plot = PanelPlot(xfigsize=6.0, yfigsize=6.0, i_max=1, j_max=1, title='', wspace=0.3, hspace=0.3)
            pd = BarPlotData(x=[0,1], y=[cumulative_summary.irt_within_cat, cumulative_summary.irt_between_cat], ylabel='IRT (msec)', x_tick_labels=['Within Cat', 'Between Cat'], barcolors=['grey','grey'], barwidth=0.5)
            panel_plot.add_plot_data(0, 0, plot_data=pd)
            plot = panel_plot.generate_plot()
            plot_out_fname = self.get_path_to_resource_in_workspace('reports/' + task + '-' + subject + '-irt_plot_combined.pdf')
            plot.savefig(plot_out_fname, dpi=300, bboxinches='tight')