Esempio n. 1
0
File: q_pdf.py Progetto: zyxue/pybin
def outline():
    infs = options.fs
    print infs
    lenf = len(infs)

    if options.overlap:
        olp = options.overlap
        assert lenf % olp== 0, (
            "the num of infiles (%d) cannot be divided exactly by overlap (%d)" % (lenf, olp))
        row, col = q_acc.det_row_col(lenf/olp, options.morer)
    else:
        olp = 1
        row, col = q_acc.det_row_col(lenf, options.morer)

    fig = plt.figure(figsize=(24, 11.6625))
    ns, bs, id_s, axes = {}, {}, [], []
    for k, inf in enumerate(infs):
        if k % olp == 0:
            ax = fig.add_subplot(row, col, k/olp+1)
        id_, n, b = ax_distri(inf, ax, options.bins)
        axes.append(ax)
        id_s.append(id_)
        ns[id_], bs[id_] = n, b
    q_acc.decorate(
        id_s, bs, ns, axes, options.blegend, 
        options.xlb, options.ylb,
        options.xb, options.xe,
        options.yb, options.ye,
        )
    q_acc.show_or_save(options.of)
Esempio n. 2
0
def outline():
    xfs = sorted(glob.glob(options.xf))
    yfs = sorted(glob.glob(options.yf))
    assert len(xfs) == len(yfs), "the number of xyfs are not the same!!\n%r\n%r" % (xfs, yfs)
    l = len(xfs)

    if options.overlap:
        olp = options.overlap
        assert l % olp== 0, "the num of infiles are not even to do overlap"
        row,col = q_acc.det_row_col(l/olp, options.morer)
    else:
        olp = 1
        row,col = q_acc.det_row_col(l,options.morer)

    fig = plt.figure(figsize=(24,11))
    xps, yps, ids, axes = {}, {}, [], []
    for k, xyf in enumerate(zip(xfs,yfs)):
        print xyf
        if k % olp == 0:
            ax = fig.add_subplot(row,col,k/olp+1)
        id, xp, yp = ax_contour(xyf,ax)
        axes.append(ax)
        ids.append(id)
        xps[id], yps[id] = xp, yp
    q_acc.decorate(ids,xps,yps,axes,options)
    q_acc.show_or_save(options.of)
Esempio n. 3
0
def outline(options):
    infile = options.fs
    assert len(infile) == 1
    data = xvg2array_ap(infile[0])                          # infile is a list
    x = data.pop('time')       # pop the key of 'time' since it will consistent
                               # in all the subplots

    len_infs = len(data.keys())                         # time column has already been popped
    print data.keys()
    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)
Esempio n. 4
0
def main(options):
    infs = options.fs
    len_infs = len(infs)

    if options.mysys:
        from Mysys import read_mysys_dat
        mysys = read_mysys_dat()
    else:
        mysys = None

    if options.overlap:
        overlap = options.overlap
        assert len_infs % overlap== 0, "the num of infiles ({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))
    xs, ys, keys, axes = {}, {}, [], []
    for k, inf in enumerate(infs):
        logger.info("working on {0}".format(inf))
        if k % overlap == 0:
            ax = fig.add_subplot(row, col, k / overlap + 1)

        if options.template_for_legend:
            legend = re.compile(options.template_for_legend).search(inf).group()
        else:
            legend = inf

        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)
Esempio n. 5
0
File: q_ave.py Progetto: zyxue/pybin
def outline(options):
    xfs = sorted(glob.glob(options.xf))
    yfs = sorted(glob.glob(options.yf))
    if len(xfs) != len(yfs):
        raise ValueError(
            "the number of xyfs are not the same!!\n%r\n%r" % (xfs, yfs))

    fig = plt.figure(figsize=(12,9))
    ax = fig.add_subplot(1,1,1)
    xps, yps, tids, axes = {}, {}, [], [ax]
    for k, xyf in enumerate(zip(xfs,yfs)):
        print xyf
        tid, ave_xp, std_xp, ave_yp, std_yp = ax_ave(xyf,ax)
        tids.append(tid)
        xps[tid] = [ave_xp-std_xp, ave_xp+std_xp]
        yps[tid] = [ave_yp-std_yp, ave_yp+std_yp]
    ax.legend(loc='best')
    q_acc.decorate(tids,xps,yps,axes,options)
    q_acc.show_or_save(options.of)