Example #1
0
    except OSError as e:
        print("{} does not exist, skipping. Or error {}".format(file, e))

print("Using a total of {} flatchains".format(len(flatchainList)))

if args.cat:
    assert len(flatchainList) > 1, "If concatenating samples, must provide more than one flatchain"
    utils.cat_list(args.output, flatchainList)

# Assume that if we are using either args.chain, or args.triangle, we are only suppling one
# chain, since these commands don't make sense otherwise.
if args.chain:
    assert len(flatchainList) == 1, "If plotting Markov Chain, only specify one flatchain"
    utils.plot_walkers(flatchainList[0], base=args.outdir)

if args.triangle:
    assert len(flatchainList) == 1, "If making Triangle, only specify one flatchain"
    utils.plot(flatchainList[0], base=args.outdir)

if args.paper:
    assert len(flatchainList) == 1, "If making Triangle, only specify one flatchain"
    utils.paper_plot(flatchainList[0], base=args.outdir)

if args.cov:
    assert len(flatchainList) == 1, "If estimating covariance, only specify one flatchain"
    utils.estimate_covariance(flatchainList[0], base=args.outdir, ndim=args.ndim)

if args.gelman:
    assert len(flatchainList) > 1, "If running Gelman-Rubin test, must provide more than one flatchain"
    utils.gelman_rubin(flatchainList)
Example #2
0
@contextlib.contextmanager
def chdir(dirname=None):
  curdir = os.getcwd()
  try:
    if dirname is not None:
      os.chdir(dirname)
    yield
  finally:
    os.chdir(curdir)


paths = glob("s*o*/mc.hdf5")

if args.triangle:
    flatchain = utils.h5read("mc.hdf5", args.burn)
    utils.plot(flatchain, base="")

    cmd = ["chain.py",  "--files", "mc.hdf5", "-t", "--burn", "{}".format(args.burn)]

    for path in paths:
        dirname, fname = path.split("/")

        # CD to this directory using context managers
        with chdir(dirname):
            subprocess.call(cmd)



if args.chain:
    flatchain = utils.h5read("mc.hdf5", args.burn)
    utils.plot_walkers(flatchain, base="")
Example #3
0
@contextlib.contextmanager
def chdir(dirname=None):
    curdir = os.getcwd()
    try:
        if dirname is not None:
            os.chdir(dirname)
        yield
    finally:
        os.chdir(curdir)


paths = glob("s*o*/mc.hdf5")

if args.triangle:
    flatchain = utils.h5read("mc.hdf5", args.burn)
    utils.plot(flatchain, base="")

    cmd = [
        "chain.py", "--files", "mc.hdf5", "-t", "--burn",
        "{}".format(args.burn)
    ]

    for path in paths:
        dirname, fname = path.split("/")

        # CD to this directory using context managers
        with chdir(dirname):
            subprocess.call(cmd)

if args.chain:
    flatchain = utils.h5read("mc.hdf5", args.burn)
Example #4
0
    assert len(
        flatchainList
    ) > 1, "If concatenating samples, must provide more than one flatchain"
    utils.cat_list(args.output, flatchainList)

# Assume that if we are using either args.chain, or args.triangle, we are only suppling one
# chain, since these commands don't make sense otherwise.
if args.chain:
    assert len(flatchainList
               ) == 1, "If plotting Markov Chain, only specify one flatchain"
    utils.plot_walkers(flatchainList[0], base=args.outdir)

if args.triangle:
    assert len(
        flatchainList) == 1, "If making Triangle, only specify one flatchain"
    utils.plot(flatchainList[0], base=args.outdir)

if args.paper:
    assert len(
        flatchainList) == 1, "If making Triangle, only specify one flatchain"
    utils.paper_plot(flatchainList[0], base=args.outdir)

if args.cov:
    assert len(flatchainList
               ) == 1, "If estimating covariance, only specify one flatchain"
    utils.estimate_covariance(flatchainList[0],
                              base=args.outdir,
                              ndim=args.ndim)

if args.gelman:
    assert len(