Exemplo n.º 1
0
 def setDataFromFile(self, filename, tag, uid=None, display=True):
     """Load data array from file and dispatch to live widgets using
     ``setData``. Do not use caching if uid is ``None``.
     """
     try:
         array = ReaderRegistry.getReaderCls(tag).fromfile(filename)
     except KeyError:
         raise NicosError('Unsupported fileformat %r' % tag)
     if array is not None:
         self.setData(array, uid, display=display)
     else:
         raise NicosError('Cannot read file %r' % filename)
Exemplo n.º 2
0
def readDataFromFile(filename, filetype):
    try:
        return ReaderRegistry.getReaderCls(filetype).fromfile(filename)
    except KeyError:
        raise NicosError('Unsupported file format %r' % filetype) from None