Changeset 626
- Timestamp:
- Jan 30, 2010 12:44:03 AM (12 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Common/NIST_XML_v40.ipf
r625 r626 900 900 End 901 901 902 Function WriteNSORTedXMLFile(qw,iw,sw,firstFileName,secondFileName,thirdFileName,normTo,norm12,norm23,[res]) 903 Wave qw,iw,sw,res 904 String firstFileName,secondFileName,thirdFileName,normTo 905 Variable norm12,norm23 906 907 Variable err=0,refNum,numCols 908 String fullPath="",formatStr="" 909 //check each wave - else REALLY FATAL error when writing file 910 If(!(WaveExists(qw))) 911 err = 1 912 return err 913 Endif 914 If(!(WaveExists(iw))) 915 err = 1 916 return err 917 Endif 918 If(!(WaveExists(sw))) 919 err = 1 920 return err 921 Endif 922 923 if(WaveExists(res)) 924 numCols = 6 925 else 926 numCols = 3 927 endif 928 929 Variable dialog = 1 930 if(dialog) 931 PathInfo/S catPathName 932 fullPath = DoSaveFileDialog("Save data as") //won't actually open the file 933 If(cmpstr(fullPath,"")==0) 934 //user cancel, don't write out a file 935 Close/A 936 Abort "no data file was written" 937 Endif 938 //Print "dialog fullpath = ",fullpath 939 Endif 940 941 Struct NISTxmlfile nf 942 943 //Data 944 Wave nf.Q = qw 945 nf.unitsQ = "1/A" 946 Wave nf.I = iw 947 nf.unitsI = "1/cm" 948 Wave nf.Idev = sw 949 nf.unitsIdev = "1/cm" 950 951 //write out the standard header information 952 //fprintf refnum,"FILE: %s\t\t CREATED: %s\r\n",textw[0],textw[1] 953 954 //AJJ to fix with sensible values 955 nf.run = "" 956 nf.nameSASinstrument = "NIST IGOR" 957 nf.SASnote = "" 958 // 959 nf.sample_ID = ParseFilePath(3, fullPath, ":", 0, 0) 960 nf.title = ParseFilePath(3, fullPath, ":", 0, 0) 961 nf.radiation = "neutron" 962 //Do something with beamstop (rw[21]) 963 nf.detector_name = "NSORTed Data" 964 nf.nameSASProcess = "NIST IGOR" 965 966 nf.sasProcessNote = "COMBINED FILE CREATED: "+date()+"\n" 967 nf.sasProcessNote += "NSORT-ed : " +firstFileName+";"+secondFileName+";"+thirdFileName+"\n" 968 nf.sasProcessNote += "normalized to "+normTo+"\n" 969 fprintf refNum, "multiplicative factor 1-2 = "+num2str(norm12)+" multiplicative factor 2-3 = "+num2str(norm23)+"\n" 970 971 if (numCols == 3) 972 writeNISTXML(fullpath,nf) 973 elseif (numCols == 6) 974 Make/O/N=(dimsize(res,0)) sigq = res[p][0] 975 Make/O/N=(dimsize(res,0)) qbar = res[p][1] 976 Make/O/N=(dimsize(res,0)) fs = res[p][2] 977 978 Wave nf.Qdev = sigQ 979 nf.unitsQdev = "1/A" 980 Wave nf.Qmean = qbar 981 nf.unitsQmean = "1/A" 982 Wave nf.Shadowfactor = fs 983 nf.unitsShadowfactor = "none" 984 985 writeNISTXML(fullpath,nf) 986 987 Killwaves/Z sigq,qbar,fs 988 endif 989 990 Return err 991 End 992 993 994 995 996 997 End 998 902 999 /// See WriteModelData_v40.ipf for 6 column equivalent 903 1000 Function ReWrite1DXMLData(folderStr) … … 1018 1115 return(-6) 1019 1116 end 1117 1118 Function WriteNSORTedXMLFile(q3,i3,sig3,firstFileName,secondFileName,thirdFileName,normTo,norm12,norm23,[res]) 1119 Wave q3,i3,sig3,res 1120 String firstFileName,secondFileName,thirdFileName,normTo 1121 Variable norm12,norm23 1122 1123 Abort "XML function provided by XMLutils XOP is not available, get the XOP from : http://www.igorexchange.com/project/XMLutils (see http://www.smallangles.net/wgwiki/index.php/cansas1d_binding_IgorPro for details)" 1124 return(-6) 1125 End 1020 1126 1021 1127 Function ReWrite1DXMLData(folderStr) 1022 1128 String folderStr 1023 1129 1024 1130 Abort "XML function provided by XMLutils XOP is not available, get the XOP from : http://www.igorexchange.com/project/XMLutils (see http://www.smallangles.net/wgwiki/index.php/cansas1d_binding_IgorPro for details)" 1025 1131 return(-6) 1026 1132 end -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NSORT.ipf
r625 r626 172 172 End 173 173 174 175 174 Function WriteNSORTedFile(q3,i3,sig3,firstFileName,secondFileName,thirdFileName,normTo,norm12,norm23,[res]) 175 Wave q3,i3,sig3,res 176 String firstFileName,secondFileName,thirdFileName,normTo 177 Variable norm12,norm23 178 179 NVAR useXMLOutput = root:Packages:NIST:gXML_Write 180 181 if (useXMLOutput == 1) 182 if(WaveExists(res)) 183 WriteNSORTedXMLFile(q3,i3,sig3,firstFileName,secondFileName,thirdFileName,normTo,norm12,norm23,res=res) 184 else 185 WriteNSORTedXMLFile(q3,i3,sig3,firstFileName,secondFileName,thirdFileName,normTo,norm12,norm23) 186 endif 187 else 188 if(WaveExists(res)) 189 WriteOLDNSORTedFile(q3,i3,sig3,firstFileName,secondFileName,thirdFileName,normTo,norm12,norm23,res=res) 190 else 191 WriteOLDNSORTedFile(q3,i3,sig3,firstFileName,secondFileName,thirdFileName,normTo,norm12,norm23) 192 endif 193 endif 194 195 End 196 197 198 Function WriteOLDNSORTedFile(q3,i3,sig3,firstFileName,secondFileName,thirdFileName,normTo,norm12,norm23,[res]) 176 199 Wave q3,i3,sig3,res 177 200 String firstFileName,secondFileName,thirdFileName,normTo
Note: See TracChangeset
for help on using the changeset viewer.