Changeset 158cb9e in sasview
- Timestamp:
- Sep 15, 2016 8:33:57 AM (8 years ago)
- Branches:
- 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
- Children:
- 90d389d
- Parents:
- a40be8c
- git-author:
- Jeff Krzywon <krzywon@…> (08/18/16 15:33:37)
- git-committer:
- Piotr Rozyczko <rozyczko@…> (09/15/16 08:33:57)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/cansas_reader.py
ra40be8c r158cb9e 192 192 """ 193 193 194 frm = inspect.stack()[1] 195 if not self._is_call_local(frm): 196 self.reset_state() 197 self.add_data_set() 198 self.names.append("SASentry") 199 self.parent_class = "SASentry" 194 200 self._check_for_empty_data() 195 201 self.base_ns = "{0}{1}{2}".format("{", \ … … 244 250 elif tagname == 'dQl': 245 251 self.current_dataset.dxl = np.append(self.current_dataset.dxl, data_point) 252 elif tagname == 'Qmean': 253 pass 254 elif tagname == 'Shadowfactor': 255 pass 246 256 247 257 ## Sample Information … … 409 419 length = len(self.names) - 1 410 420 self.parent_class = self.names[length] 411 421 if not self._is_call_local(frm): 422 self.add_data_set() 423 empty = None 424 if self.output[0].dx is not None: 425 self.output[0].dxl = np.empty(0) 426 self.output[0].dxw = np.empty(0) 427 else: 428 self.output[0].dx = np.empty(0) 429 return self.output[0], empty 430 431 432 def _is_call_local(self, frm=""): 433 """ 434 435 :return: 436 """ 437 if frm == "": 438 frm = inspect.stack()[1] 439 mod_name = frm[1].replace("\\", "/").replace(".pyc", "") 440 mod_name = mod_name.replace(".py", "") 441 mod = mod_name.split("sas/") 442 mod_name = mod[1] 443 if mod_name != "sascalc/dataloader/readers/cansas_reader": 444 return False 445 return True 412 446 413 447 def is_cansas(self, ext="xml"): … … 1148 1182 self.write_node(node, "description", item.description) 1149 1183 for term in item.term: 1150 value = term['value'] 1151 del term['value'] 1184 if isinstance(term, list): 1185 value = term['value'] 1186 del term['value'] 1187 else: 1188 value = term 1152 1189 self.write_node(node, "term", value, term) 1153 1190 for note in item.notes: -
test/sasdataloader/test/utest_cansas.py
ra40be8c r158cb9e 176 176 data = list[0] 177 177 self.assertTrue(data.x.size == 2) 178 self.assertTrue(len(data.meta_data) == 3)178 self.assertTrue(len(data.meta_data) == 2) 179 179 self.assertTrue(len(data.errors) == 1) 180 180 self.assertTrue(data.detector[0].distance_unit == "mm")
Note: See TracChangeset
for help on using the changeset viewer.