- Timestamp:
- Jan 14, 2014 3:53:36 PM (11 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:
- 16bd5ca
- Parents:
- 083e993
- Location:
- test/sansdataloader/test
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/sansdataloader/test/utest_cansas.py
r3f484b0 r76cd1ae 38 38 self.isis_1_1 = "ISIS_1_1.xml" 39 39 self.isis_1_1_notrans = "ISIS_1_1_notrans.xml" 40 self.isis_1_1_doubletrans = "ISIS_1_1_doubletrans.xml" 40 41 self.schema_1_0 = "cansas1d_v1_0.xsd" 41 42 self.schema_1_1 = "cansas1d_v1_1.xsd" … … 77 78 self.assertFalse(valid) 78 79 80 81 def _check_data(self, data): 82 self.assertTrue(data.title == "TK49 c10_SANS") 83 self.assertTrue(data.x.size == 138) 84 self.assertTrue(len(data.meta_data) == 2) 85 self.assertTrue(data.detector[0].distance_unit == "mm") 86 self.assertTrue(data.detector[1].distance_unit == "mm") 87 self.assertTrue(data.detector[0].name == "HAB") 88 self.assertTrue(data.detector[1].name == "main-detector-bank") 89 self.assertTrue(data.detector[0].distance == 575.0) 90 self.assertTrue(data.detector[1].distance == 4145.02) 91 spectrum = data.trans_spectrum[0] 92 self.assertTrue(len(spectrum.wavelength) == 138) 93 self.assertTrue(data.process[0].name == "Mantid generated CanSAS1D XML") 94 79 95 80 96 def test_cansas_xml(self): … … 83 99 valid = xmlreader.validateXML() 84 100 self.assertTrue(valid) 85 reader = Reader()86 dataloader = reader .read(self.isis_1_1)87 for data in dataloader:88 self.assertTrue(data.title == "TK49 c10_SANS")89 self.assertTrue(data.x.size == 138)90 self. assertTrue(len(data.meta_data) == 2)91 self. assertTrue(data.detector[0].distance_unit == "mm")92 reader .write(filename, data)101 reader_generic = Loader() 102 dataloader = reader_generic.load(self.isis_1_1) 103 reader_cansas = Reader() 104 cansasreader = reader_cansas.read(self.isis_1_1) 105 for i in range(len(dataloader)): 106 self._check_data(dataloader[i]) 107 self._check_data(cansasreader[i]) 108 reader_generic.save(filename, dataloader[i], None) 93 109 reader2 = Reader() 94 110 return_data = reader2.read(filename) 95 111 data_new = return_data 96 self.data = return_data[0] 97 self.assertTrue(self.data.x.size == 138) 98 self.assertTrue(len(self.data.meta_data) == 2) 99 self.assertTrue(self.data.detector[0].distance_unit == "mm") 100 self.assertTrue(self.data.title == "TK49 c10_SANS") 112 written_data = return_data[0] 113 self._check_data(written_data) 114 115 116 def test_double_trans_spectra(self): 117 xmlreader = XMLreader(self.isis_1_1_doubletrans, self.schema_1_1) 118 self.assertTrue(xmlreader.validateXML()) 119 reader = Loader() 120 data = reader.load(self.isis_1_1_doubletrans) 121 for item in data: 122 self._check_data(item) 123 101 124 102 125 def test_entry_name_recurse(self):
Note: See TracChangeset
for help on using the changeset viewer.