ngamsPlotDataAccess.py 文件源码

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

项目:ngas 作者: ICRAR 项目源码 文件源码
def _plotVirtualTime(accessList, archName, fgname, rd_bin_width = 250):
    """
    Plot data access based on virtual time
    """
    print "converting to num arrary for _plotVirtualTime"
    stt = time.time()
    x, y, id, ad, yd = _raListToVTimeNA(accessList)
    print ("Converting to num array takes %d seconds" % (time.time() - stt))
    fig = pl.figure()
    ax = fig.add_subplot(211)
    ax.set_xlabel('Access sequence number (%s to %s)' % (id.split('T')[0], ad.split('T')[0]), fontsize = 9)
    ax.set_ylabel('Observation sequence number', fontsize = 9)
    ax.set_title('%s archive activity ' % (archName), fontsize=10)
    ax.tick_params(axis='both', which='major', labelsize=8)
    ax.tick_params(axis='both', which='minor', labelsize=6)

    ax.plot(x, y, color = 'b', marker = 'x', linestyle = '',
                        label = 'access', markersize = 3)

    #legend = ax.legend(loc = 'upper left', shadow=True, prop={'size':7})

    ax1 = fig.add_subplot(212)
    ax1.set_xlabel('Access sequence number (%s to %s)' % (id.split('T')[0], ad.split('T')[0]), fontsize = 9)
    ax1.set_ylabel('Reuse distance (in-between accesses)', fontsize = 9)

    ax1.tick_params(axis='both', which='major', labelsize=8)
    ax1.tick_params(axis='both', which='minor', labelsize=6)

    ax1.plot(x, yd, color = 'k', marker = '+', linestyle = '',
                        label = 'reuse distance', markersize = 3)

    pl.tight_layout()
    fig.savefig(fgname)
    pl.close(fig)

    y1d = yd[~np.isnan(yd)]
    num_bin = (max(y1d) - min(y1d)) / rd_bin_width
    hist, bins = np.histogram(y1d, bins = num_bin)

    width = 0.7 * (bins[1] - bins[0])
    center = (bins[:-1] + bins[1:]) / 2
    fig1 = pl.figure()
    #fig1.suptitle('Histogram of data transfer rate from Pawsey to MIT', fontsize=14)
    ax2 = fig1.add_subplot(111)
    ax2.set_title('Reuse distance Histogram for %s' % archName, fontsize = 10)
    ax2.set_ylabel('Frequency', fontsize = 9)
    ax2.set_xlabel('Reuse distance (# of observation)', fontsize = 9)

    ax2.tick_params(axis='both', which='major', labelsize=8)
    ax2.tick_params(axis='both', which='minor', labelsize=6)

    pl.bar(center, hist, align='center', width=width)

    fileName, fileExtension = os.path.splitext(fgname)
    fig1.savefig('%s_rud_hist%s' % (fileName, fileExtension))

    pl.close(fig1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号