예제 #1
0
    def plot_distance(self,
                      results,
                      color,
                      name,
                      size=10,
                      suppress_scatter=False):
        """Results needs to be a DataFrame or Series object with 'connected' and 'distance' as columns

        """
        connected = results['connected']
        distance = results['distance']
        dist_win = self.params.value()
        if self.results is None:
            self.name = name
            self.color = color
            self.results = results
        if suppress_scatter is True:
            #suppress scatter plot for all results (takes forever to plot)
            plots = list(self.plots)
            plots[1] = None
            self.dist_plot = distance_plot(connected,
                                           distance,
                                           plots=plots,
                                           color=color,
                                           name=name,
                                           size=size,
                                           window=dist_win,
                                           spacing=dist_win)
        else:
            self.dist_plot = distance_plot(connected,
                                           distance,
                                           plots=self.plots,
                                           color=color,
                                           name=name,
                                           size=size,
                                           window=dist_win,
                                           spacing=dist_win)

        return self.dist_plot
    def plot_distance(self, results, color, name, size=10):
        """Results needs to be a DataFrame or Series object with 'connected' and 'distance' as columns

        """
        if self.results is None:
            self.name = name
            self.color = color
            self.results = results
        connected = results['connected']
        distance = results['distance'] 
        dist_win = self.params.value()
        self.dist_plot = distance_plot(connected, distance, plots=self.plots, color=color, name=name, size=size, window=dist_win, spacing=dist_win)
        self.plots[0].setXRange(0, 200e-6)
        # 
        return self.dist_plot
    2,
    2,
    2,
    2,
    2,
    2,
    2,
    2,
    2,
    2,
    2,
    2,
    2,
    2,
    2,
    2,
]

nc2 = []
d2 = []
for p, c, d in zip(n_probed, n_connected, dist):
    nc2.extend([True] * c)
    nc2.extend([False] * (p - c))
    d2.extend([d * 1e-6] * p)

plots = distance_plot(nc2, d2, color=(255, 255, 0), name="Brian/Gil Pvalb")[0]

# compare to latest results (but note these are from a different layer)
expts = cached_experiments()
expts.distance_plot('pvalb', 'pvalb', plots=plots)
    for i, class_info in enumerate(cell_classes):
        cell_class, class_name, color = class_info

        # Add text label
        label = pg.LabelItem(class_name)
        label.setFixedWidth(80)
        label.setParentItem(dist_plots[i].vb)

        class_results = results[(cell_class, cell_class)]

        probed_pairs = class_results['probed_pairs']
        connected_pairs = class_results['connected_pairs']

        probed_distance = [p.distance for p in probed_pairs]
        connections = [(p in connected_pairs) for p in probed_pairs]

        plot, xvals, prop, upper, lower = distance_plot(connections, probed_distance, plots=(dist_plots[i], None), color=color, window=40e-6, spacing=40e-6)

        bins = np.arange(0, 180e-6, 20e-6)
        hist = np.histogram(probed_distance, bins=bins)
        hist_plots[i].plot(hist[1], hist[0], stepMode=True, fillLevel=0, brush=color + (80,))

        write_csv(csv_file, hist[1], "Figure 4%s, %s histogram values" % (fig_letter, class_name))
        write_csv(csv_file, hist[0], "Figure 4%s, %s histogram bin edges" % (fig_letter, class_name))
        write_csv(csv_file, xvals, "Figure 4%s, %s distance plot x vals" % (fig_letter, class_name))
        write_csv(csv_file, prop, "Figure 4%s, %s distance plot trace" % (fig_letter, class_name))
        write_csv(csv_file, upper, "Figure 4%s, %s distance plot upper CI" % (fig_letter, class_name))
        write_csv(csv_file, lower, "Figure 4%s, %s distance plot x vals" % (fig_letter, class_name))