Ejemplo n.º 1
0
def test_jumpproposal(dmx_psrs,caplog):
    m2a=models.model_2a(dmx_psrs,noisedict=noise_dict)
    jp=sampler.JumpProposal(m2a)
    assert jp.draw_from_prior.__name__ == 'draw_from_prior'
    assert jp.draw_from_signal_prior.__name__ == 'draw_from_signal_prior'
    assert (jp.draw_from_par_prior('J1713+0747').__name__ ==
            'draw_from_J1713+0747_prior')
    assert (jp.draw_from_par_log_uniform({'gw':(-20,-10)}).__name__ ==
            'draw_from_gw_log_uniform')
    assert (jp.draw_from_signal('red noise').__name__ ==
            'draw_from_red noise_signal')
Ejemplo n.º 2
0
groups = sampler.get_parameter_groups(pta)

Sampler = ptmcmc(ndim, pta.get_lnlikelihood, pta.get_lnprior,
                 cov, groups=groups, outDir=args.outdir, resume=True)


np.save(args.outdir + 'pars.npy', pta.param_names)
np.save(args.outdir + 'par_model.npy', np.array(pta.params).astype(str))
np.save(args.outdir + 'signals.npy', list(pta.signals.keys()))

try:
    achrom_freqs = get_freqs(pta, signal_id='gw')
    np.savetxt(args.outdir + 'achrom_rn_freqs.txt', achrom_freqs, fmt='%.18e')
except:
    pass

jp = sampler.JumpProposal(pta)
Sampler.addProposalToCycle(jp.draw_from_prior, 15)
if args.rednoise:
    Sampler.addProposalToCycle(jp.draw_from_red_prior, 15)
Sampler.addProposalToCycle(jp.draw_from_gwb_log_uniform_distribution, 15)
if args.bayes_ephem:
    Sampler.addProposalToCycle(jp.draw_from_ephem_prior, 15)

N = int(args.niter)

Sampler.sample(x0, Niter=N, SCAMweight=30, AMweight=15,
               DEweight=50, burn=100000)

save_core(args.corepath, args.outdir)