Skip to content

Commit

Permalink
func_name support for python 3.0 added in xvg.py (#184)
Browse files Browse the repository at this point in the history
* fix #183 
* gromacs/fileformats/xvg.py: func_name support for python 3.0 added
* AUTHORS and CHANGES updated
  • Loading branch information
PolyachenkoYA authored Jul 29, 2020
1 parent aef6357 commit de73d84
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ year of their first commit. GitHub handle is optional.

- Thomas Heavey (@theavey)
- Andrej Berg (@andrejberg)

2020
----

- Yury Polyachenko (@polyachenkoya)

We gratefully acknowledge code fixes contributed by
@quantifiedcode-bot from Quantified Code https://www.quantifiedcode.com
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
CHANGELOG for GromacsWrapper
==============================

2020-xx-xx 0.8.1

* fixed: xvg._decimate used python-2.0-specific func_name()

2019-xx-xx 0.8.1
orbeckst

Expand Down
6 changes: 5 additions & 1 deletion gromacs/fileformats/xvg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,9 +1079,13 @@ def _decimate(self, func, a, maxpoints, **kwargs):
out[i], out[0] = func(t, a[i], bins=maxpoints, **kwargs)

if maxpoints == self.maxpoints_default: # only warn if user did not set maxpoints
try:
funcname = func.func_name # Python 2
except AttributeError:
funcname = func.__name__ # Python 3
warnings.warn("Plot had %d datapoints > maxpoints = %d; decimated to %d regularly "
"spaced points from the histogrammed data with %s()."
% (ny, maxpoints, maxpoints, func.func_name),
% (ny, maxpoints, maxpoints, funcname),
category=AutoCorrectionWarning)
return out

Expand Down

0 comments on commit de73d84

Please sign in to comment.