Skip to content

Commit

Permalink
fixes #44
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Jan 30, 2016
1 parent bf4b294 commit 3b876bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ Change History
Production
**********

:2015.1221.1: added versioneer support (issue #40)
:2015.1221.0: read scans with repeated scan numbers (issue #39)
:2016.0130.0: fixed `issue #44 <https://github.com/prjemian/spec2nexus/issues/44>`_
:2015.1221.1: added versioneer support (`issue #40 <https://github.com/prjemian/spec2nexus/issues/40>`_)
:2015.1221.0: read scans with repeated scan numbers (`issue #39 <https://github.com/prjemian/spec2nexus/issues/39>`_)
:2015.0822.0: extractSpecScan: add option to report scan heading data, such as positioners and Q
:2015.0214.0: h5toText: handle HDF5 'O' data type (variable length strings)
:2015.0127.0: spec: ignore bad data lines
Expand Down
14 changes: 8 additions & 6 deletions src/spec2nexus/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,21 +284,23 @@ def getScan(self, scan_number=0):
return None

def getScanNumbers(self):
'''return a list of all scan numbers'''
return self.scans.keys()
'''return a sorted list of all scan numbers'''
def my_cmp(x, y):
return cmp(float(x), float(y))
return sorted(self.scans.keys(), my_cmp)

def getMinScanNumber(self):
'''return the lowest numbered scan'''
return min(self.getScanNumbers())
return self.getScanNumbers()[0]

def getMaxScanNumber(self):
'''return the highest numbered scan'''
return max(self.getScanNumbers())
return self.getScanNumbers()[-1]

def getScanCommands(self, scan_list=None):
'''return all the scan commands as a list, with scan number'''
if scan_list is None:
scan_list = sorted(self.getScanNumbers())
scan_list = self.getScanNumbers()
return ['#S ' + str(key) + ' ' + self.scans[key].scanCmd for key in scan_list if key in self.scans]


Expand Down Expand Up @@ -440,7 +442,7 @@ def interpret(self):
key = self.parent.plugin_manager.getKey(line.lstrip())
if key is None:
__s__ = '<' + line + '>'
_msg = "scan %d, line %d: unknown key, ignored text: %s" % (self.scanNum, i, line)
_msg = "scan %s, line %d: unknown key, ignored text: %s" % (str(self.scanNum), i, line)
#raise UnknownSpecFilePart(_msg)
elif key != '#S': # avoid recursion
# most of the work is done here
Expand Down

0 comments on commit 3b876bf

Please sign in to comment.