- Timestamp:
- Aug 1, 2017 11:36:38 AM (7 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:
- 5a8cdbb
- Parents:
- b2c28a5
- Location:
- test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/fileconverter/test/utest_nxcansas_writer.py
rc476457 r248ff73 1 1 from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter 2 from sas.sascalc.dataloader.readers.cansas_reader import Reader as XMLReader 3 from sas.sascalc.dataloader.readers.red2d_reader import Reader as DATReader 4 from sas.sascalc.dataloader.readers.cansas_reader_HDF5 import Reader as HDF5Reader 2 from sas.sascalc.dataloader.loader import Loader 5 3 6 4 import os … … 14 12 15 13 def setUp(self): 14 self.loader = Loader() 16 15 self.writer = NXcanSASWriter() 17 16 self.read_file_1d = "cansas1d.xml" … … 19 18 self.read_file_2d = "exp18_14_igor_2dqxqy.dat" 20 19 self.write_file_2d = "export2d.h5" 21 self.hdf5_reader = HDF5Reader()22 20 23 xml_reader = XMLReader() 24 self.data_1d = xml_reader.read(self.read_file_1d)[0] 21 self.data_1d = self.loader.load(self.read_file_1d)[0] 25 22 26 dat_reader = DATReader() 27 self.data_2d = dat_reader.read(self.read_file_2d) 23 self.data_2d = self.loader.load(self.read_file_2d)[0] 28 24 self.data_2d.detector[0].name = '' 29 25 self.data_2d.source.radiation = 'neutron' … … 31 27 def test_write_1d(self): 32 28 self.writer.write([self.data_1d], self.write_file_1d) 33 data = self. hdf5_reader.read(self.write_file_1d)29 data = self.loader.load(self.write_file_1d) 34 30 self.assertTrue(len(data) == 1) 35 31 data = data[0] … … 41 37 def test_write_2d(self): 42 38 self.writer.write([self.data_2d], self.write_file_2d) 43 data = self. hdf5_reader.read(self.write_file_2d)39 data = self.loader.load(self.write_file_2d) 44 40 self.assertTrue(len(data) == 1) 45 41 data = data[0] -
test/sasdataloader/test/utest_red2d_reader.py
r959eb01 r248ff73 7 7 import unittest 8 8 from sas.sascalc.dataloader.loader import Loader 9 9 10 10 import os.path 11 11 12 12 class abs_reader(unittest.TestCase): 13 13 14 14 def setUp(self): 15 15 self.loader = Loader() 16 16 17 17 def test_checkdata(self): 18 18 """ 19 19 Test .DAT file loaded as IGOR/DAT 2D Q_map 20 20 """ 21 f = self.loader.load("exp18_14_igor_2dqxqy.dat") 21 f = self.loader.load("exp18_14_igor_2dqxqy.dat")[0] 22 22 # The length of the data is 10 23 23 self.assertEqual(len(f.qx_data), 36864) … … 26 26 self.assertEqual(f.Q_unit, '1/A') 27 27 self.assertEqual(f.I_unit, '1/cm') 28 28 29 29 self.assertEqual(f.meta_data['loader'],"IGOR/DAT 2D Q_map") 30 31 30 31 32 32 if __name__ == '__main__': 33 33 unittest.main() 34
Note: See TracChangeset
for help on using the changeset viewer.