In [1]:
# if our large test file is available, use it. Otherwise, use file generated from toy_mistis_1_setup_run.ipynb
import os
test_file = "../toy_mistis_1k_OPS1.nc"
filename = test_file if os.path.isfile(test_file) else "mistis.nc"
In [2]:
print filename
In [3]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import openpathsampling as paths
In [4]:
%%time
storage = paths.AnalysisStorage(filename)
In [5]:
mistis = storage.networks.load(0)
In [6]:
# this should be true if we restored correctly
for ens in mistis.sampling_transitions[0].ensembles:
print ens in storage.ensembles[:], repr(ens)
In [7]:
mistis.hist_args['max_lambda'] = { 'bin_width' : 0.01, 'bin_range' : (-0.35, 0.5) }
mistis.hist_args['pathlength'] = { 'bin_width' : 5, 'bin_range' : (0, 150) }
In [8]:
scheme = storage.schemes[0]
scheme.move_summary(storage.steps)
In [9]:
scheme.move_summary(storage.steps, 'minus')
In [10]:
scheme.move_summary(storage.steps, 'repex')
In [11]:
# we need to load the states and the innermost interface for each transition
stateA = storage.volumes['A']
stateB = storage.volumes['B']
stateC = storage.volumes['C']
inner_AB = mistis.transitions[(stateA, stateB)].interfaces[0]
inner_AC = mistis.transitions[(stateA, stateC)].interfaces[0]
inner_BA = mistis.transitions[(stateB, stateA)].interfaces[0]
In [12]:
# got these from mistis_flux.ipynb
fluxes = {(stateA, inner_AB): 0.00183239948364,
(stateA, inner_AC): 0.00183054222139,
(stateB, inner_BA): 0.00183376505796}
mistis.set_fluxes(fluxes)
In [13]:
%%time
mistis.rate_matrix(storage.steps, force=True)
Out[13]:
In [14]:
trans = mistis.transitions.values()[2]
trans_hists = trans.histograms['max_lambda']
In [15]:
for hist in trans_hists:
cross_prob = trans_hists[hist].reverse_cumulative()
plt.plot(cross_prob.x, np.log(cross_prob))
plt.plot(trans.tcp.x, np.log(trans.tcp), '-k', lw=2)
Out[15]:
In [16]:
print [str(e.interface) for e in trans_hists.keys()]
In [17]:
len(storage.steps)
Out[17]:
In [3]:
#import logging.config
#logging.config.fileConfig("../resources/debug_logging.conf", disable_existing_loggers=False)
In [4]:
n_blocks = 1 # for testing code
In [ ]:
#! skip
n_blocks = 10 # for real examples
In [19]:
resampling = paths.numerics.BlockResampling(storage.steps, n_blocks=n_blocks)
In [20]:
rate_df_func = lambda steps: mistis.rate_matrix(steps, force=True)
In [21]:
%%time
rates = paths.numerics.ResamplingStatistics(function=rate_df_func, inputs=resampling.blocks)
In [22]:
rates.mean
Out[22]:
In [23]:
rates.std
Out[23]:
In [24]:
rates.percentile(0)
Out[24]:
In [25]:
rates.percentile(25)
Out[25]:
In [26]:
rates.percentile(50)
Out[26]:
In [27]:
rates.percentile(75)
Out[27]:
In [28]:
rates.percentile(100)
Out[28]:
In [ ]: