Changeset b9b612a in sasview for src/sas/sascalc/dataloader
- Timestamp:
- Mar 17, 2017 8:51:44 AM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 270c882b, c721b1a
- Parents:
- 62b9793
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/loader.py
r62b9793 rb9b612a 62 62 of a particular reader 63 63 64 Defaults to the ascii (multi-column) reader 65 if no reader was registered for the file's 66 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. 67 66 """ 68 67 try: 69 68 return super(Registry, self).load(path, format=format) 70 except: 71 try: 72 # No reader was found. Default to the ascii reader. 73 ascii_loader = ascii_reader.Reader() 74 return ascii_loader.read(path) 75 except: 76 try: 77 cansas_loader = cansas_reader.Reader() 78 return cansas_loader.read(path) 79 except: 80 try: 81 cansas_nexus_loader = cansas_reader_HDF5.Reader() 82 return cansas_nexus_loader.read(path) 83 except: 84 msg = "\n\tUnknown data format: %s.\n" % path 85 msg += "\tThe file is not a known format for SasView. " 86 msg += "The most common formats are multi-column " 87 msg += "ASCII, CanSAS XML, andCanSAS NeXuS." 88 raise Exception(msg) 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) 89 90 90 91 def find_plugins(self, dir):
Note: See TracChangeset
for help on using the changeset viewer.