Changeset bbc8013 in sasview
- Timestamp:
- Oct 24, 2008 11:36:56 AM (16 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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- e43c012
- Parents:
- 753552d
- Location:
- DataLoader
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/__init__.py
rbb03739 rbbc8013 1 1 from data_info import * 2 from manipulations import * 3 from qsmearing import * 4 from readers import * -
DataLoader/loader.py
r1ed9c57 rbbc8013 2 2 File handler to support different file extensions. 3 3 Uses reflectometry's registry utility. 4 5 The default readers are found in the 'readers' sub-module 6 and registered by default at initialization time. 7 8 To add a new default reader, one must register it in 9 the register_readers method found in readers/__init__.py. 10 11 A utility method (find_plugins) is available to inspect 12 a directory (for instance, a user plug-in directory) and 13 look for new readers/writers. 4 14 """ 5 15 … … 21 31 from zipfile import ZipFile 22 32 33 # Default readers are defined in the readers sub-module 34 import readers 35 23 36 class Registry(ExtensionRegistry): 24 37 """ … … 39 52 self._created = time.time() 40 53 41 # Find internal readers 42 try: 43 cwd = os.path.split(__file__)[0] 44 except: 45 cwd = os.getcwd() 46 logging.error("Registry: could not find the installed reader's directory\n %s" % sys.exc_value) 47 48 dir = os.path.join(cwd, 'readers') 49 n = self.find_plugins(dir) 50 logging.info("Loader found %i readers" % n) 54 # Register default readers 55 readers.register_readers(self._identify_plugin) 51 56 52 57 def find_plugins(self, dir): 53 58 """ 54 Find readers in a given directory 59 Find readers in a given directory. This method 60 can be used to inspect user plug-in directories to 61 find new readers/writers. 55 62 56 63 @param dir: directory to search into … … 58 65 """ 59 66 readers_found = 0 67 68 # Check whether the directory exists 69 if not os.path.isdir(dir): 70 logging.warning("DataLoader couldn't load from %s" % dir) 71 return readers_found 72 60 73 for item in os.listdir(dir): 61 74 full_path = os.path.join(dir, item) -
DataLoader/readers/__init__.py
rbb03739 rbbc8013 1 import abs_reader 2 import cansas_reader 3 import ascii_reader 4 import cansas_reader 5 import danse_reader 6 import hfir1d_reader 7 import IgorReader 8 import tiff_reader 9 10 def register_readers(registry_function): 11 """ 12 Function called by the registry/loader object to register 13 all default readers using a call back function. 14 15 @param registry_function: function to be called to register each reader 16 """ 17 registry_function(abs_reader) 18 registry_function(cansas_reader) 19 registry_function(ascii_reader) 20 registry_function(cansas_reader) 21 registry_function(danse_reader) 22 registry_function(hfir1d_reader) 23 registry_function(IgorReader) 24 registry_function(tiff_reader) 25 -
DataLoader/test/write_test.xml
rbee885e rbbc8013 1 1 <?xml version="1.0" ?> 2 <SASroot version="1.0" >2 <SASroot version="1.0" xmlns="cansas1d/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="cansas1d/1.0 http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd"> 3 3 <SASentry> 4 4 <Title> 5 5 Test title 6 6 </Title> 7 <Run name="run name">7 <Run> 8 8 1234 9 9 </Run>
Note: See TracChangeset
for help on using the changeset viewer.