Changeset 1066 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Timestamp:
- Sep 28, 2017 11:23:01 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WriteHDF5.ipf
r1065 r1066 11 11 12 12 13 // 14 // TODO: Handle all values 15 // 16 17 18 /////////////////////////////////////////////////////////////////////////// 19 // Main method to be called - WriteNxCansas 20 // Creates an HDF5 file and populates it with real values in Igor memory 21 // If dialog and fullpath are left blank (0 and "", resp.), a test will be run 13 /////////////////////////////////////////////////////////////////////////// 14 // - WriteNxCanSAS1D - Method for writing 1D NXcanSAS data 15 // Creates an HDF5 file, with reduced 1D data and stores all meta data 16 // If dialog and fullpath are left blank (0 and ""), fake data will be used 22 17 23 18 Function WriteNxCanSAS1D(type,fullpath,dialog) … … 51 46 Print "Unable to create file at " + fullpath + "." 52 47 else 53 WAVE intw,rw,qvals,inten,sig,qbar,sigmaq,fsubs54 WAVE/T textw55 48 if(stringmatch(type,"")) 56 49 // Test values for each data set 57 50 Make/N=9 intw = {0,180.0,23,6254,16547,6178,22,2,0} 58 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}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} 59 52 Make/T/N=2 textw= {"","","","","","","","","","",""} 60 53 Make/N=10 qvals = {1,1,1,1,1,1,1,1,1,1} // qvals, inten, siq, qbar, sigmaq must be same length … … 94 87 Make/T/N=1 cm = {"cm"} 95 88 Make/T/N=1 pixel = {"pixel"} 96 Make/T/N=1 angstrom = {" angstrom"}89 Make/T/N=1 angstrom = {"A"} 97 90 Make/T/N=1 inv_cm = {"1/cm"} 98 Make/T/N=1 inv_angstrom = {"1/ angstrom"}91 Make/T/N=1 inv_angstrom = {"1/A"} 99 92 100 93 // Run Name and title … … 110 103 String dataBase = base + ":entry1:sasdata" 111 104 NewDataFolder/O/S $(dataBase) 112 Make/O/T/N=5 $(dataBase + ":attr") = {"canSAS_class","signal","I_axes","NX_class","Q_indices" }113 Make/O/T/N=5 $(dataBase + ":attrVals") = {"SASdata","I","Q","NXdata","0 "}105 Make/O/T/N=5 $(dataBase + ":attr") = {"canSAS_class","signal","I_axes","NX_class","Q_indices", "timestamp"} 106 Make/O/T/N=5 $(dataBase + ":attrVals") = {"SASdata","I","Q","NXdata","0,1",textw[1]} 114 107 CreateStrNxCansas(fileID,dataParent,"","",empty,$(dataBase + ":attr"),$(dataBase + ":attrVals")) 115 108 // Create q entry … … 124 117 CreateVarNxCansas(fileID,dataParent,"sasdata","I",inten,$(dataBase + ":i:attr"),$(dataBase + ":i:attrVals")) 125 118 // Create idev entry 126 NewDataFolder/O/S $(dataBase + ":idev") 127 CreateVarNxCansas(fileID,dataParent,"sasdata","Idev",sig,units,$(dataBase + ":idev:attrVals")) 119 CreateVarNxCansas(fileID,dataParent,"sasdata","Idev",sig,units,inv_cm) 128 120 // Create qdev entry 129 NewDataFolder/O/S $(dataBase + ":qdev")130 121 CreateVarNxCansas(fileID,dataParent,"sasdata","Qdev",sigmaq,units,inv_angstrom) 131 122 CreateVarNxCansas(fileID,dataParent,"sasdata","Qmean",qbar,units,inv_angstrom) … … 164 155 NewDataFolder/O/S $(collimationBase) 165 156 Make/O/T/N=5 $(collimationBase + ":attr") = {"canSAS_class","NX_class"} 166 Make/O/T/N=5 $(collimationBase + ":attrVals") = {"SAScollimation","NXcollimat ion"}157 Make/O/T/N=5 $(collimationBase + ":attrVals") = {"SAScollimation","NXcollimator"} 167 158 CreateStrNxCansas(fileID,collimationParent,"","",empty,$(collimationBase + ":attr"),$(collimationBase + ":attrVals")) 168 159 // Create SAScollimation length entry … … 182 173 CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals")) 183 174 // Create SASdetector name entry 184 Make/O/T/N=1 $(detectorBase + ":name") = { "ORNL"} // TODO: Get real value175 Make/O/T/N=1 $(detectorBase + ":name") = {textw[9]} 185 176 CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty) 186 177 // Create SASdetector distance entry … … 251 242 /////////////////////////////////////////////////////////////////////////// 252 243 244 245 /////////////////////////////////////////////////////////////////////////// 246 // - WriteNxCanSAS2D - Method for writing 2D NXcanSAS data 247 // Creates an HDF5 file, generates reduced 2D data and stores all meta data 248 // If dialog and fullpath are left blank (0 and ""), fake data will be used 249 253 250 Function WriteNxCanSAS2D(type,fullpath,dialog) 254 251 // Define input variables … … 282 279 Print "Unable to create file at " + fullpath + "." 283 280 else 284 WAVE intw,rw,qvals,inten,sig,qbar,sigmaq,fsubs285 WAVE/T textw286 281 if(stringmatch(type,"")) 282 283 // TODO: Change the simulated data variables to match those for 2D data 284 287 285 // Test values for each data set 288 286 Make/N=9 intw = {0,180.0,23,6254,16547,6178,22,2,0} … … 358 356 // Print "Gravity q* = ",-2*pi/lambda0*2*yg_d/sdd 359 357 qstar = -2*pi/lambda0*2*yg_d/sdd 360 361 358 362 359 // the gravity center is not the resolution center … … 376 373 Duplicate/O qval SigmaQX,SigmaQY,fsubS 377 374 378 379 375 //Two parameters DDET and APOFF are instrument dependent. Determine 380 376 //these from the instrument name in the header. … … 409 405 Make/T/N=1 cm = {"cm"} 410 406 Make/T/N=1 pixel = {"pixel"} 411 Make/T/N=1 angstrom = {" angstrom"}407 Make/T/N=1 angstrom = {"A"} 412 408 Make/T/N=1 inv_cm = {"1/cm"} 413 Make/T/N=1 inv_angstrom = {"1/ angstrom"}409 Make/T/N=1 inv_angstrom = {"1/A"} 414 410 415 411 // Run Name and title … … 420 416 CreateStrNxCansas(fileID,parentBase,"","run",$(base + ":entry1:run"),empty,empty) 421 417 422 // TODO: Change the steps to save 2D data instead of 1D423 424 418 // SASData 425 419 String dataParent = parentBase + "sasdata/" … … 427 421 String dataBase = base + ":entry1:sasdata" 428 422 NewDataFolder/O/S $(dataBase) 429 Make/O/T/N=5 $(dataBase + ":attr") = {"canSAS_class","signal","I_axes","NX_class","Q_indices" }430 Make/O/T/N=5 $(dataBase + ":attrVals") = {"SASdata","I","Qx,Qy","NXdata","0,1" }423 Make/O/T/N=5 $(dataBase + ":attr") = {"canSAS_class","signal","I_axes","NX_class","Q_indices", "timestamp"} 424 Make/O/T/N=5 $(dataBase + ":attrVals") = {"SASdata","I","Qx,Qy","NXdata","0,1",textw[1]} 431 425 CreateStrNxCansas(fileID,dataParent,"","",empty,$(dataBase + ":attr"),$(dataBase + ":attrVals")) 432 426 // Create i entry … … 436 430 CreateVarNxCansas(fileID,dataParent,"sasdata","I",data,$(dataBase + ":i:attr"),$(dataBase + ":i:attrVals")) 437 431 // Create qx and qy entry 438 // data,qx_val,qy_val,z_val,qval,qz_val,phi,r_dist439 432 NewDataFolder/O/S $(dataBase + ":qx") 440 433 Make/T/N=2 $(dataBase + ":qx:attr") = {"units","resolutions"} … … 446 439 CreateVarNxCansas(fileID,dataParent,"sasdata","Qy",qy_val,$(dataBase + ":qy:attr"),$(dataBase + ":qy:attrVals")) 447 440 // Create idev entry 448 NewDataFolder/O/S $(dataBase + ":idev") 449 CreateVarNxCansas(fileID,dataParent,"sasdata","Idev",data_err,units,$(dataBase + ":idev:attrVals")) 441 CreateVarNxCansas(fileID,dataParent,"sasdata","Idev",data_err,units,inv_cm) 450 442 // Create qdev entry 451 NewDataFolder/O/S $(dataBase + ":qxdev")452 443 CreateVarNxCansas(fileID,dataParent,"sasdata","Qxdev",SigmaQX,units,inv_angstrom) 453 444 CreateVarNxCansas(fileID,dataParent,"sasdata","Qydev",SigmaQY,units,inv_angstrom) 445 // Create shadwfactor entry 446 447 // TODO: Reinstate ShadowFactor 448 449 // CreateVarNxCansas(fileID,dataParent,"sasdata","ShadowFactor",fsubs,empty,empty) 454 450 455 451 // SASinstrument … … 486 482 NewDataFolder/O/S $(collimationBase) 487 483 Make/O/T/N=5 $(collimationBase + ":attr") = {"canSAS_class","NX_class"} 488 Make/O/T/N=5 $(collimationBase + ":attrVals") = {"SAScollimation","NXcollimat ion"}484 Make/O/T/N=5 $(collimationBase + ":attrVals") = {"SAScollimation","NXcollimator"} 489 485 CreateStrNxCansas(fileID,collimationParent,"","",empty,$(collimationBase + ":attr"),$(collimationBase + ":attrVals")) 490 486 // Create SAScollimation length entry … … 504 500 CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals")) 505 501 // Create SASdetector name entry 506 Make/O/T/N=1 $(detectorBase + ":name") = { "ORNL"} // TODO: Get real value502 Make/O/T/N=1 $(detectorBase + ":name") = {textw[9]} 507 503 CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty) 508 504 // Create SASdetector distance entry
Note: See TracChangeset
for help on using the changeset viewer.