def plotIntermediateResults(self):

        print("\n--- Plotting results ---\n")

        # Individual intracellular traces
        if self.plot_intracellular and self.record_Vm:

            fig = plt.figure()
            fig.subplots_adjust(hspace=1.5)
            fig.subplots_adjust(wspace=0.4)

            start_pos = int(self.start_time /
                            self.newSimulation.Params['resolution'])
            time = self.newSimulation.time[start_pos:len(self.newSimulation.
                                                         time)]

            data_analysis.membranePotentials(
                self.start_time, self.newSimulation.Params['resolution'],
                self.simtime, self.potentials, self.layers_to_record,
                self.labels, self.selected_cell, self.intracellular_rows,
                self.intracellular_cols, self.intracellular_starting_row,
                self.intracellular_starting_col, "thalamocortical_system")

        # PSTHs
        if self.plot_PSTH:

            fig = plt.figure()
            fig.subplots_adjust(hspace=1.5)
            fig.subplots_adjust(wspace=0.4)

            start_pos = int(self.start_time /
                            self.newSimulation.Params['resolution'])
            time = self.newSimulation.time[start_pos:len(self.newSimulation.
                                                         time)]

            data_analysis.PSTH(
                self.start_time, self.newSimulation.Params['resolution'],
                self.simtime, self.spikes, self.layers_to_record, self.labels,
                self.selected_cell, self.PSTH_rows, self.PSTH_cols,
                self.PSTH_starting_row, self.PSTH_starting_col, self.trials,
                self.PSTHs, self.bin_size, "thalamocortical_system")

        plt.show()
    def plotIntermediateResults(self):

        print("\n--- Plotting results ---\n")

        # Individual intracellular traces
        if self.plot_intracellular:

            fig = plt.figure()
            fig.subplots_adjust(hspace=1.5)
            fig.subplots_adjust(wspace=0.4)

            start_pos = int(self.start_time /
                            self.newSimulation.Params['resolution'])
            time = self.newSimulation.time[start_pos:len(self.newSimulation.
                                                         time)]

            ax = plt.subplot2grid(
                (self.intracellular_rows, self.intracellular_cols), (0, 0))
            ax.plot(
                time,
                self.L_cone_input[self.selected_cell,
                                  start_pos:len(self.newSimulation.time)])
            ax.set_title('Input')

            # Save input stimulus
            np.savetxt(
                '../../data/retina/input/L_input',
                self.L_cone_input[self.selected_cell,
                                  start_pos:len(self.newSimulation.time)])

            ax = plt.subplot2grid(
                (self.intracellular_rows, self.intracellular_cols), (0, 1))
            ax.plot(
                time, self.newSimulation.cone_response[
                    0, self.selected_cell,
                    start_pos:len(self.newSimulation.time)])
            ax.set_title('L cones')

            # Save cone response
            np.savetxt(
                '../../data/retina/input/L_cone',
                self.newSimulation.cone_response[
                    0, self.selected_cell,
                    start_pos:len(self.newSimulation.time)])

            ax = plt.subplot2grid(
                (self.intracellular_rows, self.intracellular_cols), (0, 2))
            ax.plot(
                time, self.newSimulation.cone_response[
                    1, self.selected_cell,
                    start_pos:len(self.newSimulation.time)])
            ax.set_title('M cones')

            ax = plt.subplot2grid(
                (self.intracellular_rows, self.intracellular_cols), (0, 3))
            ax.plot(
                time, self.newSimulation.cone_response[
                    2, self.selected_cell,
                    start_pos:len(self.newSimulation.time)])
            ax.set_title('S cones')

            ax = plt.subplot2grid(
                (self.intracellular_rows, self.intracellular_cols), (1, 0))
            ax.plot(
                time, self.newSimulation.L_cone_metabotropic[
                    self.selected_cell,
                    start_pos:len(self.newSimulation.time)])
            ax.set_title('L cones metabotropic')

            ax = plt.subplot2grid(
                (self.intracellular_rows, self.intracellular_cols), (1, 1))
            ax.plot(
                time, self.newSimulation.M_cone_metabotropic[
                    self.selected_cell,
                    start_pos:len(self.newSimulation.time)])
            ax.set_title('M cones metabotropic')

            ax = plt.subplot2grid(
                (self.intracellular_rows, self.intracellular_cols), (1, 2))
            ax.plot(
                time, self.newSimulation.S_cone_metabotropic[
                    self.selected_cell,
                    start_pos:len(self.newSimulation.time)])
            ax.set_title('S cones metabotropic')

            ax = plt.subplot2grid(
                (self.intracellular_rows, self.intracellular_cols), (1, 3))
            ax.plot(
                time, self.newSimulation.L_cone_ionotropic[
                    self.selected_cell,
                    start_pos:len(self.newSimulation.time)])
            ax.set_title('L cones ionotropic')

            ax = plt.subplot2grid(
                (self.intracellular_rows, self.intracellular_cols), (2, 0))
            ax.plot(
                time, self.newSimulation.M_cone_ionotropic[
                    self.selected_cell,
                    start_pos:len(self.newSimulation.time)])
            ax.set_title('M cones ionotropic')

            ax = plt.subplot2grid(
                (self.intracellular_rows, self.intracellular_cols), (2, 1))
            ax.plot(
                time, self.newSimulation.S_cone_ionotropic[
                    self.selected_cell,
                    start_pos:len(self.newSimulation.time)])
            ax.set_title('S cones ionotropic')

            data_analysis.membranePotentials(
                self.start_time, self.newSimulation.Params['resolution'],
                self.simtime, self.potentials, self.layers_to_record,
                self.labels, self.selected_cell, self.intracellular_rows,
                self.intracellular_cols, self.intracellular_starting_row,
                self.intracellular_starting_col, "retina")

        # PSTHs
        if self.plot_PSTH:

            fig = plt.figure()
            fig.subplots_adjust(hspace=1.5)
            fig.subplots_adjust(wspace=0.4)

            start_pos = int(self.start_time /
                            self.newSimulation.Params['resolution'])
            time = self.newSimulation.time[start_pos:len(self.newSimulation.
                                                         time)]

            ax = plt.subplot2grid((self.PSTH_rows, self.PSTH_cols), (0, 0))
            ax.plot(
                time,
                self.L_cone_input[self.selected_cell,
                                  start_pos:len(self.newSimulation.time)])
            ax.set_title('Input')

            data_analysis.PSTH(
                self.start_time, self.newSimulation.Params['resolution'],
                self.simtime, self.spikes, self.s_layers_to_record,
                self.sp_labels, self.selected_cell, self.PSTH_rows,
                self.PSTH_cols, self.PSTH_starting_row, self.PSTH_starting_col,
                self.trials, self.PSTHs, self.bin_size, "retina")

        # Topographical plot
        if self.plot_topographical:

            fig = plt.figure()
            fig.subplots_adjust(hspace=1.5)
            fig.subplots_adjust(wspace=0.4)

            if self.topographical_isSpikes:
                recs = self.spikes
            else:
                recs = self.potentials

            data_analysis.topographical(
                fig, self.newSimulation.Params['N'],
                self.topographical_time_intervals,
                self.newSimulation.Params['resolution'], self.simtime, recs,
                self.top_layers_to_record, self.top_labels,
                self.topographical_rows, self.topographical_cols,
                self.topographical_V_mins, self.topographical_V_maxs,
                self.topographical_isSpikes, self.trials, self.top_PSTHs,
                self.bin_size, self.top_PSTH_index, 0)

        # Video sequence
#        data_analysis.videoSeq(self.newSimulation.Params['N'],self.inputIm,
#        self.simtime,self.newSimulation.Params['resolution'],self.intracellular_video_step)

        plt.show()
예제 #3
0
    def plotResults(self):

        print("\n--- Plotting results ---\n")

        # Individual intracellular traces
        if self.plot_intracellular and self.record_Vm:

            fig = plt.figure()
            fig.subplots_adjust(hspace=1.5)
            fig.subplots_adjust(wspace=0.4)

            start_pos = int(self.start_time /
                            self.newSimulation.Params['resolution'])
            time = self.newSimulation.time[start_pos:len(self.newSimulation.
                                                         time)]

            data_analysis.membranePotentials(
                self.start_time, self.newSimulation.Params['resolution'],
                self.simtime, self.potentials, self.layers_to_record,
                self.labels, self.selected_cell, self.intracellular_rows,
                self.intracellular_cols, self.intracellular_starting_row,
                self.intracellular_starting_col, "thalamocortical_system")

        # PSTHs
        if self.plot_PSTH:

            fig = plt.figure()
            fig.subplots_adjust(hspace=1.5)
            fig.subplots_adjust(wspace=0.4)

            start_pos = int(self.start_time /
                            self.newSimulation.Params['resolution'])
            time = self.newSimulation.time[start_pos:len(self.newSimulation.
                                                         time)]

            data_analysis.PSTH(
                self.start_time, self.newSimulation.Params['resolution'],
                self.simtime, self.spikes, self.layers_to_record, self.labels,
                self.selected_cell, self.PSTH_rows, self.PSTH_cols,
                self.PSTH_starting_row, self.PSTH_starting_col, self.trials,
                self.PSTHs, self.bin_size, "thalamocortical_system")

        # Topographical plot
        if self.plot_topographical:

            fig = plt.figure()
            fig.subplots_adjust(hspace=1.5)
            fig.subplots_adjust(wspace=0.4)

            data_analysis.topographical(
                fig, self.newSimulation.Params['N_cortex'],
                self.topographical_time_intervals,
                self.newSimulation.Params['resolution'], self.simtime,
                self.spikes, self.top_layers_to_record, self.top_labels,
                self.topographical_rows, self.topographical_cols,
                self.topographical_V_mins, self.topographical_V_maxs,
                self.topographical_isSpikes, self.trials, self.top_PSTHs,
                self.bin_size, self.top_PSTH_index, self.layer_sizes_top)

            data_analysis.topographical(
                fig, self.newSimulation.Params['N_cortex'],
                self.topographical_time_intervals,
                self.newSimulation.Params['resolution'], self.simtime,
                self.spikes, self.pop_layers_to_record, self.pop_labels,
                self.topographical_rows, self.topographical_cols,
                self.pop_V_mins, self.pop_V_maxs, self.topographical_isSpikes,
                self.trials, self.top_PSTHs, self.bin_size,
                self.pop_PSTH_index, self.layer_sizes_pop, True)

        plt.show()