plot_cstc_overview.py 文件源码

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

项目:dragonboard_testbench 作者: cta-observatory 项目源码 文件源码
def main(cstcfile, args):
    st = pd.HDFStore(cstcfile)
    keys = st.keys()[:-2]  # ignore channel 7

    name, ext = os.path.splitext(cstcfile)

    with PdfPages(name + '.pdf') as pdf:
        fig, axes = plt.subplots(1, 2, figsize=(12, 6))
        for i, n in enumerate(keys):
            df = st[n]

            m = df.groupby(['cell', 'sample']).mean()
            s = df.groupby(['cell', 'sample']).std()

            m2d = m['adc_counts'].values.reshape(-1, 40)
            s2d = s['adc_counts'].values.reshape(-1, 40)

            plots = {
                'mean': {
                    'data': m2d,
                    'ax_id': 0,
                    'vmax': 15,
                    'vmin': -15,
                    'cmap': 'RdBu_r',

                },
                'std_dev': {
                    'data': s2d,
                    'ax_id': 1,
                    'vmax': 30,
                    'vmin': 0,
                    'cmap': 'viridis',
                },
            }
            for plot_name, plot in plots.items():
                ax = axes[plot['ax_id']]
                ax.cla()
                im = ax.imshow(
                    plot['data'],
                    cmap=plot['cmap'],
                    aspect='auto',
                    interpolation='nearest',
                    vmin=plot['vmin'],
                    vmax=plot['vmax'],
                )
                divider = make_axes_locatable(ax)
                cax = divider.append_axes('right', size='5%', pad=0.05)
                cb = fig.colorbar(im, cax=cax)
                cb.set_label(plot_name + ' adc count')
                ax.set_xlabel('sample')
                ax.set_ylabel('cell')
                ax.set_title(n)

            fig.tight_layout()
            pdf.savefig(fig)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号