Changeset f926abb in sasview
- Timestamp:
- Nov 7, 2017 11:21:18 AM (7 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 7e82256
- Parents:
- 54b0650
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/sas_gen.py
r54b0650 rf926abb 1057 1057 reader = SLDReader() 1058 1058 oreader = OMFReader() 1059 output = decode(reader.read(tfpath))1060 ooutput = decode(oreader.read(ofpath))1059 output = reader.read(tfpath) 1060 ooutput = oreader.read(ofpath) 1061 1061 foutput = OMF2SLD() 1062 1062 foutput.set_data(ooutput) … … 1087 1087 plt.show() 1088 1088 1089 def test(): 1090 """ 1091 Test code 1092 """ 1089 def test_save(): 1093 1090 ofpath = _get_data_path("coordinate_data", "A_Raw_Example-1.omf") 1094 1091 if not os.path.isfile(ofpath): 1095 1092 raise ValueError("file(s) not found: %r"%(ofpath,)) 1096 1093 oreader = OMFReader() 1097 o output = decode(oreader.read(ofpath))1098 foutput= OMF2SLD()1099 foutput.set_data(ooutput)1094 omfdata = oreader.read(ofpath) 1095 omf2sld = OMF2SLD() 1096 omf2sld.set_data(omfdata) 1100 1097 writer = SLDReader() 1101 writer.write("out.txt", foutput.output) 1098 writer.write("out.txt", omf2sld.output) 1099 1100 def test(): 1101 """ 1102 Test code 1103 """ 1104 ofpath = _get_data_path("coordinate_data", "A_Raw_Example-1.omf") 1105 if not os.path.isfile(ofpath): 1106 raise ValueError("file(s) not found: %r"%(ofpath,)) 1107 oreader = OMFReader() 1108 omfdata = oreader.read(ofpath) 1109 omf2sld = OMF2SLD() 1110 omf2sld.set_data(omfdata) 1102 1111 model = GenSAS() 1103 model.set_sld_data(foutput.output) 1104 x = np.arange(1000)/10000. + 1e-5 1105 y = np.arange(1000)/10000. + 1e-5 1106 i = np.zeros(1000) 1107 model.runXY([x, y, i]) 1112 model.set_sld_data(omf2sld.output) 1113 x = np.linspace(0, 0.1, 11)[1:] 1114 model.runXY([x, x]) 1108 1115 1109 1116 if __name__ == "__main__": 1110 1117 #test_load() 1118 #test_save() 1111 1119 test() -
test/sascalculator/test/utest_sas_gen.py
r1d014cb rf926abb 6 6 7 7 import unittest 8 import numpy as np 9 8 10 from sas.sascalc.calculator import sas_gen 9 11 … … 48 50 self.assertEqual(output.pos_z[0], 0.0) 49 51 52 def test_calculator(self): 53 """ 54 Test that the calculator calculates. 55 """ 56 f = self.omfloader.read("A_Raw_Example-1.omf") 57 omf2sld = sas_gen.OMF2SLD() 58 omf2sld.set_data(f) 59 model = sas_gen.GenSAS() 60 model.set_sld_data(omf2sld.output) 61 x = np.linspace(0, 0.1, 11)[1:] 62 model.runXY([x, x]) 63 50 64 51 65 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.