Changeset 0a5c8f5 in sasview for sansdataloader/src/sans
- Timestamp:
- Feb 7, 2012 10:55:23 AM (13 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:
- 9cd0baa
- Parents:
- e7e1fdd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansdataloader/src/sans/dataloader/readers/cansas_reader.py
raac129aa r0a5c8f5 46 46 47 47 CANSAS_NS = "cansas1d/1.0" 48 allow_all = True 48 49 49 50 def write_node(doc, parent, name, value, attr={}): … … 146 147 basename = os.path.basename(path) 147 148 root, extension = os.path.splitext(basename) 148 if extension.lower() in self.ext: 149 150 tree = etree.parse(path, parser=etree.ETCompatXMLParser()) 151 # Check the format version number 152 # Specifying the namespace will take care of the file 153 # format version 154 root = tree.getroot() 155 156 entry_list = root.xpath('/ns:SASroot/ns:SASentry', 157 namespaces={'ns': CANSAS_NS}) 158 159 for entry in entry_list: 160 self.errors = [] 161 sas_entry = self._parse_entry(entry) 162 sas_entry.filename = basename 149 if allow_all or extension.lower() in self.ext: 150 try: 151 tree = etree.parse(path, parser=etree.ETCompatXMLParser()) 152 # Check the format version number 153 # Specifying the namespace will take care of the file 154 # format version 155 root = tree.getroot() 163 156 164 # Store loading process information 165 sas_entry.errors = self.errors 166 sas_entry.meta_data['loader'] = self.type_name 167 output.append(sas_entry) 168 157 entry_list = root.xpath('/ns:SASroot/ns:SASentry', 158 namespaces={'ns': CANSAS_NS}) 159 160 for entry in entry_list: 161 self.errors = [] 162 sas_entry = self._parse_entry(entry) 163 sas_entry.filename = basename 164 165 # Store loading process information 166 sas_entry.errors = self.errors 167 sas_entry.meta_data['loader'] = self.type_name 168 output.append(sas_entry) 169 except: 170 raise RuntimeError, "%s cannot be read \n" % path 169 171 else: 170 172 raise RuntimeError, "%s is not a file" % path
Note: See TracChangeset
for help on using the changeset viewer.