def diagonal_file(data_folder, op): corrfile = data_folder + cor_template.format(op, op) if(args.no_vev): return build_corr.corr_and_vev_from_files(corrfile, cfgs=args.configs, ts=args.times) else: vev_file = data_folder + vev_template.format(op) return build_corr.corr_and_vev_from_files(corrfile, vev_file, vev_file, cfgs=args.configs, ts=args.times)
def off_diagonal_file(data_folder, src_op, snk_op): corrfile = data_folder + cor_template.format(src_op, snk_op) if(args.no_vev): return build_corr.corr_and_vev_from_files(corrfile, cfgs=args.configs, ts=args.times) else: src_vev_file = data_folder + vev_template.format(src_op) snk_vev_file = data_folder + vev_template.format(snk_op) return build_corr.corr_and_vev_from_files(corrfile, src_vev_file, snk_vev_file, cfgs=args.configs, ts=args.times)
def ratio_files(files, options): # data = [plot_files.read_file(f) for f in files] c1 = build_corr.corr_and_vev_from_files(files[0], None, None) c2 = build_corr.corr_and_vev_from_files(files[1], None, None) a1 = c1.average_sub_vev() a2 = c2.average_sub_vev() ratio = {} for t in c1.times: print t print a1[t], a2[t] print a2[t]/a1[t] ratio[t] = a2[t]/a1[t] if options.output_stub: filename = options.output_stub+".ratio" logging.info("writing ratio to {}".format(filename)) with open(filename, 'w') as ofile: for t,v in ratio.iteritems(): ofile.write("{}, {}\n".format(t,v))
[c.get(config=cfg,time=t) for c in corr_matrix.flat]).reshape(2,2)) for t in times] def split_matrix_of_cors(corr_matrix, vevs): """ Takes a dictionar whose elements are """ pass if __name__ == "__main__": logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG) exampledir = "/home/bfahy/r3/effectivemasses/meyer_binned/total/" corfile11 = exampledir + "binned_500_a1pp_0_optype0_op1_a1pp_0_optype0_op1.cor" vev1file = exampledir + "binned_500_a1pp_0_optype0_op1_a1pp_0_optype0_op1.vev1" vev2file = exampledir + "binned_500_a1pp_0_optype0_op1_a1pp_0_optype0_op1.vev2" cor11 = build_corr.corr_and_vev_from_files(corfile11, vev1file, vev2file) corfile12 = exampledir + "binned_500_a1pp_0_optype0_op1_a1pp_0_optype10_op1.cor" vev1file = exampledir + "binned_500_a1pp_0_optype0_op1_a1pp_0_optype10_op1.vev1" vev2file = exampledir + "binned_500_a1pp_0_optype0_op1_a1pp_0_optype10_op1.vev2" cor12 = build_corr.corr_and_vev_from_files(corfile12, vev1file, vev2file) # corfile21 = exampledir + "binned_500_a1pp_0_optype10_op1_a1pp_0_optype0_op1.cor" # vev1file = exampledir + "binned_500_a1pp_0_optype10_op1_a1pp_0_optype0_op1.vev1" # vev2file = exampledir + "binned_500_a1pp_0_optype10_op1_a1pp_0_optype0_op1.vev2" # cor21 = build_corr.corr_and_vev_from_files(corfile21, vev1file, vev2file) cor21 = cor12 corfile22 = exampledir + "binned_500_a1pp_0_optype10_op1_a1pp_0_optype10_op1.cor" vev1file = exampledir + "binned_500_a1pp_0_optype10_op1_a1pp_0_optype10_op1.vev1"
if not args.time_start or not args.time_end: parser.error("tmin plot requires specifing a fit range") if args.output_stub: args.output_stub = os.path.splitext(args.output_stub)[0] corrfile = args.inputfile vev1 = args.vev vev2 = vev1 if args.vev2: vev2 = args.vev2 try: cor = build_corr.corr_and_vev_from_files_pandas(corrfile, vev1, vev2) except AttributeError: logging.info("Failed to read with pandas, reading normal") cor = build_corr.corr_and_vev_from_files(corrfile, vev1, vev2) if args.symmetric or args.antisymmetric: corsym = cor.determine_symmetry() if corsym is None: logging.error("called with symmetric but correlator isnt") raise RuntimeError("called with symmetric but correlator isnt") logging.info("correlator found to be {}".format(corsym)) cor.make_symmetric() tmin_plot(funct, cor, args.time_start, args.time_end, filestub=args.output_stub, bootstraps=args.bootstraps)