def do_cdfs(options, stats, write_filepath): if not write_filepath: write_filepath = get_output_filepath(options.input) for metric in options.metrics: print("reformatting data...") data = {} for i, g in enumerate(stats['group']): if options.max and i >= options.max: break data[g] = [d[metric] for d in stats['data'][g]["distribution"]] print("plotting CDFs") xmax = round(math.ceil(max(data[stats['group'][0]]))) axis_limits = [0, xmax, 0, 1] if options.minx: axis_limits[0] = options.minx if options.maxx: axis_limits[1] = options.maxx plot.plot('cdf', data, COLORS, axis_limits, metric, "linear", "linear", write_filepath + '_' + metric + '_cdfs', options.write, xlabel=metric_fullname(metric) + ' (miles)', ylabel='fraction of \ncontroller placements', ext=options.ext) if not options.write: plot.show()
def do_cdfs(options, stats, write_filepath): if not write_filepath: write_filepath = get_output_filepath(options.input) for metric in options.metrics: print "reformatting data..." data = {} for i, g in enumerate(stats['group']): if options.max and i >= options.max: break data[g] = [d[metric] for d in stats['data'][g]["distribution"]] print "plotting CDFs" xmax = round(math.ceil(max(data[stats['group'][0]]))) axis_limits = [0, xmax, 0, 1] if options.minx: axis_limits[0] = options.minx if options.maxx: axis_limits[1] = options.maxx plot.plot('cdf', data, COLORS, axis_limits, metric, "linear", "linear", write_filepath + '_' + metric + '_cdfs', options.write, xlabel = metric_fullname(metric) + ' (miles)', ylabel = 'fraction of \ncontroller placements', ext = options.ext) if not options.write: plot.show()
#!/usr/bin/env python3 from lib.plot import plot if __name__ == '__main__': plot()
for j, b in enumerate(values): if x[j] not in combined: combined[x[j]] = [] combined[x[j]].append(b) group_str = get_group_str(options) xmax = max(combined[sorted(combined.keys())[0]]) axis_limits = [0, xmax, 0, 1] for xscale in ["linear", "log"]: ptype = 'latency_cdfs_' + xscale write_filepath = 'data_vis/merged/%s_%i_to_%i_%s_%s' % (group_str, options.from_start, options.from_end, metric, ptype) # Assume the loweest-numbered element is the smallest plot.plot('cdf', combined, COLORS, axis_limits, metric, xscale, "linear", write_filepath, options.write, xlabel = 'optimal ' + metric_fullname(metric) + ' (miles)', ylabel = 'fraction of topologies', ext = options.ext, legend = True) if options.gen_1ctrl_table: write_filepath = 'data_vis/merged/%s_%i_to_%i_%s_%s' % (group_str, options.from_start, options.from_end, metric, '1ctrl_table') dump_1ctrl_latex_table(combined[1], write_filepath, SAFETY_MARGINS, USE_FRACTIONS) if 'pareto' in options.cdf_plots: assert 'pareto_max' in metric_data assert 'base' in metric_data['pareto_max'] topo_data = metric_data['pareto_max']['base'] combined = {} # keys are values for k; values are distribution of optimal latencies for topo, data_lines in topo_data.iteritems(): x = data_lines['x']
args = parser.parse_args() if args.work == None: print('must specify work') elif args.work == 'preprocess' or args.work == 'pre': from lib.preprocess import do_preprocess if args.file != None: do_preprocess(args.file[0], args.file[1]) else: do_preprocess(test_exist=True) os.system('python3 main.py -w train -e 5 -b 256') elif args.work == 'test': from lib.test import test test(args.file[0], args.file[1]) elif args.work == 'train': from lib.train import train history = train(model_path=args.model, epochs=args.epochs, batch_size=args.batch_size, seed=args.random_seed) if args.plot == True: from lib.plot import plot plot(history) elif args.work == 'semi': from lib.semiParse import semiParse semiParse()
from ij import IJ import sys sys.path.append("/home/albert/lab/scripts/python/imagej/IsoView-GCaMP/") from lib.plot import plot2DRoiOverZ as plot imp3D = IJ.getImage() plot(imp3D, YaxisLabel="Fluorescence intensity", XaxisLabel="Time (seconds)", Zscale=0.75)