Skip to content

Commit 3248a72

Browse files
committed
CLN: Completely remove print_update and replace with logger.
1 parent 92ff98f commit 3248a72

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

trackpy/framewise_data.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33
import six
4+
import logging
45
import os
56
from abc import ABCMeta, abstractmethod, abstractproperty
67

78
import pandas as pd
89

9-
from .utils import print_update
10-
11-
__all__ = ['PandasHDFStore', 'PandasHDFStoreBig', 'PandasHDFStoreSingleNode',
12-
'FramewiseData']
10+
logger = logging.getLogger(__name__)
11+
__all__ = ['FramewiseData', 'PandasHDFStore', 'PandasHDFStoreBig',
12+
'PandasHDFStoreSingleNode']
1313

1414

1515
class FramewiseData(object):
@@ -319,6 +319,6 @@ def _make_tabular_copy(store, key):
319319
"""Copy the contents nontabular node in a pandas HDFStore
320320
into a tabular node"""
321321
tabular_key = key + '/tabular'
322-
print_update("Making a tabular copy of %s at %s" % (key, tabular_key))
322+
logger.info("Making a tabular copy of %s at %s", (key, tabular_key))
323323
store.append(tabular_key, store.get(key), data_columns=True)
324324
return tabular_key

trackpy/plots.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@
77
from collections import Iterable
88
from functools import wraps
99
import warnings
10+
import logging
1011

1112
import numpy as np
1213

13-
from .utils import print_update
14-
15-
__all__ = ['annotate', 'plot_traj', 'ptraj', 'plot_displacements',
16-
'subpx_bias', 'mass_ecc', 'mass_size']
17-
1814

15+
logger = logging.getLogger(__name__)
1916
__all__ = ['annotate', 'plot_traj', 'ptraj', 'plot_displacements',
2017
'subpx_bias', 'mass_size', 'mass_ecc']
2118

@@ -131,8 +128,8 @@ def plot_traj(traj, colorby='particle', mpp=None, label=False,
131128
x = traj.set_index([t_column, 'particle'])['x'].unstack()
132129
y = traj.set_index([t_column, 'particle'])['y'].unstack()
133130
color_numbers = traj[t_column].values/float(traj[t_column].max())
134-
print_update("Drawing multicolor lines takes awhile. "
135-
"Come back in a minute.")
131+
logger.info("Drawing multicolor lines takes awhile. "
132+
"Come back in a minute.")
136133
for particle in x:
137134
points = np.array(
138135
[x[particle].values, y[particle].values]).T.reshape(-1, 1, 2)

trackpy/utils.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,6 @@ def validate_tuple(value, ndim):
189189
pass
190190

191191

192-
def print_update(message):
193-
"Print a message immediately; do not wait for current execution to finish."
194-
try:
195-
clear_output()
196-
except Exception:
197-
pass
198-
print(message)
199-
sys.stdout.flush()
200-
201-
202192
class IPythonStreamHandler(logging.StreamHandler):
203193
"A StreamHandler for logging that clears output between entries."
204194
def emit(self, s):

0 commit comments

Comments
 (0)