Example #1
0
    def addData(self,
                xvals, yvals,
                xlabel, ylabel,
                nplotted,
                yerrors=None):

        xxvals, yyvals = Stats.filterNone((xvals, yvals))

        color, linestyle, marker = self.getFormat(nplotted)

        self.bokeh_figure.line(
            xxvals,
            yyvals,
            color=color,
            line_width=2)
Example #2
0
    def render(self, dataframe, path):

        if len(dataframe.columns) < 2:
            raise ValueError(
                "requiring two coordinates, only got %s" %
                str(dataframe.columns))

        plts, legend = [], []
        blocks = ResultBlocks()

        for xcolumn, ycolumn in itertools.combinations(dataframe.columns, 2):

            # remove missing data points
            xvalues, yvalues = Stats.filterMissing(
                (dataframe[xcolumn], dataframe[ycolumn]))

            # remove columns with all NaN
            if len(xvalues) == 0 or len(yvalues) == 0:
                continue

            # apply log transformation on data not on plot
            if self.logscale:
                if "x" in self.logscale:
                    xvalues = R.log10(xvalues)
                if "y" in self.logscale:
                    yvalues = R.log10(yvalues)

            self.startPlot()
            # wrap, as pandas series can not
            # passed through rpy2.
            R.smoothScatter(numpy.array(xvalues, dtype=numpy.float),
                            numpy.array(yvalues, dtype=numpy.float),
                            xlab=xcolumn,
                            ylab=ycolumn,
                            nbin=self.nbins)
            blocks.extend(self.endPlot(dataframe, path))

        return blocks
Example #3
0
 def apply(self, xvals, yvals):
     xx = xvals[~numpy.isnan(xvals)]
     yy = yvals[~numpy.isnan(yvals)]
     r = Stats.doMannWhitneyUTest(xx, yy)
     return r
Example #4
0
 def apply(self, xvals, yvals):
     return Stats.doCorrelationTest(xvals, yvals,
                                    method=self.method)
Example #5
0
 def smooth_histogram(self, data):
     if len(data) <= self.smooth_window_size:
         return data
     r = Stats.smooth(data, window_len=self.smooth_window_size)
     return r[:len(data)]