In [6]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from fitensemble import belt, example_loader
predictions, measurements, uncertainties = example_loader.load_alanine_numpy()
phi, psi, assignments, indicators = example_loader.load_alanine_dihedrals()
num_samples = 20000 # Generate 20,000 MCMC samples
thin = 25 # Subsample (i.e. thin) the MCMC traces by 25X to ensure independent samples
burn = 5000 # Discard the first 5000 samples as "burn-in"
regularization_strength = 3.0 # How strongly do we prefer a "uniform" ensemble (the "raw" MD)?
In [2]:
belt_model = belt.MaxEntBELT(predictions, measurements, uncertainties, regularization_strength)
pymc_filename = "trialanine.h5"
belt_model.sample(num_samples, thin=thin, burn=burn,filename=pymc_filename)
In [3]:
belt_model = belt.MaxEntBELT.load("./trialanine.h5")
As we did previously, this model can be used to calculate the MAP conformational populations (p
) or a trace (state_pops_trace
) of an arbitrary observable:
In [7]:
p = belt_model.accumulate_populations()
state_pops_trace = belt_model.trace_observable(indicators.T)
state_pops = state_pops_trace.mean(0)
pd.DataFrame([state_pops],columns=[r"$PP_{II}$",r"$\beta$",r"$\alpha_r$",r"$\alpha_l$"],index=["BELT"])
Out[7]:
As before, we see the conformational populations of our BELT ensemble.