Skip to content

Commit 5b07749

Browse files
committed
CLN: Completely remove print_update and replace with logger.
1 parent eca38fc commit 5b07749

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

trackpy/framewise_data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
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+
logger = logging.getLogger(__name__)
1011

1112

1213
class FramewiseData(object):
@@ -316,6 +317,6 @@ def _make_tabular_copy(store, key):
316317
"""Copy the contents nontabular node in a pandas HDFStore
317318
into a tabular node"""
318319
tabular_key = key + '/tabular'
319-
print_update("Making a tabular copy of %s at %s" % (key, tabular_key))
320+
logger.info("Making a tabular copy of %s at %s", (key, tabular_key))
320321
store.append(tabular_key, store.get(key), data_columns=True)
321322
return tabular_key

trackpy/plots.py

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

1112
import numpy as np
1213

@@ -17,17 +18,14 @@
1718
plots_to_frame = None
1819
normalize = None
1920

20-
from .utils import print_update
21-
22-
__all__ = ['annotate', 'plot_traj', 'ptraj', 'plot_displacements',
23-
'subpx_bias', 'mass_ecc', 'mass_size']
24-
2521

2622
__all__ = ['annotate', 'scatter', 'plot_traj', 'ptraj',
2723
'annotate3d', 'scatter3d', 'plot_traj3d', 'ptraj3d',
2824
'plot_displacements', 'subpx_bias', 'mass_size', 'mass_ecc',
2925
'plot_density_profile']
3026

27+
logger = logging.getLogger(__name__)
28+
3129

3230
def make_axes(func):
3331
"""
@@ -301,8 +299,8 @@ def plot_traj(traj, colorby='particle', mpp=None, label=False,
301299
x = traj.set_index([t_column, 'particle'])['x'].unstack()
302300
y = traj.set_index([t_column, 'particle'])['y'].unstack()
303301
color_numbers = traj[t_column].values/float(traj[t_column].max())
304-
print_update("Drawing multicolor lines takes awhile. "
305-
"Come back in a minute.")
302+
logger.info("Drawing multicolor lines takes awhile. "
303+
"Come back in a minute.")
306304
for particle in x:
307305
points = np.array(
308306
[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
def make_pandas_strict():
203193
"""Configure Pandas to raise an exception for "chained assignments."
204194

0 commit comments

Comments
 (0)