Skip to content

Commit

Permalink
Fixed python2 --> 3 issues with float vs integer division and str vs
Browse files Browse the repository at this point in the history
byte types
  • Loading branch information
ryanslynch authored and scottransom committed Nov 12, 2019
1 parent 2ee0e66 commit 0180640
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bin/pyplotres.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def get_xdata(self, key):
"""Return label describing xaxis and the corresponding
data given keyword 'key'.
"""
if not isinstance(key, bytes):
if not (isinstance(key, bytes) or isinstance(key, str)):
raise ValueError("key must be of type string.")
xopt = key.lower()
if xopt == 'numtoa':
Expand All @@ -228,7 +228,7 @@ def get_ydata(self, key, postfit=True):
'postfit' is a boolean argument that determines if
postfit, or prefit data is to be returned.
"""
if not isinstance(key, bytes):
if not (isinstance(key, bytes) or isinstance(key, str)):
raise ValueError("key must be of type string.")
yopt = key.lower()
if postfit:
Expand Down
2 changes: 1 addition & 1 deletion lib/python/residuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def read_residuals(filename="resid2.tmp"):
not (reclen==struct.calcsize(rectype))):
print("Warning: possibly reading residuals incorrectly... don't understand record size")
infile.seek(0, 0) # position at file start
r.numTOAs = filelen / reclen
r.numTOAs = int(filelen / reclen)
r.bary_TOA = Num.zeros(r.numTOAs, 'd')
r.postfit_phs = Num.zeros(r.numTOAs, 'd')
r.postfit_sec = Num.zeros(r.numTOAs, 'd')
Expand Down

0 comments on commit 0180640

Please sign in to comment.