markovmodel / PyEMMA

🚂 Python API for Emma's Markov Model Algorithms 🚂
http://pyemma.org
GNU Lesser General Public License v3.0
311 stars 119 forks source link

Error on get_multiple_temperature_data() #1101

Closed rafwiewiora closed 7 years ago

rafwiewiora commented 7 years ago

You guys know this already, but just for reference - Py3 error from the workshop:

In [2]: from pyemma.datasets import get_multi_temperature_data, get_umbrella_sampling_data

In [3]: mt_data = get_multi_temperature_data()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-959ba897a85c> in <module>()
----> 1 mt_data = get_multi_temperature_data()

/cbio/jclab/home/rafal.wiewiora/anaconda3/lib/python3.6/site-packages/pyemma/datasets/api.py in get_multi_temperature_data(kt0, kt1, length0, length1, n0, n1)
    110         given in kT, lengths in arbitrary units.
    111     '''
--> 112     dws = _DWS()
    113     mt_data = dws.mt_sample(
    114         kt0=kt0, kt1=kt1, length0=length0, length1=length1, n0=n0, n1=n1)

/cbio/jclab/home/rafal.wiewiora/anaconda3/lib/python3.6/site-packages/pyemma/datasets/double_well_thermo.py in __init__(self)
     35         edges = _np.linspace(self.xmin, self.xmax, self.nstates + 1)
     36         self.x = 0.5 * (edges[1:] + edges[:-1])
---> 37         epot = self.potential(self.x)
     38         self.pi = _np.exp(-epot)
     39         self.pi[:] = self.pi / self.pi.sum()

/cbio/jclab/home/rafal.wiewiora/anaconda3/lib/python3.6/site-packages/pyemma/datasets/double_well_thermo.py in potential(self, x, kt, kbias, xbias)
     55             return 0.0
     56     def potential(self, x, kt=1.0, kbias=None, xbias=None):
---> 57         return (self._potential(x) + self._bias(x, kbias, xbias)) / kt
     58     def mcmc(self, xinit, length, kt=1.0, kbias=None, xbias=None, stride=None):
     59         xtraj = _np.zeros(shape=(length + 1,), dtype=_np.float64)

TypeError: unsupported operand type(s) for +: 'map' and 'float'
marscher commented 7 years ago

the map function needs to be wrapped in a list or tuple in Python3.