plt.show() ########################################## # Next, let's do some posterior sampling else: #sampler = PosteriorSampler(ensemble, use_reference_prior=True, sample_ambiguous_distances=False) sampler = PosteriorSampler(ensemble, dlogsigma_noe=np.log(1.02), sigma_noe_min=0.05, sigma_noe_max=5.0, dlogsigma_J=np.log(1.02), sigma_J_min=0.05, sigma_J_max=20.0, dloggamma=np.log(1.01), gamma_min=0.5, gamma_max=2.0, use_reference_prior=not(args.noref), sample_ambiguous_distances=False) #sampler = PosteriorSampler(ensemble, use_reference_prior=True) sampler.sample(args.nsteps) # number of steps print 'Processing trajectory...', sampler.traj.process() # compute averages, etc. print '...Done.' print 'Writing results...', sampler.traj.write_results(os.path.join(args.outdir,'traj_lambda%2.2f.yaml'%args.lam)) print '...Done.' # pickle the sampler object print 'Pickling the sampler object ...', outfilename = 'sampler_lambda%2.2f.pkl'%args.lam print outfilename, fout = open(os.path.join(args.outdir, outfilename), 'wb') # Pickle dictionary using protocol 0.
elif File.endswith('pf'): R = Restraint_pf('8690.pdb',ref='gaussian') R.prep_observable(lam=lam, free_energy=energies[i], filename=File) ensemble[-1].append(R) print ensemble ########################################## # Next, let's do some posterior sampling ########## Posterior Sampling ############ sampler = PosteriorSampler(ensemble) sampler.compile_nuisance_parameters() sampler.sample(nsteps) # number of steps print 'Processing trajectory...', sampler.traj.process() # compute averages, etc. print '...Done.' print 'Writing results...', sampler.traj.write_results(os.path.join(outdir,'traj_lambda%2.2f.npz'%lam)) print '...Done.' sampler.traj.read_results(os.path.join(outdir,'traj_lambda%2.2f.npz'%lam)) print 'Pickling the sampler object ...', outfilename = 'sampler_lambda%2.2f.pkl'%lam print outfilename, fout = open(os.path.join(outdir, outfilename), 'wb')
print 's.distance_ambiguity_groups', s.distance_ambiguity_groups print '-------' ########################################## # Next, let's do some posterior sampling sampler = PosteriorSampler(ensemble) # set sampling parameters sampler.sigma_noe = 0.1 sampler.dsigma_noe = 0.005 #sampler.sigma_Jcoupl = 1.0 #sampler.dsigma_Jcoupl = 0.2 # controls the magnitude of steps in sigma_Jcoupl sampler.sample(100000) # number of steps sampler.traj.plot_results() """ ATOM 1 C1 UNK 1 1.484 2.515 0.317 1.00 0.00 C ATOM 2 O1 UNK 1 1.764 3.456 -0.687 1.00 0.00 O ATOM 3 H1 UNK 1 2.690 3.660 -0.679 1.00 0.00 H ATOM 4 C2 UNK 1 0.024 2.150 0.230 1.00 0.00 C ATOM 5 C3 UNK 1 -0.834 2.470 -0.721 1.00 0.00 C ATOM 6 C4 UNK 1 -2.174 1.833 -0.796 1.00 0.00 C ATOM 7 O2 UNK 1 -2.287 0.813 0.047 1.00 0.00 O ATOM 8 C5 UNK 1 -3.415 -0.066 0.010 1.00 0.00 C ATOM 9 C6 UNK 1 -2.831 -1.448 0.343 1.00 0.00 C ATOM 10 C7 UNK 1 -1.943 -1.968 -0.812 1.00 0.00 C ATOM 11 C8 UNK 1 -0.712 -2.776 -0.360 1.00 0.00 C