insilichem / ommprotocol

A command line application to launch molecular dynamics simulations with OpenMM
http://ommprotocol.readthedocs.io
GNU Lesser General Public License v3.0
39 stars 8 forks source link

TypeError: unsupported operand type(s) for +: 'int' and 'Timedelta' #23

Open AliothYh opened 4 months ago

AliothYh commented 4 months ago

Traceback (most recent call last): File "D:\science_tech\Code_git_clone\besttracks\mytest.py", line 7, in print(TCs_CMA) File "D:\science_tech\Code_git_clone\besttracks\besttracks\core.py", line 683, in repr max(yrs), self.total_duration())) File "D:\science_tech\Code_git_clone\besttracks\besttracks\core.py", line 521, in total_duration return sum([p.duration() for p in self.particles]) TypeError: unsupported operand type(s) for +: 'int' and 'Timedelta'

def total_duration(self): """ Get total duration of this ParticleSet in unit of days. """ return sum([p.duration() for p in self.particles])

def duration(self): """ Get duration (days) of this particle.

    Returns
    ----------
    re: float
        Duration of this particle in unit of day
    """
    duration = np.ptp(self.records['TIME'])
    return pd.to_timedelta([duration]).astype('timedelta64[h]')[0] / 24.0