Пример #1
0
 def Refresh(self):
     """
     Reload the spectrum from disk
     """
     try:
         os.path.exists(self.filename)
     except OSError:
         hdtv.ui.warning("File %s not found, keeping previous data" %
                         self.filename)
         return
     # call to SpecReader to get the hist
     try:
         hist = SpecReader.GetSpectrum(self.filename, self.fmt)
     except SpecReaderError as msg:
         hdtv.ui.warning(
             "Failed to load spectrum: %s (file: %s), keeping previous data"
             % (msg, self.filename))
         return
     self.hist = hist
Пример #2
0
 def __init__(self, fname, fmt=None, color=hdtv.color.default, cal=None):
     """
     Read a spectrum from file
     """
     # check if file exists
     try:
         os.path.exists(fname)
     except OSError:
         hdtv.ui.error("File %s not found" % fname)
         raise
     # call to SpecReader to get the hist
     try:
         hist = SpecReader.GetSpectrum(fname, fmt)
     except SpecReaderError as msg:
         hdtv.ui.error(str(msg))
         raise
     self.fmt = fmt
     self.filename = fname
     Histogram.__init__(self, hist, color, cal)
     self.typeStr = "spectrum, read from file"