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)
def readDataFromFile(filename, filetype): try: return ReaderRegistry.getReaderCls(filetype).fromfile(filename) except KeyError: raise NicosError('Unsupported file format %r' % filetype) from None