- Timestamp:
- Jun 2, 2017 11:29:54 AM (6 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ProtocolAsPanel.ipf
r916 r1042 280 280 if(cmpstr(item,"none") == 0) 281 281 checked = 0 282 String/G root:myGlobals:Protocols:gDRK = list282 String/G root:myGlobals:Protocols:gDRK = "DRK=none,DRKMODE=0," 283 283 CheckBox prot_check_6 win=ProtocolPanel,value=checked 284 284 else -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_HDF5_VSANS_Utils.ipf
r1023 r1042 61 61 // to be able to work with attributes - if needed. 62 62 // 63 Menu "VSANS"64 SubMenu "Nexus File RW"65 // "Fill_Nexus_V_Template"66 // "Save_Nexus_V_Template"67 // "Load_Nexus_V_Template"68 // "-"69 // "IgorOnly_Setup_VSANS_Struct"70 // "IgorOnly_Save_VSANS_Nexus"71 // "IgorOnly_Setup_SANS_Struct"72 // "IgorOnly_Save_SANS_Struct"73 "Setup_VSANS_DIV_Struct"74 "Save_VSANS_DIV_Nexus"75 "Setup_VSANS_MASK_Struct"76 "Save_VSANS_MASK_Nexus"77 "-"78 "Read_Nexus with attributes",Read_Nexus_Xref() //this will read with attributes79 "Write_Nexus with attributes",Write_Nexus_Xref() //this will write out with attributes if read in by Read_Nexus_Xref80 End81 End82 83 84 85 86 87 88 89 90 91 92 93 94 63 95 64 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Combine_1D.ipf
r1039 r1042 35 35 // x- "Done" button that kills the root:ToTrim folder (may need to kill the dependency first) 36 36 // 37 MacroV_CombineDataGraph()37 Proc V_CombineDataGraph() 38 38 39 39 // this is the "initialization" step -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DataPlotting.ipf
r1039 r1042 872 872 873 873 ClearIQIfDisplayed_AllFldr("B",winNameStr) 874 SetDataFolder $( "root:Packages:NIST:VSANS:"+type)874 SetDataFolder $(fullPathToFolder) // ClearIQIfDisplayed_AllFldr() resets to root: 875 875 CheckDisplayed/W=$winNameStr iBin_qxqy_B 876 876 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_RW_Utils.ipf
r1040 r1042 61 61 Variable ii 62 62 63 destPath = "root:Packages:NIST:VSANS:"+folder 64 // before reading in new data, clean out what old data can be cleaned. hopefully new data will overwrite what is in use 65 V_KillWavesFullTree($destPath,folder,0,"",1) // this will traverse the whole tree, trying to kill what it can 66 67 if(DataFolderExists("root:Packages:NIST:VSANS:"+folder) == 0) //if it was just killed? 68 NewDataFolder/O $("root:Packages:NIST:VSANS:"+folder) 69 endif 63 70 SetDataFolder $("root:Packages:NIST:VSANS:"+folder) 64 destPath = "root:Packages:NIST:VSANS:"+folder65 71 66 72 Variable err= V_LoadHDF5_NoAtt(file,folder) // reads into current folder -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf
r1040 r1042 33 33 //end 34 34 35 MacroDump_V_getFP(fname)35 Proc Dump_V_getFP(fname) 36 36 String fname 37 37 … … 60 60 end 61 61 62 MacroDump_V_getFP_Det(fname,detStr)62 Proc Dump_V_getFP_Det(fname,detStr) 63 63 String fname,detStr="FL" 64 64 … … 88 88 89 89 90 MacroDump_V_getSTR(fname)90 Proc Dump_V_getSTR(fname) 91 91 String fname 92 92 … … 119 119 end 120 120 121 MacroDump_V_getSTR_Det(fname,detStr)121 Proc Dump_V_getSTR_Det(fname,detStr) 122 122 String fname,detStr="FL" 123 123 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Utilities.ipf
r1039 r1042 814 814 // -- but a real writer will need to be aware of resolution, and there may be different forms 815 815 // 816 // This saves the data in Igor Text format, an ASCII format, but NOT standard SANS columns 817 // No concatenation is done. This is meant to be used for input to TRIM, or for general troubleshooting 818 // 819 // 816 820 // this will bypass save dialogs 817 821 // -- AND WILL OVERWRITE DATA WITH THE SAME NAME 818 822 // 819 Function V_Write1DData_ NoConcat(pathStr,folderStr,saveName,binType)823 Function V_Write1DData_ITX(pathStr,folderStr,saveName,binType) 820 824 String pathStr,folderStr,saveName 821 825 Variable binType … … 985 989 986 990 987 MacroV_Load_Data_ITX()991 Proc V_Load_Data_ITX() 988 992 V_Load_itx("","",0,0) 989 993 end -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MainPanel.ipf
r1041 r1042 294 294 if(exists("Show_Event_Panel")==0) 295 295 // procedure file was not loaded 296 DoAlert 0," This operation is not available in this set of macros"296 DoAlert 0,"Only test procedures exist. See V_VSANS_Event_Testing.ipf" 297 297 else 298 298 Show_Event_Panel() -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Menu.ipf
r1025 r1042 32 32 "Load Fake MASK Data" 33 33 "Correct Data",V_CorrectData() 34 End 35 SubMenu "Nexus File RW" 36 // "Fill_Nexus_V_Template" 37 // "Save_Nexus_V_Template" 38 // "Load_Nexus_V_Template" 39 // "-" 40 // "IgorOnly_Setup_VSANS_Struct" 41 // "IgorOnly_Save_VSANS_Nexus" 42 // "IgorOnly_Setup_SANS_Struct" 43 // "IgorOnly_Save_SANS_Struct" 44 "Setup_VSANS_DIV_Struct" 45 "Save_VSANS_DIV_Nexus" 46 "Setup_VSANS_MASK_Struct" 47 "Save_VSANS_MASK_Nexus" 48 "-" 49 "Read_Nexus with attributes",Read_Nexus_Xref() //this will read with attributes 50 "Write_Nexus with attributes",Write_Nexus_Xref() //this will write out with attributes if read in by Read_Nexus_Xref 51 "-" 52 "Dump_V_getFP" 53 "Dump_V_getFP_Det" 54 "Dump_V_getSTR" 55 "Dump_V_getSTR_Det" 34 56 End 35 57 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MultipleReduce.ipf
r1040 r1042 292 292 list = RemoveFromList("tempProtocol", list, ";") 293 293 list = RemoveFromList("fakeProtocol", list, ";") 294 list = RemoveFromList("PanelNameW", list, ";") 295 list = RemoveFromList("Beg_pts", list, ";") 296 list = RemoveFromList("End_pts", list, ";") 297 list = RemoveFromList("trimUpdate", list, ";") 294 298 295 299 String/G root:Packages:NIST:VSANS:Globals:MRED:gMRProtoList = list -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf
r1041 r1042 1464 1464 Proc V_PickAProtocol(protocol) 1465 1465 String Protocol 1466 Prompt Protocol "Pick A Protocol",popup, WaveList("*",";","TEXT:1,MAXROWS:13")1466 Prompt Protocol "Pick A Protocol",popup, V_RecallableProtocols() 1467 1467 1468 1468 String/G root:Packages:NIST:VSANS:Globals:Protocols:gProtoStr = protocol … … 1484 1484 list= RemoveFromList("CreateNew", list , ";") 1485 1485 list= RemoveFromList("tempProtocol", list , ";") 1486 list= RemoveFromList("wTTmpWrite", list , ";") 1486 1487 if(cmpstr(list,"")==0) 1487 1488 list = "_no_protocols_;" … … 1490 1491 return(list) 1491 1492 End 1493 1494 Function/S V_RecallableProtocols() 1495 String list=WaveList("*",";","TEXT:1,MAXROWS:13") 1496 1497 // list= RemoveFromList("Base", list , ";") 1498 // list= RemoveFromList("DoAll", list , ";") 1499 list= RemoveFromList("CreateNew", list , ";") 1500 list= RemoveFromList("tempProtocol", list , ";") 1501 list= RemoveFromList("wTTmpWrite", list , ";") 1502 if(cmpstr(list,"")==0) 1503 list = "_no_protocols_;" 1504 endif 1505 1506 return(list) 1507 End 1508 1492 1509 1493 1510 //missing parameter dialog to solicit user for a waveStr for the protocol … … 2507 2524 // does not trim any of the data 2508 2525 V_RemoveQ0_B(activeType) 2509 V_Write1DData_ NoConcat("root:Packages:NIST:VSANS:",activeType,newFileName,binType)2526 V_Write1DData_ITX("root:Packages:NIST:VSANS:",activeType,newFileName,binType) 2510 2527 endif 2511 2528 … … 2772 2789 String Protocol="" 2773 2790 SetDataFolder root:Packages:NIST:VSANS:Globals:Protocols 2774 Prompt Protocol "Pick A Protocol",popup, WaveList("*",";","")2791 Prompt Protocol "Pick A Protocol",popup, V_DeletableProtocols() 2775 2792 DoPrompt "Pick A Protocol to Export",Protocol 2776 2793 if(V_flag==1) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Test_RAW_Panel.ipf
r1041 r1042 999 999 // click code here 1000 1000 1001 V_SimpleSave1DData("root:Packages:NIST:VSANS:","","","") 1002 1001 // V_SimpleSave1DData("root:Packages:NIST:VSANS:","","","") 1002 1003 // this is the same as clicking the I(q) button. Ensures that the current file has been averaged, 1004 // and the data being saved is not "stale" 1005 1006 V_PlotData_Panel() //-9999 requests a read from the popup on the panel 1007 Variable binType = V_GetBinningPopMode() 1008 V_BinningModePopup("",binType,"") // does default circular binning and updates the graph 1009 1010 SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType //what folder 1011 1012 // look for the binning type 1013 // Variable binType 1014 // ControlInfo/W=V_1D_Data popup0 1015 // binType = (V_flag == 0) ? 1 : V_flag // if binType not defined, set binType == 1 1016 1017 String saveName="" 1018 // write out the data set to a file 1019 if(strlen(saveName)==0) 1020 Execute "V_GetNameForSave()" 1021 SVAR newName = root:saveName 1022 saveName = newName 1023 endif 1024 1025 V_Write1DData_ITX("root:Packages:NIST:VSANS:",type,saveName,binType) 1026 1027 Print "Saved file: " + saveName + ".itx" 1003 1028 break 1004 1029 case -1: // control being killed -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_VSANS_Event_Testing.ipf
r1041 r1042 44 44 // -- not sure how this will work with JointHistogram Operation 45 45 // (split to separate "streams" of values for each detector panel? 46 // 47 // 48 // -- can I efficiently use "sort" (on the tube index) to block the data into groups that can be split 49 // into 4 sets of waves 50 // that can then be binned per panel, using the usual Joint histogram procedures? Works only if the 51 // tube indexing is orderly. if it's a mess, Ill need to try something else (indexed sort?) (replace?) 52 // (manually? ugh.) 46 53 // 47 54 … … 163 170 End 164 171 165 172 / 173 // tested up to num=1e8 successfully 174 // 166 175 Function V_MakeFakeEventWave() 167 176 168 177 Variable num,ii 169 178 170 num = 1000 179 180 num = 1e3 171 181 172 182 // // /l=64 bit, /U=unsigned … … 184 194 i64_start = ticks 185 195 for(ii=0;ii<num;ii+=1) 186 sleep/T 6// 6 ticks, approx 0.1 s (without the delay, the loop is too fast)196 // sleep/T/C=-1 1 // 6 ticks, approx 0.1 s (without the delay, the loop is too fast) 187 197 b1 = trunc(abs(enoise(192))) //since truncated, need 192 as highest random to give 191 after trunc 188 198 b2 = trunc(abs(enoise(128))) // same here, to get results [0,127] 189 199 190 i64_ticks = ticks-i64_start 200 // i64_ticks = ticks-i64_start 201 i64_ticks = ii+1 191 202 192 203 b2 = b2 << 48 … … 196 207 eventWave[ii] = i64_num 197 208 endfor 198 199 return(0) 200 End 201 202 203 Function V_decodeFakeEventWave() 204 205 WAVE w = eventWave 209 210 211 return(0) 212 End 213 214 215 Function V_decodeFakeEventWave(w) 216 Wave w 217 218 s_tic() 219 // WAVE w = eventWave 206 220 uint64 val,b1,b2,btime 207 221 val = w[0] … … 231 245 232 246 endfor 247 248 s_toc() 233 249 234 250 return(0) … … 286 302 // GBLoadWave/B/T={192,192}/W=1/S=22 287 303 Variable num,refnum 304 288 305 289 306 // so to read: … … 308 325 vsansStr = PadString(vsansStr,5,0x20) //pad to 5 bytes 309 326 detStr = PadString(detStr,1,0x20) //pad to 1 byte 327 310 328 Open/R refnum 311 329 fname = S_fileName 330 331 s_tic() 312 332 313 333 FBinRead refnum, vsansStr … … 333 353 GBLoadWave/B/T={192,192}/W=1/S=22 fname 334 354 335 336 return(0) 337 End 355 s_toc() 356 357 return(0) 358 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WorkFolderUtils.ipf
r1041 r1042 100 100 return(0) 101 101 else 102 103 V_KillWavesFullTree($fromDF,fromStr,0,"",1) // this will traverse the whole tree, trying to kill what it can 104 102 105 // need to do this the hard way, duplicate/O recursively 103 106 // see V_CopyToWorkFolder() … … 113 116 // sample 114 117 V_DuplicateDataFolder($(fromDF+":entry:sample"),fromStr,toStr,0,"",1) //yes recursion here 115 118 // user 119 V_DuplicateDataFolder($(fromDF+":entry:user"),fromStr,toStr,0,"",1) //yes recursion here 120 116 121 endif 117 122 … … 119 124 end 120 125 126 127 128 Function V_KillWavesInFolder(folderStr) 129 String folderStr 130 131 if(DataFolderExists(folderStr) && strlen(folderStr) != 0) 132 SetDataFolder $folderStr 133 KillWaves/A/Z 134 endif 135 136 SetDataFolder root: 137 return(0) 138 end 121 139 122 140 //////// … … 234 252 235 253 End 236 254 255 256 // ListDataFolder(dfr, level) 257 // Recursively lists objects in data folder. 258 // Pass data folder path for dfr and 0 for level. 259 // pass level == 0 for the first call 260 // sNBName = "" prints nothing. any name will generate a notebook 261 // 262 // recurse == 0 will do only the specified folder, anything else will recurse all levels 263 // toStr is the string name of the top-level folder only, not the full path 264 // 265 // 266 Function V_KillWavesFullTree(dfr, fromStr, level, sNBName,recurse) 267 DFREF dfr 268 String fromStr 269 // String toStr 270 Variable level // Pass 0 to start 271 String sNBName 272 Variable recurse 273 274 String name 275 String dfName 276 String sString 277 278 String toDF = "" 279 280 if (level == 0) // this is the data folder, generate if needed in the destination 281 name = GetDataFolder(1, dfr) 282 sPrintf sString, "%s (data folder)\r", name 283 // toDF = ReplaceString(fromStr,name,toStr,1) // case-sensitive replace 284 // sprintf sString, "NewDataFolder/O %s\r",toDF 285 // NewDataFolder/O $(RemoveEnding(toDF,":")) // remove trailing semicolon if it's there 286 287 V_WriteBrowserInfo_test(sString, 1, sNBName) 288 endif 289 290 dfName = GetDataFolder(1, dfr) 291 // toDF = ReplaceString(fromStr,dfName,toStr,1) // case-sensitive replace 292 Variable i 293 294 String indentStr = "\t" 295 for(i=0; i<level; i+=1) 296 indentStr += "\t" 297 endfor 298 299 Variable numWaves = CountObjectsDFR(dfr, 1) 300 for(i=0; i<numWaves; i+=1) 301 name = GetIndexedObjNameDFR(dfr, 1, i) 302 // 303 // wave type does not matter now. Kill does not care 304 // 305 sPrintf sString, "Killing %s\r",dfName+name 306 KillWaves/Z $(dfName+name) 307 308 V_WriteBrowserInfo_test(sString, 2, sNBName) 309 endfor 310 311 // now kill the data folder if possible 312 KillDataFolder/Z $dfName 313 314 315 Variable numNumericVariables = CountObjectsDFR(dfr, 2) 316 for(i=0; i<numNumericVariables; i+=1) 317 name = GetIndexedObjNameDFR(dfr, 2, i) 318 sPrintf sString, "%s%s (numeric variable)\r", indentStr, name 319 V_WriteBrowserInfo_test(sString, 3, sNBName) 320 endfor 321 322 Variable numStringVariables = CountObjectsDFR(dfr, 3) 323 for(i=0; i<numStringVariables; i+=1) 324 name = GetIndexedObjNameDFR(dfr, 3, i) 325 sPrintf sString, "%s%s (string variable)\r", indentStr, name 326 V_WriteBrowserInfo_test(sString, 4, sNBName) 327 endfor 328 329 if(recurse) 330 Variable numDataFolders = CountObjectsDFR(dfr, 4) 331 for(i=0; i<numDataFolders; i+=1) 332 name = GetIndexedObjNameDFR(dfr, 4, i) 333 sPrintf sString, "%s%s (data folder)\r", indentStr, name 334 dfName = GetDataFolder(1, dfr) 335 336 // toDF = ReplaceString(fromStr,dfName,toStr,1) // case-sensitive replace 337 // sprintf sString, "NewDataFolder/O %s\r",toDF+name 338 // NewDataFolder/O $(toDF+name) 339 340 341 V_WriteBrowserInfo_test(sString, 1, sNBName) 342 DFREF childDFR = dfr:$(name) 343 V_KillWavesFullTree(childDFR, fromStr, level+1, sNBName, recurse) 344 endfor 345 endif 346 347 348 End 349 350 351 237 352 Function V_WriteBrowserInfo_test(sString, vType, sNBName) 238 353 String sString … … 462 577 endif 463 578 464 // (3) solid angle correction 579 580 // (3) dead time correction 581 // TODO: 582 // x- remove the hard-wired test - done 583 // -- test for correct operation 584 // x- loop over all of the detectors 585 // x- B detector is a special case (do separately, then loop over NoB) 586 // -- this DOES alter the data 587 // -- verify the error propagation (not done yet) 588 // 589 Variable countRate 590 NVAR gDoDeadTimeCor = root:Packages:NIST:VSANS:Globals:gDoDeadTimeCor 591 if (gDoDeadTimeCor == 1) 592 Print "Doing DeadTime correction"// for "+ detStr 593 for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 594 detStr = StringFromList(ii, ksDetectorListAll, ";") 595 Wave w = V_getDetectorDataW(fname,detStr) 596 Wave w_err = V_getDetectorDataErrW(fname,detStr) 597 ctTime = V_getCount_time(fname) 598 599 if(cmpstr(detStr,"B") == 0) 600 Variable b_dt = V_getDetector_deadtime_B(fname,detStr) 601 // do the correction for the back panel 602 countRate = sum(w,-inf,inf)/ctTime //use sum of detector counts 603 604 w = w/(1-countRate*b_dt) 605 w_err = w_err/(1-countRate*b_dt) 606 607 else 608 // do the corrections for 8 tube panels 609 Wave w_dt = V_getDetector_deadtime(fname,detStr) 610 V_DeadTimeCorrectionTubes(w,w_err,w_dt,ctTime) 611 612 endif 613 endfor 614 615 else 616 Print "Dead Time correction NOT DONE" 617 endif 618 619 620 // (4) solid angle correction 465 621 // TODO -- this currently calculates the correction factor AND applys it to the data 466 622 // -- as a result, the data values are very large since they are divided by a very small … … 485 641 endif 486 642 487 // (4) dead time correction 488 // TODO: 489 // x- remove the hard-wired test - done 490 // -- test for correct operation 491 // x- loop over all of the detectors 492 // x- B detector is a special case (do separately, then loop over NoB) 493 // -- this DOES alter the data 494 // -- verify the error propagation (not done yet) 495 // 496 Variable countRate 497 NVAR gDoDeadTimeCor = root:Packages:NIST:VSANS:Globals:gDoDeadTimeCor 498 if (gDoDeadTimeCor == 1) 499 Print "Doing DeadTime correction"// for "+ detStr 500 for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 501 detStr = StringFromList(ii, ksDetectorListAll, ";") 502 Wave w = V_getDetectorDataW(fname,detStr) 503 Wave w_err = V_getDetectorDataErrW(fname,detStr) 504 ctTime = V_getCount_time(fname) 505 506 if(cmpstr(detStr,"B") == 0) 507 Variable b_dt = V_getDetector_deadtime_B(fname,detStr) 508 // do the correction for the back panel 509 countRate = sum(w,-inf,inf)/ctTime //use sum of detector counts 510 511 w = w/(1-countRate*b_dt) 512 w_err = w_err/(1-countRate*b_dt) 513 514 else 515 // do the corrections for 8 tube panels 516 Wave w_dt = V_getDetector_deadtime(fname,detStr) 517 V_DeadTimeCorrectionTubes(w,w_err,w_dt,ctTime) 518 519 endif 520 endfor 521 522 else 523 Print "Dead Time correction NOT DONE" 524 endif 525 526 643 527 644 // (5) angle-dependent tube shadowing 528 645 // TODO:
Note: See TracChangeset
for help on using the changeset viewer.