#!/usr/bin/python # vim: set fileencoding=UTF-8 """ Test of plotting functionality January 2014 Joseph Bonneau [email protected] """ from dist import dist import sys import os colors = ["b", "g", "r", "m", "c", "y", "k"] # Test bed code: to_plot = [] index = 0 for f in sys.argv[1:]: d = dist.load(f) f = os.path.splitext(os.path.basename(f))[0] to_plot.append((d, {"color": colors[index], "split_plot": True, "show_projected": True, "show_tail": False})) index = (index + 1) % len(colors) dist.plot_marginal_guesswork(to_plot, legend_outside=False, plot_type="mu")
import jutils #Series of labels to use when printing tables or graphs, replacing less elegant filenames titles = { "un_uhdr": "Letters [UN UDHR]", "ry_pins": "Pins [RockYou]", "ry_passwords": "Passwords [RockYou]", } #Place known total population figures here populations = { } #Read from stdin if len(sys.argv[1:]) == 0: d = dist.load(None) d.compute_stats() d.save(None) for f in sys.argv[1:]: b, e = os.path.splitext(f) b_short = os.path.basename(b) d = dist.load(f, total_weight = (populations[b_short] if b_short in populations else None), known_title = (titles[b_short] if b_short in titles else None)) if e == '.dz': np_cum_only = False if np_cum_only: print dist.title(d) d.compute_stats()