wxplot.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:cebl 作者: idfah 项目源码 文件源码
def draw(self, freqs, powers, chanNames=None,
             colors = ('black', 'red', 'violet', 'blue', 'green', 'orange'),
             wxYield=False):

        if chanNames is None:
            chanNames = (None,) * powers.shape[0]

        colors = util.cycle(colors, powers.shape[1])

        powers = util.colmat(powers)
        powers = powers.T

        # cap so we don't break wxplt.PlotGraphics with inf
        # Note: we need to use finfo.max/10.0 since
        #   wxplt.PlotGraphics does some log10 processing
        #   before figuring tick marks
        finfo = np.finfo(powers.dtype)
        powers[powers < finfo.eps] = finfo.eps
        powers[powers > (finfo.max/10.0)] = (finfo.max/10.0)


        if wxYield:
            wx.Yield()
        lines = [wxplt.PolyLine(zip(freqs,p), legend=chan, colour=col, width=2)
            for p,col,chan in zip(powers, colors, chanNames)]

        #lines += [wxplt.PolyLine(( (60.0,np.min(powers)), (60.0,np.max(powers)) ), legend='60Hz', colour='black', width=1)]

        if wxYield:
            wx.Yield()
        gc = wxplt.PlotGraphics(lines, title=self.title,
            xLabel=self.xLabel, yLabel=self.yLabel)

        self.canvas.Draw(gc,
            xAxis=(freqs[0], freqs[-1]),
            yAxis=(np.min(powers), np.max(powers)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号