Skip to content

Commit 635aacd

Browse files
committed
CLN: Completely remove print_update and replace with logger.
1 parent 1cbd01a commit 635aacd

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):
@@ -318,6 +318,6 @@ def _make_tabular_copy(store, key):
318318
"""Copy the contents nontabular node in a pandas HDFStore
319319
into a tabular node"""
320320
tabular_key = key + '/tabular'
321-
print_update("Making a tabular copy of %s at %s" % (key, tabular_key))
321+
logger.info("Making a tabular copy of %s at %s", (key, tabular_key))
322322
store.append(tabular_key, store.get(key), data_columns=True)
323323
return tabular_key

trackpy/plots.py

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

1112
import numpy as np
1213
import pandas as pd
1314
from pandas import DataFrame, Series
1415

15-
from .utils import print_update
16-
17-
__all__ = ['annotate', 'plot_traj', 'ptraj', 'plot_displacements',
18-
'subpx_bias', 'mass_ecc', 'mass_size']
19-
2016

17+
logger = logging.getLogger(__name__)
2118
__all__ = ['annotate', 'plot_traj', 'ptraj', 'plot_displacements',
2219
'subpx_bias', 'mass_size', 'mass_ecc']
2320

@@ -135,8 +132,8 @@ def plot_traj(traj, colorby='particle', mpp=None, label=False,
135132
x = traj.set_index([t_column, 'particle'])['x'].unstack()
136133
y = traj.set_index([t_column, 'particle'])['y'].unstack()
137134
color_numbers = traj[t_column].values/float(traj[t_column].max())
138-
print_update("Drawing multicolor lines takes awhile. "
139-
"Come back in a minute.")
135+
logger.info("Drawing multicolor lines takes awhile. "
136+
"Come back in a minute.")
140137
for particle in x:
141138
points = np.array(
142139
[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
@@ -180,16 +180,6 @@ def record_meta(meta_data, file_obj):
180180
pass
181181

182182

183-
def print_update(message):
184-
"Print a message immediately; do not wait for current execution to finish."
185-
try:
186-
clear_output()
187-
except Exception:
188-
pass
189-
print(message)
190-
sys.stdout.flush()
191-
192-
193183
class IPythonStreamHandler(logging.StreamHandler):
194184
"A StreamHandler for logging that clears output between entries."
195185
def emit(self, s):

0 commit comments

Comments
 (0)