Beispiel #1
0
            cov = np.load('opt_jump.npy')
            print("Found a local optimal jump matrix.")
        except FileNotFoundError:
            print("No optimal jump matrix found, using diagonal jump matrix.")

    sampler = StateSampler(lnprob,
                           p0,
                           cov,
                           query_lnprob=query_lnprob,
                           acceptfn=acceptfn,
                           rejectfn=rejectfn,
                           debug=True,
                           outdir=Starfish.routdir)

    p, lnprob, state = sampler.run_mcmc(p0,
                                        N=args.samples,
                                        incremental_save=args.incremental_save)
    print("Final", p)

    sampler.write()

    # Kill all of the orders
    for pconn in pconns.values():
        pconn.send(("FINISH", None))
        pconn.send(("DIE", None))

    # Join on everything and terminate
    for p in ps.values():
        p.join()
        p.terminate()
Beispiel #2
0
    def rejectfn():
        print("Calling rejectfn")
        for ((spectrum_id, order_id), pconn) in pconns.items():
            pconn.send(("DECIDE", False))

    from Starfish.samplers import StateSampler

    start = Starfish.config["Theta"]
    p0 = np.array(start["grid"] + [start["vz"], start["vsini"], start["logOmega"]])

    jump = Starfish.config["Theta_jump"]
    cov = np.diag(np.array(jump["grid"] + [jump["vz"], jump["vsini"], jump["logOmega"]])**2)

    sampler = StateSampler(lnprob, p0, cov, query_lnprob=query_lnprob, acceptfn=acceptfn, rejectfn=rejectfn, debug=True, outdir=Starfish.routdir)

    p, lnprob, state = sampler.run_mcmc(p0, N=args.samples)
    print("Final", p)

    sampler.write()

    # Kill all of the orders
    for pconn in pconns.values():
        pconn.send(("FINISH", None))
        pconn.send(("DIE", None))

    # Join on everything and terminate
    for p in ps.values():
        p.join()
        p.terminate()

    import sys;sys.exit()
Beispiel #3
0
    def rejectfn():
        print("Calling rejectfn")
        for ((spectrum_id, order_id), pconn) in pconns.items():
            pconn.send(("DECIDE", False))

    from Starfish.samplers import StateSampler

    start = Starfish.config["Theta"]
    p0 = np.array(start["grid"] + [start["vz"], start["vsini"], start["logOmega"]])

    jump = Starfish.config["Theta_jump"]
    cov = np.diag(np.array(jump["grid"] + [jump["vz"], jump["vsini"], jump["logOmega"]])**2)

    sampler = StateSampler(lnprob, p0, cov, query_lnprob=query_lnprob, acceptfn=acceptfn, rejectfn=rejectfn, debug=True, outdir=Starfish.routdir)

    p, lnprob, state = sampler.run_mcmc(p0, N=args.samples)
    print("Final", p)

    sampler.write()

    # Kill all of the orders
    for pconn in pconns.values():
        pconn.send(("FINISH", None))
        pconn.send(("DIE", None))

    # Join on everything and terminate
    for p in ps.values():
        p.join()
        p.terminate()

    import sys;sys.exit()
Beispiel #4
0
    start = Starfish.config["Theta"]
    p0 = np.array(start["grid"] + [start["vz"], start["vsini"], start["logOmega"]])

    jump = Starfish.config["Theta_jump"]
    cov = np.diag(np.array(jump["grid"] + [jump["vz"], jump["vsini"], jump["logOmega"]])**2)

    if args.use_cov:
        try:
            cov = np.load('opt_jump.npy')
            print("Found a local optimal jump matrix.")
        except FileNotFoundError:
            print("No optimal jump matrix found, using diagonal jump matrix.")

    sampler = StateSampler(lnprob, p0, cov, query_lnprob=query_lnprob, acceptfn=acceptfn, rejectfn=rejectfn, debug=True, outdir=Starfish.routdir)

    p, lnprob, state = sampler.run_mcmc(p0, N=args.samples, incremental_save=args.incremental_save)
    print("Final", p)

    sampler.write()

    # Kill all of the orders
    for pconn in pconns.values():
        pconn.send(("FINISH", None))
        pconn.send(("DIE", None))

    # Join on everything and terminate
    for p in ps.values():
        p.join()
        p.terminate()

    import sys;sys.exit()