Exemple #1
0
    if options.overlap:
        overlap = options.overlap
        assert len_infs % overlap== 0, "the num of keys ({0}) are not even to do overlap ({1})".format(
            len_infs, overlap)
        row, col = q_acc.det_row_col(len_infs / overlap, options.morer)
    else:
        overlap = 1
        row, col = q_acc.det_row_col(len_infs, options.morer)

    fig = plt.figure(figsize=(24,11))
    # row, col = q_acc.det_row_col(len(data.keys()))

    for k, key in enumerate(data.keys()):
        if k % overlap == 0:
            ax = fig.add_subplot(row, col, k / overlap + 1)
            
        # ax = fig.add_subplot(row,col,k+1)
        print len(x), len(data[key]), key
        ax.plot(x, data[key], label=key)
        ax.set_title(key)
        ax.grid(b=True)
        # ax.set_ylim([-180, 180])

    q_acc.show_or_save(options.of)

if __name__ == '__main__':
    import time; b=time.time()
    outline(q_acc.parse_cmd())
    e = time.time()
    print "TIME ELAPSED: %f" % (e - b)
Exemple #2
0
        if mysys:
            # need further modification to choose color in terms of solute or solvent
            group = re.compile('sq[1-9][wmepov]\d{3,4}s[0-9][0-9]').search(inf).group()
            seq = group[:3]
            color = mysys[seq].color
            marker = mysys[seq].marker
            legend = mysys[seq].seq
        else:
            color = None                # specified by matplotlib automatically
            marker = None

        key = inf                                  # use the file name as a key
        # collection of x & y will be used to determine the xlim & ylim
        x, y = ax_plot(inf, ax, legend, color, marker, options.eb)
        axes.append(ax)
        keys.append(key)
        xs[key], ys[key] = x, y

    blegend, xlb, ylb, xb, yb, xe, ye = (options.blegend, options.xlb, options.ylb, 
                                         options.xb, options.yb, options.xe, options.ye)
    q_acc.decorate(keys, xs, ys, axes, blegend, xlb, ylb, xb, yb, xe, ye)
    q_acc.show_or_save(options.of)

if __name__ == '__main__':
    import time
    b=time.time()
    options = q_acc.parse_cmd()
    main(options)
    e = time.time()
    print e - b
Exemple #3
0
    (ave_xp, std_xp, ave_yp, std_yp) = (
        np.average(xf_data), np.std(xf_data), np.average(yf_data), np.std(yf_data))

    ave_change = (ave_yp-ave_xp) / ave_xp
    std_change = error_change(ave_xp, std_xp, ave_yp, std_yp)
    if not k1 in change.keys():
        change[k1] = {}
    change[k1][k2] = [ave_change, std_change]
    return change
    # print "%-30s%-10.2f%-30s%-10.2f%10.2f" % (xf, ave_xp, yf, ave_yp, (ave_yp-ave_xp)/ave_xp)n
    # return ave_xp, std_xp, ave_yp, std_yp

def outline(options):
    pwd = os.environ['PWD']
    dir_template = re.compile('g_rg|u[pn][u][pn]|u[pn]vp')
    dirs = [ d for d in os.listdir(pwd) if dir_template.search(d) and os.path.isdir(d) ]
    assert len(dirs) > 0
    xfs , yfs = [], []
    for d in dirs:
        xfs.extend(sorted(glob.glob(os.path.join(d, 'sq[1-6]w*'))))
        yfs.extend(sorted(glob.glob(os.path.join(d, 'sq[1-6]m*'))))
    assert len(xfs) == len(yfs), 'the number of files of xfs & yfs are not the same\n {0}\n {1}'.format(xfs, yfs)
    change = {}
    for xf, yf in zip(xfs,yfs):
        change = quantify_ave_change(xf,yf,change)
    pretty_output(change)

if __name__ == "__main__":
    outline(parse_cmd())
    # print error_change(1.3, 0.2, 0.9, 0.1)