diff --git a/pyemma/thermo/estimators/DTRAM_estimator.py b/pyemma/thermo/estimators/DTRAM_estimator.py index 02150f6ef..1efb8d05e 100644 --- a/pyemma/thermo/estimators/DTRAM_estimator.py +++ b/pyemma/thermo/estimators/DTRAM_estimator.py @@ -116,9 +116,9 @@ class DTRAM(_Estimator, _MEMM, _ProgressReporter): """ def __init__( - self, bias_energies_full, lag, count_mode='sliding', connectivity='largest', - maxiter=10000, maxerr=1.0E-15, save_convergence_info=0, dt_traj='1 step', - init=None, init_maxiter=10000, init_maxerr=1.0E-8): + self, bias_energies_full, lag, count_mode='sliding', connectivity='largest', + maxiter=10000, maxerr=1.0E-15, save_convergence_info=0, dt_traj='1 step', + init=None, init_maxiter=10000, init_maxerr=1.0E-8): # set all parameters self.bias_energies_full = _types.ensure_ndarray(bias_energies_full, ndim=2, kind='numeric') self.lag = lag @@ -142,21 +142,25 @@ def __init__( self.conf_energies = None self.log_lagrangian_mult = None - def _estimate(self, trajs): + def estimate(self, trajs): """ Parameters ---------- X : tuple of (ttrajs, dtrajs) Simulation trajectories. ttrajs contain the indices of the thermodynamic state and dtrajs contains the indices of the configurational states. - ttrajs : list of numpy.ndarray(X_i, dtype=int) - Every elements is a trajectory (time series). ttrajs[i][t] is the index of the - thermodynamic state visited in trajectory i at time step t. - dtrajs : list of numpy.ndarray(X_i, dtype=int) - dtrajs[i][t] is the index of the configurational state (Markov state) visited in - trajectory i at time step t. + + ttrajs : list of numpy.ndarray(X_i, dtype=int) + Every elements is a trajectory (time series). ttrajs[i][t] is the index of the + thermodynamic state visited in trajectory i at time step t. + dtrajs : list of numpy.ndarray(X_i, dtype=int) + dtrajs[i][t] is the index of the configurational state (Markov state) visited in + trajectory i at time step t. """ + return super(DTRAM, self).estimate(trajs) + + def _estimate(self, trajs): # check input assert isinstance(trajs, (tuple, list)) assert len(trajs) == 2 @@ -207,14 +211,14 @@ def _estimate(self, trajs): # run estimator self.therm_energies, self.conf_energies, self.log_lagrangian_mult, \ - self.increments, self.loglikelihoods = _dtram.estimate( - self.count_matrices, self.bias_energies, - maxiter=self.maxiter, maxerr=self.maxerr, - log_lagrangian_mult=self.log_lagrangian_mult, - conf_energies=self.conf_energies, - save_convergence_info=self.save_convergence_info, - callback=_ConvergenceProgressIndicatorCallBack( - self, 'DTRAM', self.maxiter, self.maxerr)) + self.increments, self.loglikelihoods = _dtram.estimate( + self.count_matrices, self.bias_energies, + maxiter=self.maxiter, maxerr=self.maxerr, + log_lagrangian_mult=self.log_lagrangian_mult, + conf_energies=self.conf_energies, + save_convergence_info=self.save_convergence_info, + callback=_ConvergenceProgressIndicatorCallBack( + self, 'DTRAM', self.maxiter, self.maxerr)) self._progress_force_finish(stage='DTRAM', description='DTRAM') # compute models @@ -242,4 +246,4 @@ def log_likelihood(self): self.bias_energies, self.conf_energies, self.count_matrices, - _np.zeros(shape=self.conf_energies.shape, dtype=_np.float64))) + _np.zeros(shape=self.conf_energies.shape, dtype=_np.float64))) \ No newline at end of file diff --git a/pyemma/thermo/estimators/TRAM_estimator.py b/pyemma/thermo/estimators/TRAM_estimator.py index 6db388e1f..c4f0b6820 100644 --- a/pyemma/thermo/estimators/TRAM_estimator.py +++ b/pyemma/thermo/estimators/TRAM_estimator.py @@ -151,24 +151,28 @@ def __init__( self.log_lagrangian_mult = None self.loglikelihoods = None - def _estimate(self, X): + def estimate(self, X): """ Parameters ---------- X : tuple of (ttrajs, dtrajs, btrajs) Simulation trajectories. ttrajs contain the indices of the thermodynamic state, dtrajs contains the indices of the configurational states and btrajs contain the biases. - ttrajs : list of numpy.ndarray(X_i, dtype=int) - Every elements is a trajectory (time series). ttrajs[i][t] is the index of the - thermodynamic state visited in trajectory i at time step t. - dtrajs : list of numpy.ndarray(X_i, dtype=int) - dtrajs[i][t] is the index of the configurational state (Markov state) visited in - trajectory i at time step t. - btrajs : list of numpy.ndarray((X_i, T), dtype=numpy.float64) - For every simulation frame seen in trajectory i and time step t, btrajs[i][t,k] is the - bias energy of that frame evaluated in the k'th thermodynamic state (i.e. at the k'th - Umbrella/Hamiltonian/temperature). + + ttrajs : list of numpy.ndarray(X_i, dtype=int) + Every elements is a trajectory (time series). ttrajs[i][t] is the index of the + thermodynamic state visited in trajectory i at time step t. + dtrajs : list of numpy.ndarray(X_i, dtype=int) + dtrajs[i][t] is the index of the configurational state (Markov state) visited in + trajectory i at time step t. + btrajs : list of numpy.ndarray((X_i, T), dtype=numpy.float64) + For every simulation frame seen in trajectory i and time step t, btrajs[i][t,k] is the + bias energy of that frame evaluated in the k'th thermodynamic state (i.e. at the k'th + Umbrella/Hamiltonian/temperature). """ + return super(TRAM, self).estimate(trajs) + + def _estimate(self, X): ttrajs, dtrajs_full, btrajs = X # shape and type checks assert len(ttrajs) == len(dtrajs_full) == len(btrajs) diff --git a/pyemma/thermo/estimators/WHAM_estimator.py b/pyemma/thermo/estimators/WHAM_estimator.py index e0dceb0ef..a81d81337 100644 --- a/pyemma/thermo/estimators/WHAM_estimator.py +++ b/pyemma/thermo/estimators/WHAM_estimator.py @@ -108,21 +108,24 @@ def __init__( self.therm_energies = None self.conf_energies = None - def _estimate(self, trajs): - # TODO: fix docstring + def estimate(self, trajs): """ Parameters ---------- X : tuple of (ttrajs, dtrajs) Simulation trajectories. ttrajs contain the indices of the thermodynamic state and dtrajs contains the indices of the configurational states. - ttrajs : list of numpy.ndarray(X_i, dtype=int) - Every elements is a trajectory (time series). ttrajs[i][t] is the index of the - thermodynamic state visited in trajectory i at time step t. - dtrajs : list of numpy.ndarray(X_i, dtype=int) - dtrajs[i][t] is the index of the configurational state (Markov state) visited in - trajectory i at time step t. + + ttrajs : list of numpy.ndarray(X_i, dtype=int) + Every elements is a trajectory (time series). ttrajs[i][t] is the index of the + thermodynamic state visited in trajectory i at time step t. + dtrajs : list of numpy.ndarray(X_i, dtype=int) + dtrajs[i][t] is the index of the configurational state (Markov state) visited in + trajectory i at time step t. """ + return super(WHAM, self).estimate(trajs) + + def _estimate(self, trajs): # check input assert isinstance(trajs, (tuple, list)) assert len(trajs) == 2