Changeset 1068 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
 Timestamp:
 Sep 28, 2017 4:27:39 PM (5 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WriteHDF5.ipf
r1067 r1068 6 6 7 7 //************************ 8 // Vers 0.75 201707178 // Vers 1.14 20170928 9 9 // 10 10 //************************ … … 31 31 32 32 // Define local waves 33 Wave/T vals,attr,attrVals,textw 34 Wave intw,rw,qvals,inten,sig,qbar,sigmaq,fsubs 33 Wave/T vals,attr,attrVals 35 34 36 35 // Define folder for data heirarchy … … 46 45 Print "Unable to create file at " + fullpath + "." 47 46 else 48 if(stringmatch(type,"")) 49 // Test values for each data set 50 Make/N=9 intw = {0,180.0,23,6254,16547,6178,22,2,0} 51 Make/N=50 rw = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} 52 Make/T/N=2 textw= {"","","","","","","","","","",""} 53 Make/N=10 qvals = {1,1,1,1,1,1,1,1,1,1} // qvals, inten, siq, qbar, sigmaq must be same length 54 Make/N=10 inten = {0,0,0,0,0,0,0,0,0,0} // qvals, inten, siq, qbar, sigmaq must be same length 55 Make/N=10 sig = {0,0,0,0,0,0,0,0,0,0} // qvals, inten, siq, qbar, sigmaq must be same length 56 Make/N=10 qbar = {0,0,0,0,0,0,0,0,0,0} // qvals, inten, siq, qbar, sigmaq must be same length 57 Make/N=10 sigmaq = {0,0,0,0,0,0,0,0,0,0} // qvals, inten, siq, qbar, sigmaq must be same length 58 Make/N=10 fsubs = {0,0,0,0,0,0,0,0,0,0} // qvals, inten, siq, qbar, sigmaq must be same length 59 else 60 destStr = "root:Packages:NIST:"+type 61 62 Variable refNum 63 Variable step=1 64 65 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 66 WAVE intw = $(destStr + ":integersRead") 67 WAVE rw = $(destStr + ":realsRead") 68 WAVE/T textw=$(destStr + ":textRead") 69 WAVE qvals =$(destStr + ":qval") 70 WAVE inten=$(destStr + ":aveint") 71 WAVE sig=$(destStr + ":sigave") 72 WAVE qbar = $(destStr + ":QBar") 73 WAVE sigmaq = $(destStr + ":SigmaQ") 74 WAVE fsubs = $(destStr + ":fSubS") 75 endif 76 endif 77 78 47 destStr = "root:Packages:NIST:"+type 48 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 49 WAVE intw = $(destStr + ":integersRead") 50 WAVE rw = $(destStr + ":realsRead") 51 WAVE/T textw=$(destStr + ":textRead") 52 WAVE qvals =$(destStr + ":qval") 53 WAVE inten=$(destStr + ":aveint") 54 WAVE sig=$(destStr + ":sigave") 55 WAVE qbar = $(destStr + ":QBar") 56 WAVE sigmaq = $(destStr + ":SigmaQ") 57 WAVE fsubs = $(destStr + ":fSubS") 58 endif 59 79 60 /////////////////////////////////////////////////////////////////////////// 80 61 // Write all data … … 83 64 Make/T/N=1 empty = {""} 84 65 Make/T/N=1 units = {"units"} 85 Make/T/N=1 m = {"m"}86 Make/T/N=1 mm = {"mm"}87 Make/T/N=1 cm = {"cm"}88 Make/T/N=1 pixel = {"pixel"}89 Make/T/N=1 angstrom = {"A"}90 66 Make/T/N=1 inv_cm = {"1/cm"} 91 67 Make/T/N=1 inv_angstrom = {"1/A"} … … 133 109 endif 134 110 135 // KillDataFolder/Z $base136 137 111 End 138 112 … … 154 128 // Define local function variables 155 129 Variable fileID 156 Variable step=1,refnum157 130 String destStr="",typeStr="" 158 131 String parentBase = "/sasentry/" // HDF5 base path for all … … 162 135 163 136 // Define local waves 164 Wave/T vals,attr,attrVals,textw 165 Wave intw,rw,qvals,inten,sig,qbar,sigmaq,fsubs 137 Wave/T vals,attr,attrVals 166 138 167 139 // Define folder for data heirarchy … … 177 149 Print "Unable to create file at " + fullpath + "." 178 150 else 179 if(stringmatch(type,"")) 180 181 // TODO: Change the simulated data variables to match those for 2D data 182 183 // Test values for each data set 184 Make/N=9 intw = {0,180.0,23,6254,16547,6178,22,2,0} 185 Make/N=5 rw = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} 186 Make/T/N=2 textw= {"","","","","","","","","","",""} 187 Make/N=10 qvals = {1,1,1,1,1,1,1,1,1,1} // qvals, inten, siq, qbar, sigmaq must be same length 188 Make/N=10 inten = {0,0,0,0,0,0,0,0,0,0} // qvals, inten, siq, qbar, sigmaq must be same length 189 Make/N=10 sig = {0,0,0,0,0,0,0,0,0,0} // qvals, inten, siq, qbar, sigmaq must be same length 190 Make/N=10 qbar = {0,0,0,0,0,0,0,0,0,0} // qvals, inten, siq, qbar, sigmaq must be same length 191 Make/N=10 sigmaq = {0,0,0,0,0,0,0,0,0,0} // qvals, inten, siq, qbar, sigmaq must be same length 192 Make/N=10 fsubs = {0,0,0,0,0,0,0,0,0,0} // qvals, inten, siq, qbar, sigmaq must be same length 151 destStr = "root:Packages:NIST:"+type 152 153 //must select the linear_data to export 154 NVAR isLog = $(destStr+":gIsLogScale") 155 if(isLog==1) 156 typeStr = ":linear_data" 193 157 else 194 destStr = "root:Packages:NIST:"+type 195 196 //must select the linear_data to export 197 NVAR isLog = $(destStr+":gIsLogScale") 198 if(isLog==1) 199 typeStr = ":linear_data" 200 else 201 typeStr = ":data" 202 endif 203 158 typeStr = ":data" 159 endif 204 160 NVAR pixelsX = root:myGlobals:gNPixelsX 205 NVAR pixelsY = root:myGlobals:gNPixelsY 206 207 Wave data=$(destStr+typeStr) 208 Wave data_err=$(destStr+":linear_data_error") 209 WAVE intw=$(destStr + ":integersRead") 210 WAVE rw=$(destStr + ":realsRead") 211 WAVE/T textw=$(destStr + ":textRead") 212 213 endif 161 NVAR pixelsY = root:myGlobals:gNPixelsY 162 Wave data=$(destStr+typeStr) 163 Wave data_err=$(destStr+":linear_data_error") 164 WAVE intw=$(destStr + ":integersRead") 165 WAVE rw=$(destStr + ":realsRead") 166 WAVE/T textw=$(destStr + ":textRead") 214 167 endif 215 168 … … 251 204 lambda0 = lambda // 15 252 205 YG_d = 0.5*G*SDD*(SSD+SDD)*(LAMBDA0/acc)^2 253 Print "DISTANCE BEAM FALLS DUE TO GRAVITY (CM) = ",YG_d254 // Print "Gravity q* = ",2*pi/lambda0*2*yg_d/sdd255 206 qstar = 2*pi/lambda0*2*yg_d/sdd 256 207 … … 299 250 Make/T/N=1 empty = {""} 300 251 Make/T/N=1 units = {"units"} 301 Make/T/N=1 m = {"m"}302 Make/T/N=1 mm = {"mm"}303 Make/T/N=1 cm = {"cm"}304 Make/T/N=1 pixel = {"pixel"}305 Make/T/N=1 angstrom = {"A"}306 252 Make/T/N=1 inv_cm = {"1/cm"} 307 253 Make/T/N=1 inv_angstrom = {"1/A"} … … 354 300 endif 355 301 356 // KillDataFolder/Z $base357 358 302 End 359 303 … … 379 323 Make/T/N=1 pixel = {"pixel"} 380 324 Make/T/N=1 angstrom = {"A"} 381 Make/T/N=1 inv_cm = {"1/cm"}382 Make/T/N=1 inv_angstrom = {"1/A"}383 325 384 326 // SASinstrument … … 512 454 String fullpath 513 455 Variable fileID 514 print fullPath515 456 fullpath = ReplaceString(":\\", fullpath, ":") 516 print fullPath517 457 fullpath = ReplaceString("\\", fullpath, ":") 518 print fullPath519 458 HDF5CreateFile /Z fileID as fullpath 520 459 NXCansas_InitializeFile(fileID)
Note: See TracChangeset
for help on using the changeset viewer.