Changeset 1174 for sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures
- Timestamp:
- Jun 18, 2019 10:46:02 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/USANS/WriteUSANSNXcanSAS.ipf
r1173 r1174 94 94 NewDataFolder/O/S $(parentBase) 95 95 96 // 97 // FIXME: Get useful title - For now, sending empty string 98 // 99 100 Make/T/N=1 $(parentBase + ":title") = {""} //StringByKey("LABEL",note(inten),":",";")} 96 Make/T/N=1 $(parentBase + ":title") = {StringByKey("LABEL",note(inten),":",";")} 101 97 CreateStrNxCansas(fileID,nxcansasBase,"","title",$(parentBase + ":title"),empty,empty) 102 103 // 104 // TODO: Any way to programatically get the old filename? 105 // 106 107 Make/T/N=1 $(parentBase + ":run") = {""} 98 Make/T/N=1 $(parentBase + ":run") = {StringByKey("FILE",note(inten),":",";")} 108 99 CreateStrNxCansas(fileID,nxcansasBase,"","run",$(parentBase + ":run"),empty,empty) 109 100 … … 156 147 157 148 Variable fileID 158 String destStr="" 159 destStr = USANSFolder+":DSM" 149 String destStr=USANSFolder+":DSM" 160 150 String dateStr=date()+" "+time() 161 151 … … 167 157 sPrintf nxcansasBase,"/sasentry%d/",sasentry // HDF5 base path for all 168 158 169 KillDataFolder/Z $base159 NewDataFolder/O/S $(base) 170 160 171 161 // Define common attribute waves 172 Make/ T/N=1 empty = {""}173 Make/ T/N=1 units = {"units"}174 Make/ T/N=1 m = {"m"}175 Make/ T/N=1 mm = {"mm"}176 Make/ T/N=1 cm = {"cm"}177 Make/ T/N=1 angstrom = {"A"}178 Make/ T/N=1 inv_cm = {"1/cm"}179 Make/ T/N=1 inv_angstrom = {"1/A"}162 Make/O/T/N=1 empty = {""} 163 Make/O/T/N=1 units = {"units"} 164 Make/O/T/N=1 m = {"m"} 165 Make/O/T/N=1 mm = {"mm"} 166 Make/O/T/N=1 cm = {"cm"} 167 Make/O/T/N=1 angstrom = {"A"} 168 Make/O/T/N=1 inv_cm = {"1/cm"} 169 Make/O/T/N=1 inv_angstrom = {"1/A"} 180 170 181 171 Variable refNum,integer,realval 182 183 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error****184 WAVE qvals =$(destStr + "Q_dsm")185 WAVE inten=$(destStr + "I_dsm")186 WAVE sig=$(destStr + "S_dsm")187 172 188 173 if(dialog || stringmatch(fullpath, "")) … … 192 177 Endif 193 178 179 if(!fileID) 180 abort "Unable to create file at " + fullpath + "." 181 else 182 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 183 WAVE qvals =$(destStr + "Q_dsm") 184 WAVE inten=$(destStr + "I_dsm") 185 WAVE sig=$(destStr + "S_dsm") 186 endif 187 194 188 //check each wave 195 189 If(!(WaveExists(qvals))) … … 203 197 Endif 204 198 205 //Use the evil extra column for the resolution "information". Should probably switch to using slit_length in collimation. 199 Duplicate/O Q_dsm,res1,res2,res3 200 res3 = 1 // "fake" beamstop shadowing 201 res1 /= 100 //make the sigmaQ so small that there is no smearing 202 206 203 //write out partial set? 207 204 Duplicate/O qvals,tq,ti,te … … 215 212 endif 216 213 217 Make/N= (numpnts(dumWave)) dQw = 0 214 //Use the evil extra column for the resolution "information". Should probably switch to using slit_length in collimation. 215 Duplicate/O qvals,dumWave 216 dumWave = dQv 217 218 Make/O/N= (numpnts(dumWave)) dQw = 0 218 219 219 220 // Run Name and title 220 221 NewDataFolder/O/S $(parentBase) 222 221 223 Make/T/N=1 $(parentBase + ":title") = {StringByKey("LABEL",note(inten),":",";")} 222 224 CreateStrNxCansas(fileID,nxcansasBase,"","title",$(parentBase + ":title"),empty,empty) 223 Make/T/N=1 $(parentBase + ":run") = { ""}225 Make/T/N=1 $(parentBase + ":run") = {StringByKey("FILE",note(inten),":",";")} 224 226 CreateStrNxCansas(fileID,nxcansasBase,"","run",$(parentBase + ":run"),empty,empty) 225 227 … … 235 237 NewDataFolder/O/S $(dataBase + ":q") 236 238 Make/T/N=2 $(dataBase + ":q:attr") = {"units","resolutions"} 237 Make/T/N=2 $(dataBase + ":q:attrVals") = {"1/ angstrom","dQ"}239 Make/T/N=2 $(dataBase + ":q:attrVals") = {"1/A","Qdev"} 238 240 CreateVarNxCansas(fileID,dataParent,"sasdata","Q",tq,$(dataBase + ":q:attr"),$(dataBase + ":q:attrVals")) 239 241 // Create i entry … … 245 247 CreateVarNxCansas(fileID,dataParent,"sasdata","Idev",te,units,inv_cm) 246 248 // Create qdev entry 247 CreateVarNxCansas(fileID,dataParent,"sasdata","dQl",dumWave,units,inv_angstrom) 248 CreateVarNxCansas(fileID,dataParent,"sasdata","dQw",res1,units,inv_angstrom) 249 CreateVarNxCansas(fileID,dataParent,"sasdata","Qdev",res1,units,inv_angstrom) 249 250 CreateVarNxCansas(fileID,dataParent,"sasdata","Qmean",res2,units,inv_angstrom) 250 251 // Write USANS meta data 252 WriteUSANSNXcanSASMetaData(fileID,"SMEARED",parentBase,nxcansasBase,dateStr) 251 CreateVarNxCansas(fileID,dataParent,"sasdata","Shadowfactor",res3,units,empty) 252 253 // Write the meta data to the file 254 WriteUSANSNXcanSASMetaData(fileID,"DSM",parentBase,nxcansasBase,dateStr) 253 255 254 256 //write confirmation of write operation to history area … … 262 264 endif 263 265 264 End 266 End 265 267 266 268 Function WriteUSANSNXcanSASMetaData(fileID,type,parentBase,nxcansasBase,dateStr) … … 270 272 // tailor the output given the type of data written out... 271 273 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 274 String destStr=USANSFolder+":"+type 275 WAVE inten = $(destStr + ":DetCts") 272 276 WAVE inten_EMP=$(USANSFolder+":EMP:DetCts") 273 277 String samStr="",empStr="",samLabelStr="",paramStr="",empLevStr="",bkgLevStr="" … … 296 300 pkStr += "EMP PEAK ANGLE: "+num2str(QpkFromNote("EMP")) 297 301 break 298 case " SMEARED":302 case "DSM": 299 303 samStr = "SMEARED FILES: "+StringByKey("FILE",note(inten),":",";") 300 304 empStr = "EMP FILES: "+StringByKey("FILE",note(inten_EMP),":",";") … … 318 322 endswitch 319 323 320 processNote = samStr+"\n"+dateStr+"\n"+ samLabelStr+"\n"+empStr+"\n"+paramStr+"\n"+pkStr+"\n"324 processNote = samStr+"\n"+dateStr+"\n"+empStr+"\n"+paramStr+"\n"+pkStr+"\n" 321 325 processNote += empLevStr + " ; "+bkglevStr+"\n" 322 326 … … 396 400 CreateStrNxCansas(fileID,sampleParent,"","",empty,$(sampleBase + ":attr"),$(sampleBase + ":attrVals")) 397 401 // Create SASsample name entry 398 399 //400 // FIXME: reinstate sample name once format is correct (same as title)401 //402 403 402 Make/O/T/N=1 $(sampleBase + ":name") = {StringByKey("LABEL",note(inten),":",";")} 404 403 CreateStrNxCansas(fileID,sampleParent,"","name",$(sampleBase + ":name"),empty,empty) … … 412 411 // SASProcess 413 412 String processParent = nxcansasBase + "sasprocess/" 414 // Create SAS sampleentry413 // Create SASProcess entry 415 414 String processBase = parentBase + ":sasprocess" 416 415 NewDataFolder/O/S $(processBase) … … 418 417 Make/O/T/N=2 $(processBase + ":attrVals") = {"SASprocess","NXprocess"} 419 418 CreateStrNxCansas(fileID,processParent,"","",empty,$(processBase + ":attr"),$(processBase + ":attrVals")) 420 // Create SAS samplename entry419 // Create SASProcess name entry 421 420 Make/O/T/N=1 $(processBase + ":name") = {"NIST IGOR"} 422 421 CreateStrNxCansas(fileID,processParent,"","name",$(processBase + ":name"),empty,empty) 423 // Create SAS sample thicknessentry422 // Create SASProcess note entry 424 423 Make/O/T/N=1 $(processBase + ":processnote") = {processNote} 425 424 CreateStrNxCansas(fileID,processParent,"","note",$(processBase + ":processnote"),empty,empty)
Note: See TracChangeset
for help on using the changeset viewer.