Commit 7e84e106 authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

np.savetxt fixes

parent 9e6c65f3
Loading
Loading
Loading
Loading
+7 −15
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ def run(filenames, args):
    use_att = False

    if args.output:
        out = open(args.output, 'wt')
        out = open(args.output, 'wb')

    if args.flip_ratio:
        args.up=args.down=False
@@ -91,10 +91,8 @@ def run(filenames, args):
                         fmt=sym+'--', color=acolor,
                         label="%s (%s)" % (os.path.basename(filename), lbl))
            if out:
                out.write("# %s '%s'\n" % (filename, lbl))
                out.write("#Q counts err\n")
                np.savetxt(out, data.T, fmt='%.3g')
                out.write("\n")
                np.savetxt(out, data.T, fmt='%.3g', footer=' ',
                           header = "%s '%s'\nQ counts err" % (filename, lbl))

        if args.flip_ratio or args.coh_ratio:
            ndat   = len(result)//2
@@ -122,8 +120,6 @@ def run(filenames, args):
            att1   = result[1::2, 4]*1.0 if use_att else np.ones_like(pc1)
            cnt1   = cnt[1::2]

            print(att0, att1)

            fac    = (att0[:ndat]*pc1[:ndat])/(att1[:ndat]*pc0[:ndat])
            fratio =  cnt0[:ndat]/cnt1[:ndat]
            eratio = 1.0/cnt0[:ndat] + 1.0/cnt1[:ndat]
@@ -140,10 +136,8 @@ def run(filenames, args):
                             fmt='o--', color=acolor,
                             label="%s (%s)" % (os.path.basename(filename), 'FR'))
                if out:
                    out.write("# %s '%s'\n" % (filename, 'flip ratio'))
                    out.write("#Q dQ FR err\n")
                    np.savetxt(out, data.T, fmt='%.3g')
                    out.write("\n")
                    np.savetxt(out, data.T, fmt='%.3g', footer=' ',
                               header="%s '%s'\nQ dQ FR err" % (filename, 'flip ratio'))

            if args.coh_ratio:
                fratio = (2*fratio - 1)/3
@@ -154,10 +148,8 @@ def run(filenames, args):
                             fmt='s--', color=acolor,
                             label="%s (%s)" % (os.path.basename(filename), 'C/I'))
                if out:
                    out.write("# %s '%s'\n" % (filename, 'flip ratio'))
                    out.write("#Q dQ C/I err\n")
                    np.savetxt(out, data.T, fmt='%.3g')
                    out.write("\n")
                    np.savetxt(out, data.T, fmt='%.3g', footer=' ',
                               header="%s '%s'\nQ dQ C/I err" % (filename, 'coherent/incoherent'))