- Timestamp:
- Nov 7, 2017 1:21:18 PM (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
- File:
-
- 1 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()
Note: See TracChangeset
for help on using the changeset viewer.