tools/plot-values/scatter.py
author Dmitriy Morozov <dmitriy@mrzv.org>
Thu, 09 Jul 2009 02:46:53 -0700
branchdev
changeset 139 656ec2838fb8
parent 138 96030f8d2f2c
child 141 cda0b85ffc50
permissions -rwxr-xr-x
Documentation for parametrization using persistent cohomology

#!/usr/bin/env python

from    pylab           import scatter, show, cm, colorbar, axes, savefig
from    itertools       import izip
from    sys             import argv, exit
import  os.path         as     osp


def plot(val1_fn, val2_fn):
    values1 = []
    with open(val1_fn) as fp:
        for line in fp.xreadlines():
            values1.append(float(line.split()[1]))
    
    values2 = []
    with open(val2_fn) as fp:
        for line in fp.xreadlines():
            values2.append(float(line.split()[1]))
    
    values1 = [v % 1. for v in values1]
    values2 = [v % 1. for v in values2]
    print min(values1), max(values2), min(values1), min(values2)

    scatter(values1, values2)
    axes().set_aspect('equal')
    show()

if __name__ == '__main__':
    if len(argv) < 3:
        print "Usage: %s VALUES1 VALUES2" % argv[0]
        exit()

    val1_fn = argv[1]
    val2_fn  = argv[2]
    plot(val1_fn, val2_fn)