Changes in / [26c9b85:c721b1a] in sasview


Ignore:
Location:
src/sas/sascalc/dataloader
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/loader.py

    rb699768 rb9b612a  
    3131from readers import ascii_reader 
    3232from readers import cansas_reader 
     33from readers import cansas_reader_HDF5 
    3334 
    3435class Registry(ExtensionRegistry): 
     
    6162            of a particular reader 
    6263 
    63         Defaults to the ascii (multi-column) reader 
    64         if no reader was registered for the file's 
    65         extension. 
     64        Defaults to the ascii (multi-column), cansas XML, and cansas NeXuS 
     65        readers if no reader was registered for the file's extension. 
    6666        """ 
    6767        try: 
    6868            return super(Registry, self).load(path, format=format) 
    69         except: 
    70             try: 
    71                 # No reader was found. Default to the ascii reader. 
    72                 ascii_loader = ascii_reader.Reader() 
    73                 return ascii_loader.read(path) 
    74             except: 
    75                 cansas_loader = cansas_reader.Reader() 
    76                 return cansas_loader.read(path) 
     69        except Exception: 
     70            pass # try the ASCII reader 
     71        try: 
     72            ascii_loader = ascii_reader.Reader() 
     73            return ascii_loader.read(path) 
     74        except Exception: 
     75            pass # try the cansas XML reader 
     76        try: 
     77            cansas_loader = cansas_reader.Reader() 
     78            return cansas_loader.read(path) 
     79        except Exception: 
     80            pass # try the cansas NeXuS reader 
     81        try: 
     82            cansas_nexus_loader = cansas_reader_HDF5.Reader() 
     83            return cansas_nexus_loader.read(path) 
     84        except Exception: 
     85            # No known reader available. Give up and throw an error 
     86            msg = "\n\tUnknown data format: %s.\n\tThe file is not a " % path 
     87            msg += "known format for SasView. The most common formats are " 
     88            msg += "multi-column ASCII, CanSAS XML, and CanSAS NeXuS." 
     89            raise Exception(msg) 
    7790 
    7891    def find_plugins(self, dir): 
  • src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py

    rbbd0f37 rd0764bf  
    5353    ext = ['.h5', '.H5'] 
    5454    ## Flag to bypass extension check 
    55     allow_all = False 
     55    allow_all = True 
    5656    ## List of files to return 
    5757    output = None 
Note: See TracChangeset for help on using the changeset viewer.