Changeset 1073 for sans/Dev/trunk
- Timestamp:
- Nov 16, 2017 10:57:32 AM (5 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VSANS_Includes.ipf
r1071 r1073 16 16 #include "PlotManager_v40" 17 17 #include "NIST_XML_v40" 18 // 19 //#include "NCNR_Utils" //needed to load linear fits, mostly VAX file name junk 20 //#include "LinearizedFits_v40" //won't compile - needs NCNR_Utils (then starts a chain of dependencies...) 18 21 19 22 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Attenuation.ipf
r1071 r1073 3 3 4 4 5 // 6 // 7-NOV-2017 7 // 8 // The attenuator tables are more complex now - since there are more ways to select wavelength 9 // - there is the standard velocity selector (no tilt) 10 // - a white beam mode (with a non-symmetric distribution) 11 // - a graphite monochromator, allowing wavelength selection 12 // 13 // To accomodate this, I have chosen to alter the table to allow all of the wavelength "modes" 14 // to be in the same table for interpolation, by use of the "correct" input wavelength 15 // velocity_selector lambda is input as is 16 // white beam lambda = (lambda * 1e3) 17 // graphite crystal lambda = (lambda * 1e6) 18 // 19 // in this way, the interpolation will work just fine. Otherwise, the only solution I could see was to 20 // have separate tables stored in the header for each of the "modes". 21 // 22 // 23 24 // 5 25 // functions to calculate attenuator values from the tables 6 26 // … … 9 29 // 10 30 // interpolate if necessary 11 31 // 12 32 13 33 // … … 15 35 // 16 36 // 17 // 18 19 20 // attenuator tables are currently /N=(8,17) 37 // attenuator tables are currently /N=(n,17) 21 38 22 39 … … 54 71 Proc V_WriteCSVAttenTable(lo,hi,atten_values) 55 72 Variable lo,hi 56 String atten_values 73 String atten_values="atten_values" 57 74 58 75 V_fPatchAttenValueTable(lo,hi,$atten_values) … … 61 78 Proc V_WriteCSVAttenErrTable(lo,hi,atten_err) 62 79 Variable lo,hi 63 String atten_err 80 String atten_err="atten_err" 64 81 65 82 V_fPatchAttenErrTable(lo,hi,$atten_err) … … 78 95 String fname 79 96 80 // check the dimensions of the attenW (8,17)81 if (DimSize(attenW, 0) != 8 || DimSize(attenW, 1) != 17 )82 Abort "attenuator wave is not of proper dimension (8,17)"83 endif97 // // check the dimensions of the attenW (8,17) 98 // if (DimSize(attenW, 0) != 8 || DimSize(attenW, 1) != 17 ) 99 // Abort "attenuator wave is not of proper dimension (8,17)" 100 // endif 84 101 85 102 //loop over all files … … 107 124 String fname 108 125 109 // check the dimensions of the attenW (8,17)110 if (DimSize(attenW, 0) != 8 || DimSize(attenW, 1) != 17 )111 Abort "attenuator wave is not of proper dimension (8,17)"112 endif126 // // check the dimensions of the attenW (8,17) 127 // if (DimSize(attenW, 0) != 8 || DimSize(attenW, 1) != 17 ) 128 // Abort "attenuator wave is not of proper dimension (8,17)" 129 // endif 113 130 114 131 //loop over all files … … 132 149 // 133 150 // fill in a "dummy" wavelength for White Beam and graphite 134 // == 100for White Beam135 // == 1000for graphite151 // *= 1e3 for White Beam 152 // *= 1e6 for graphite 136 153 // use these dummy values just for the lookup table 137 154 // 138 155 // TODO -- need the enumerated values for the monochromator type 139 156 // TODO -- V_getMonochromatorType(fname) is NOT written correctly by NICE 140 // 157 // TODO -- determine the dimensions of the wave, don't hard-wire 158 // TODO -- update to use separate tables for each monochromator mode 159 // TODO -- (same updates for the error table) 141 160 // 142 161 Function V_CalculateAttenuationFactor(fname) … … 162 181 break // exit from switch 163 182 case "white_beam": // execute if case matches expression 164 lambda = 100183 lambda *= 1e3 165 184 break 166 185 case "crystal": 167 lambda = 1000186 lambda *= 1e6 168 187 break 169 188 default: // optional default expression executed … … 172 191 173 192 174 Wave w = V_getAttenIndex_table(fname) // N=(8,17) 175 Make/O/D/N=8 tmpVal,tmpLam 193 Wave w = V_getAttenIndex_table(fname) // N=(x,17) 194 Variable num = DimSize(w,0) 195 Make/O/D/N=(num) tmpVal,tmpLam 176 196 177 197 tmpVal = w[p][numAtt+1] // offset by one, 1st column is wavelength 178 198 tmpLam = w[p][0] 179 199 val = interp(lambda, tmpLam, tmpVal ) 200 Print "Calculated Atten = ",val 180 201 181 202 //killwaves/Z tmpVal,tmpLam … … 189 210 // 190 211 // fill in a "dummy" wavelength for White Beam and graphite 191 // == 100for White Beam192 // == 1000for graphite212 // *= 1e3 for White Beam 213 // *= 1e6 for graphite 193 214 // use these dummy values just for the lookup table 194 215 // … … 196 217 // TODO -- V_getMonochromatorType(fname) is NOT written correctly by NICE 197 218 // 219 // 198 220 Function V_CalculateAttenuationError(fname) 199 221 String fname … … 206 228 207 229 // TODO -- need to switch on "type" 208 // == velocity_selector || ?? for white beam || graphite230 // == velocity_selector || ?? for white beam || crystal 209 231 // monoType = V_getMonochromatorType(fname) 210 232 … … 217 239 break // exit from switch 218 240 case "white_beam": // execute if case matches expression 219 lambda = 100241 lambda *= 1e3 220 242 break 221 243 case "crystal": 222 lambda = 1000244 lambda *= 1e6 223 245 break 224 246 default: // optional default expression executed … … 226 248 endswitch 227 249 228 Wave w = V_getAttenIndex_error_table(fname) // N=(8,17) 229 Make/O/D/N=8 tmpVal,tmpLam 250 Wave w = V_getAttenIndex_error_table(fname) // N=(x,17) 251 Variable num = DimSize(w,0) 252 Make/O/D/N=(num) tmpVal,tmpLam 230 253 231 254 tmpVal = w[p][numAtt+1] // offset by one, 1st column is wavelength -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DataPlotting.ipf
r1050 r1073 408 408 SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType 409 409 410 V_QBinAllPanels_Circular(type,popNum) 410 // dispatch based on the string, not on the number of selection in the pop string 411 V_QBinAllPanels_Circular(type,V_BinTypeStr2Num(popStr)) 411 412 412 413 String str,winStr="V_1D_Data",workTypeStr 413 414 workTypeStr = "root:Packages:NIST:VSANS:"+type 414 415 415 sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr, popNum,winStr416 sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,V_BinTypeStr2Num(popStr),winStr 416 417 417 418 Execute ("V_Back_IQ_Graph"+str) … … 460 461 461 462 // clear EVERYTHING 462 463 ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr) 464 ClearIQIfDisplayed_AllFldr("MLR",winNameStr) 465 ClearIQIfDisplayed_AllFldr("MTB",winNameStr) //this returns to root: 466 ClearIQIfDisplayed_AllFldr("MT",winNameStr) 467 ClearIQIfDisplayed_AllFldr("ML",winNameStr) 468 ClearIQIfDisplayed_AllFldr("MR",winNameStr) 469 ClearIQIfDisplayed_AllFldr("MB",winNameStr) 470 471 472 // then replace the traces as needed, depending on the binType 463 473 464 474 if(binType==1) 465 ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr) 466 ClearIQIfDisplayed_AllFldr("MLR",winNameStr) 467 ClearIQIfDisplayed_AllFldr("MTB",winNameStr) //this returns to root: 468 ClearIQIfDisplayed_AllFldr("MT",winNameStr) 469 ClearIQIfDisplayed_AllFldr("ML",winNameStr) 470 ClearIQIfDisplayed_AllFldr("MR",winNameStr) 471 ClearIQIfDisplayed_AllFldr("MB",winNameStr) 475 472 476 SetDataFolder $(fullPathToFolder) 473 477 CheckDisplayed/W=$winNameStr iBin_qxqy_ML … … 495 499 496 500 if(binType==2) 497 // clear EVERYTHING498 ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr)499 ClearIQIfDisplayed_AllFldr("MLR",winNameStr)500 ClearIQIfDisplayed_AllFldr("MTB",winNameStr) //this returns to root:501 ClearIQIfDisplayed_AllFldr("MT",winNameStr)502 ClearIQIfDisplayed_AllFldr("ML",winNameStr)503 ClearIQIfDisplayed_AllFldr("MR",winNameStr)504 ClearIQIfDisplayed_AllFldr("MB",winNameStr)505 506 // ClearIQIfDisplayed_AllFldr("MLRTB")507 // ClearIQIfDisplayed_AllFldr("MT")508 // ClearIQIfDisplayed_AllFldr("ML")509 // ClearIQIfDisplayed_AllFldr("MR")510 // ClearIQIfDisplayed_AllFldr("MB")511 512 513 501 SetDataFolder $(fullPathToFolder) 514 502 CheckDisplayed/W=$winNameStr iBin_qxqy_MLR … … 535 523 536 524 if(binType==3) 537 // clear EVERYTHING 538 ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr) 539 ClearIQIfDisplayed_AllFldr("MLR",winNameStr) 540 ClearIQIfDisplayed_AllFldr("MTB",winNameStr) //this returns to root: 541 ClearIQIfDisplayed_AllFldr("MT",winNameStr) 542 ClearIQIfDisplayed_AllFldr("ML",winNameStr) 543 ClearIQIfDisplayed_AllFldr("MR",winNameStr) 544 ClearIQIfDisplayed_AllFldr("MB",winNameStr) 545 546 // ClearIQIfDisplayed_AllFldr("MLR") 547 // ClearIQIfDisplayed_AllFldr("MTB") 548 // ClearIQIfDisplayed_AllFldr("MT") 549 // ClearIQIfDisplayed_AllFldr("ML") 550 // ClearIQIfDisplayed_AllFldr("MR") 551 // ClearIQIfDisplayed_AllFldr("MB") 552 525 553 526 SetDataFolder $(fullPathToFolder) 554 527 CheckDisplayed/W=$winNameStr iBin_qxqy_MLRTB … … 572 545 573 546 if(binType==4) // slit aperture binning - MT, ML, MR, MB are averaged 574 // clear EVERYTHING 575 ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr) 576 ClearIQIfDisplayed_AllFldr("MLR",winNameStr) 577 ClearIQIfDisplayed_AllFldr("MTB",winNameStr) //this returns to root: 578 ClearIQIfDisplayed_AllFldr("MT",winNameStr) 579 ClearIQIfDisplayed_AllFldr("ML",winNameStr) 580 ClearIQIfDisplayed_AllFldr("MR",winNameStr) 581 ClearIQIfDisplayed_AllFldr("MB",winNameStr) 582 583 584 // ClearIQIfDisplayed_AllFldr("MLRTB") 585 // ClearIQIfDisplayed_AllFldr("MLR") 586 // ClearIQIfDisplayed_AllFldr("MTB") 587 547 588 548 SetDataFolder $(fullPathToFolder) 589 549 CheckDisplayed/W=$winNameStr iBin_qxqy_ML … … 592 552 AppendToGraph/W=$winNameStr iBin_qxqy_ML vs qBin_qxqy_ML 593 553 AppendToGraph/W=$winNameStr iBin_qxqy_MR vs qBin_qxqy_MR 594 AppendToGraph/W=$winNameStr iBin_qxqy_MT vs qBin_qxqy_MT595 AppendToGraph/W=$winNameStr iBin_qxqy_MB vs qBin_qxqy_MB554 // AppendToGraph/W=$winNameStr iBin_qxqy_MT vs qBin_qxqy_MT 555 // AppendToGraph/W=$winNameStr iBin_qxqy_MB vs qBin_qxqy_MB 596 556 ErrorBars/T=0 iBin_qxqy_ML Y,wave=(:eBin_qxqy_ML,:eBin_qxqy_ML) 597 557 ErrorBars/T=0 iBin_qxqy_MR Y,wave=(:eBin_qxqy_MR,:eBin_qxqy_MR) 598 ErrorBars/T=0 iBin_qxqy_MT Y,wave=(:eBin_qxqy_MT,:eBin_qxqy_MT)599 ErrorBars/T=0 iBin_qxqy_MB Y,wave=(:eBin_qxqy_MB,:eBin_qxqy_MB)558 // ErrorBars/T=0 iBin_qxqy_MT Y,wave=(:eBin_qxqy_MT,:eBin_qxqy_MT) 559 // ErrorBars/T=0 iBin_qxqy_MB Y,wave=(:eBin_qxqy_MB,:eBin_qxqy_MB) 600 560 601 561 ModifyGraph/W=$winNameStr mode=4 602 562 ModifyGraph/W=$winNameStr marker=19 603 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_ML)=(65535,0,0),rgb(iBin_qxqy_MB)=(1,16019,65535),rgb(iBin_qxqy_MR)=(65535,0,0),rgb(iBin_qxqy_MT)=(1,16019,65535) 563 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_ML)=(65535,0,0),rgb(iBin_qxqy_MR)=(65535,0,0) 564 // ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MB)=(1,16019,65535),rgb(iBin_qxqy_MT)=(1,16019,65535) 604 565 ModifyGraph/W=$winNameStr msize=2 605 ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8} 566 ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MR)={0,8} 567 // ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_MB)={0,2} 606 568 ModifyGraph/W=$winNameStr grid=1 607 569 ModifyGraph/W=$winNameStr log=1 608 570 ModifyGraph/W=$winNameStr mirror=2 609 571 endif 572 573 endif 574 575 if(binType==5) 576 577 SetDataFolder $(fullPathToFolder) 578 CheckDisplayed/W=$winNameStr iBin_qxqy_MLRTB 579 580 if(V_flag==0) 581 AppendtoGraph/W=$winNameStr iBin_qxqy_MLRTB vs qBin_qxqy_MLRTB 582 ErrorBars/T=0 iBin_qxqy_MLRTB Y,wave=(:eBin_qxqy_MLRTB,:eBin_qxqy_MLRTB) 583 584 ModifyGraph/W=$winNameStr mode=4 585 ModifyGraph/W=$winNameStr marker=19 586 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MLRTB)=(65535,0,0) 587 ModifyGraph/W=$winNameStr msize=2 588 ModifyGraph/W=$winNameStr grid=1 589 ModifyGraph/W=$winNameStr log=1 590 ModifyGraph/W=$winNameStr mirror=2 591 Label/W=$winNameStr left "Intensity (1/cm)" 592 Label/W=$winNameStr bottom "Q (1/A)" 593 endif 594 595 endif 596 597 if(binType==6) 598 599 SetDataFolder $(fullPathToFolder) 600 CheckDisplayed/W=$winNameStr iBin_qxqy_MLR 601 602 if(V_flag==0) 603 AppendtoGraph/W=$winNameStr iBin_qxqy_MLR vs qBin_qxqy_MLR 604 ErrorBars/T=0 iBin_qxqy_MLR Y,wave=(:eBin_qxqy_MLR,:eBin_qxqy_MLR) 605 606 ModifyGraph/W=$winNameStr mode=4 607 ModifyGraph/W=$winNameStr marker=19 608 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MLR)=(65535,0,0) 609 ModifyGraph/W=$winNameStr msize=2 610 ModifyGraph/W=$winNameStr grid=1 611 ModifyGraph/W=$winNameStr log=1 612 ModifyGraph/W=$winNameStr mirror=2 613 Label/W=$winNameStr left "Intensity (1/cm)" 614 Label/W=$winNameStr bottom "Q (1/A)" 615 endif 616 617 endif 618 619 if(binType==7) 620 621 SetDataFolder $(fullPathToFolder) 622 CheckDisplayed/W=$winNameStr iBin_qxqy_MLR 623 624 if(V_flag==0) 625 AppendtoGraph/W=$winNameStr iBin_qxqy_MLR vs qBin_qxqy_MLR 626 ErrorBars/T=0 iBin_qxqy_MLR Y,wave=(:eBin_qxqy_MLR,:eBin_qxqy_MLR) 627 628 ModifyGraph/W=$winNameStr mode=4 629 ModifyGraph/W=$winNameStr marker=19 630 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MLR)=(65535,0,0) 631 ModifyGraph/W=$winNameStr msize=2 632 ModifyGraph/W=$winNameStr grid=1 633 ModifyGraph/W=$winNameStr log=1 634 ModifyGraph/W=$winNameStr mirror=2 635 Label/W=$winNameStr left "Intensity (1/cm)" 636 Label/W=$winNameStr bottom "Q (1/A)" 637 endif 610 638 611 639 endif … … 635 663 636 664 // clear EVERYTHING 637 // ClearIQIfDisplayed_AllFldr("FLRTB")638 //639 // ClearIQIfDisplayed_AllFldr("FLR")640 // ClearIQIfDisplayed_AllFldr("FTB")641 // 642 // ClearIQIfDisplayed_AllFldr("FT")643 // ClearIQIfDisplayed_AllFldr("FL")644 // ClearIQIfDisplayed_AllFldr("FR")645 // ClearIQIfDisplayed_AllFldr("FB")665 ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr) 666 667 ClearIQIfDisplayed_AllFldr("FLR",winNameStr) 668 ClearIQIfDisplayed_AllFldr("FTB",winNameStr) 669 670 ClearIQIfDisplayed_AllFldr("FT",winNameStr) 671 ClearIQIfDisplayed_AllFldr("FL",winNameStr) 672 ClearIQIfDisplayed_AllFldr("FR",winNameStr) 673 ClearIQIfDisplayed_AllFldr("FB",winNameStr) 646 674 647 675 if(binType==1) 648 ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr) 649 650 ClearIQIfDisplayed_AllFldr("FLR",winNameStr) 651 ClearIQIfDisplayed_AllFldr("FTB",winNameStr) 652 653 ClearIQIfDisplayed_AllFldr("FT",winNameStr) 654 ClearIQIfDisplayed_AllFldr("FL",winNameStr) 655 ClearIQIfDisplayed_AllFldr("FR",winNameStr) 656 ClearIQIfDisplayed_AllFldr("FB",winNameStr) 657 676 658 677 SetDataFolder $(fullPathToFolder) 659 678 CheckDisplayed/W=$winNameStr iBin_qxqy_FL … … 683 702 684 703 if(binType==2) 685 // clear EVERYTHING686 ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr)687 688 ClearIQIfDisplayed_AllFldr("FLR",winNameStr)689 ClearIQIfDisplayed_AllFldr("FTB",winNameStr)690 691 ClearIQIfDisplayed_AllFldr("FT",winNameStr)692 ClearIQIfDisplayed_AllFldr("FL",winNameStr)693 ClearIQIfDisplayed_AllFldr("FR",winNameStr)694 ClearIQIfDisplayed_AllFldr("FB",winNameStr)695 // ClearIQIfDisplayed_AllFldr("FLRTB")696 // ClearIQIfDisplayed_AllFldr("FT")697 // ClearIQIfDisplayed_AllFldr("FL")698 // ClearIQIfDisplayed_AllFldr("FR")699 // ClearIQIfDisplayed_AllFldr("FB")700 704 701 705 SetDataFolder $(fullPathToFolder) … … 722 726 endif 723 727 724 if(binType==3) 725 // clear EVERYTHING 726 ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr) 727 728 ClearIQIfDisplayed_AllFldr("FLR",winNameStr) 729 ClearIQIfDisplayed_AllFldr("FTB",winNameStr) 730 731 ClearIQIfDisplayed_AllFldr("FT",winNameStr) 732 ClearIQIfDisplayed_AllFldr("FL",winNameStr) 733 ClearIQIfDisplayed_AllFldr("FR",winNameStr) 734 ClearIQIfDisplayed_AllFldr("FB",winNameStr) 735 736 // ClearIQIfDisplayed_AllFldr("FLR") 737 // ClearIQIfDisplayed_AllFldr("FTB") 738 // ClearIQIfDisplayed_AllFldr("FT") 739 // ClearIQIfDisplayed_AllFldr("FL") 740 // ClearIQIfDisplayed_AllFldr("FR") 741 // ClearIQIfDisplayed_AllFldr("FB") 728 if(binType==3) 742 729 743 730 SetDataFolder $(fullPathToFolder) … … 762 749 763 750 if(binType==4) // slit aperture binning - MT, ML, MR, MB are averaged 764 // clear EVERYTHING765 ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr)766 767 ClearIQIfDisplayed_AllFldr("FLR",winNameStr)768 ClearIQIfDisplayed_AllFldr("FTB",winNameStr)769 770 ClearIQIfDisplayed_AllFldr("FT",winNameStr)771 ClearIQIfDisplayed_AllFldr("FL",winNameStr)772 ClearIQIfDisplayed_AllFldr("FR",winNameStr)773 ClearIQIfDisplayed_AllFldr("FB",winNameStr)774 775 776 // ClearIQIfDisplayed_AllFldr("FLRTB")777 // ClearIQIfDisplayed_AllFldr("FLR")778 // ClearIQIfDisplayed_AllFldr("FTB")779 751 780 752 SetDataFolder $(fullPathToFolder) … … 784 756 AppendtoGraph/W=$winNameStr iBin_qxqy_FL vs qBin_qxqy_FL 785 757 AppendToGraph/W=$winNameStr iBin_qxqy_FR vs qBin_qxqy_FR 786 AppendToGraph/W=$winNameStr iBin_qxqy_FT vs qBin_qxqy_FT787 AppendToGraph/W=$winNameStr iBin_qxqy_FB vs qBin_qxqy_FB758 // AppendToGraph/W=$winNameStr iBin_qxqy_FT vs qBin_qxqy_FT 759 // AppendToGraph/W=$winNameStr iBin_qxqy_FB vs qBin_qxqy_FB 788 760 ErrorBars/T=0 iBin_qxqy_FL Y,wave=(:eBin_qxqy_FL,:eBin_qxqy_FL) 789 761 ErrorBars/T=0 iBin_qxqy_FR Y,wave=(:eBin_qxqy_FR,:eBin_qxqy_FR) 790 ErrorBars/T=0 iBin_qxqy_FT Y,wave=(:eBin_qxqy_FT,:eBin_qxqy_FT)791 ErrorBars/T=0 iBin_qxqy_FB Y,wave=(:eBin_qxqy_FB,:eBin_qxqy_FB)762 // ErrorBars/T=0 iBin_qxqy_FT Y,wave=(:eBin_qxqy_FT,:eBin_qxqy_FT) 763 // ErrorBars/T=0 iBin_qxqy_FB Y,wave=(:eBin_qxqy_FB,:eBin_qxqy_FB) 792 764 793 765 ModifyGraph/W=$winNameStr mode=4 794 766 ModifyGraph/W=$winNameStr marker=19 795 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FL)=(39321,26208,1),rgb(iBin_qxqy_FB)=(2,39321,1),rgb(iBin_qxqy_FR)=(39321,26208,1),rgb(iBin_qxqy_FT)=(2,39321,1) 767 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FL)=(39321,26208,1),rgb(iBin_qxqy_FR)=(39321,26208,1) 768 // ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FB)=(2,39321,1),rgb(iBin_qxqy_FT)=(2,39321,1) 796 769 ModifyGraph/W=$winNameStr msize=2 797 ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8} 770 ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FR)={0,8} 771 // ModifyGraph/W=$winNameStr,muloffset(iBin_qxqy_FB)={0,2} 798 772 ModifyGraph/W=$winNameStr grid=1 799 773 ModifyGraph/W=$winNameStr log=1 … … 802 776 803 777 endif 778 779 if(binType==5) 780 781 SetDataFolder $(fullPathToFolder) 782 CheckDisplayed/W=$winNameStr iBin_qxqy_FLR 783 784 if(V_flag==0) 785 AppendtoGraph/W=$winNameStr iBin_qxqy_FLR vs qBin_qxqy_FLR 786 AppendToGraph/W=$winNameStr iBin_qxqy_FTB vs qBin_qxqy_FTB 787 ErrorBars/T=0 iBin_qxqy_FLR Y,wave=(:eBin_qxqy_FLR,:eBin_qxqy_FLR) 788 ErrorBars/T=0 iBin_qxqy_FTB Y,wave=(:eBin_qxqy_FTB,:eBin_qxqy_FTB) 789 790 ModifyGraph/W=$winNameStr mode=4 791 ModifyGraph/W=$winNameStr marker=19 792 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FLR)=(39321,26208,1),rgb(iBin_qxqy_FTB)=(2,39321,1) 793 ModifyGraph/W=$winNameStr msize=2 794 ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FLR)={0,2} 795 ModifyGraph/W=$winNameStr grid=1 796 ModifyGraph/W=$winNameStr log=1 797 ModifyGraph/W=$winNameStr mirror=2 798 // Label/W=$winNameStr left "Intensity (1/cm)" 799 // Label/W=$winNameStr bottom "Q (1/A)" 800 endif 801 802 endif 803 804 if(binType==6) 805 806 SetDataFolder $(fullPathToFolder) 807 CheckDisplayed/W=$winNameStr iBin_qxqy_FLRTB 808 809 if(V_flag==0) 810 AppendtoGraph/W=$winNameStr iBin_qxqy_FLRTB vs qBin_qxqy_FLRTB 811 ErrorBars/T=0 iBin_qxqy_FLRTB Y,wave=(:eBin_qxqy_FLRTB,:eBin_qxqy_FLRTB) 812 813 ModifyGraph/W=$winNameStr mode=4 814 ModifyGraph/W=$winNameStr marker=19 815 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FLRTB)=(39321,26208,1) 816 ModifyGraph/W=$winNameStr msize=2 817 ModifyGraph/W=$winNameStr grid=1 818 ModifyGraph/W=$winNameStr log=1 819 ModifyGraph/W=$winNameStr mirror=2 820 Label/W=$winNameStr left "Intensity (1/cm)" 821 Label/W=$winNameStr bottom "Q (1/A)" 822 endif 823 824 endif 825 826 if(binType==7) 827 828 SetDataFolder $(fullPathToFolder) 829 CheckDisplayed/W=$winNameStr iBin_qxqy_FLR 830 831 if(V_flag==0) 832 AppendtoGraph/W=$winNameStr iBin_qxqy_FLR vs qBin_qxqy_FLR 833 AppendToGraph/W=$winNameStr iBin_qxqy_FTB vs qBin_qxqy_FTB 834 ErrorBars/T=0 iBin_qxqy_FLR Y,wave=(:eBin_qxqy_FLR,:eBin_qxqy_FLR) 835 ErrorBars/T=0 iBin_qxqy_FTB Y,wave=(:eBin_qxqy_FTB,:eBin_qxqy_FTB) 836 837 ModifyGraph/W=$winNameStr mode=4 838 ModifyGraph/W=$winNameStr marker=19 839 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FLR)=(39321,26208,1),rgb(iBin_qxqy_FTB)=(2,39321,1) 840 ModifyGraph/W=$winNameStr msize=2 841 ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FLR)={0,2} 842 ModifyGraph/W=$winNameStr grid=1 843 ModifyGraph/W=$winNameStr log=1 844 ModifyGraph/W=$winNameStr mirror=2 845 // Label/W=$winNameStr left "Intensity (1/cm)" 846 // Label/W=$winNameStr bottom "Q (1/A)" 847 endif 848 849 endif 850 804 851 805 852 SetDataFolder root: … … 829 876 // binType = V_GetBinningPopMode() 830 877 878 ClearIQIfDisplayed_AllFldr("B",winNameStr) 879 831 880 832 881 SetDataFolder $(fullPathToFolder) 833 882 883 // if(binType==1 || binType==2 || binType==3) 834 884 if(binType==1 || binType==2 || binType==3) 835 885 836 ClearIQIfDisplayed_AllFldr("B",winNameStr)837 886 SetDataFolder $(fullPathToFolder) 838 887 CheckDisplayed/W=$winNameStr iBin_qxqy_B … … 851 900 endif 852 901 853 // ClearIQIfDisplayed_AllFldr("B")854 // SetDataFolder $(fullPathToFolder)855 // CheckDisplayed/W=V_1D_Data iBin_qxqy_B856 //857 // if(V_flag==0)858 // AppendtoGraph/W=V_1D_Data iBin_qxqy_B vs qBin_qxqy_B859 // ModifyGraph/W=V_1D_Data mode=4860 // ModifyGraph/W=V_1D_Data marker=19861 // ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_B)=(1,52428,52428)862 // ModifyGraph/W=V_1D_Data msize=2863 // ModifyGraph/W=V_1D_Data grid=1864 // ModifyGraph/W=V_1D_Data log=1865 // ModifyGraph/W=V_1D_Data mirror=2866 // endif867 868 902 endif 869 903 … … 871 905 if(binType==4) 872 906 873 ClearIQIfDisplayed_AllFldr("B",winNameStr)874 907 SetDataFolder $(fullPathToFolder) // ClearIQIfDisplayed_AllFldr() resets to root: 875 908 CheckDisplayed/W=$winNameStr iBin_qxqy_B … … 885 918 ModifyGraph/W=$winNameStr mirror=2 886 919 endif 920 endif 921 922 if(binType==5 || binType==6 || binType==7) 923 924 SetDataFolder $(fullPathToFolder) 925 CheckDisplayed/W=$winNameStr iBin_qxqy_B 926 927 if(V_flag==0) 928 AppendtoGraph/W=$winNameStr iBin_qxqy_B vs qBin_qxqy_B 929 ErrorBars/T=0 iBin_qxqy_B Y,wave=(:eBin_qxqy_B,:eBin_qxqy_B) 930 ModifyGraph/W=$winNameStr mode(iBin_qxqy_B)=4 931 ModifyGraph/W=$winNameStr rgb(iBin_qxqy_B)=(1,52428,52428) 932 ModifyGraph/W=$winNameStr grid=1 933 ModifyGraph/W=$winNameStr log=1 934 ModifyGraph/W=$winNameStr mirror=2 935 ModifyGraph/W=$winNameStr marker(iBin_qxqy_B)=19,msize(iBin_qxqy_B)=2 936 // ModifyGraph/W=$winNameStr msize(iBin_qxqy_B)=3,textMarker(iBin_qxqy_B)={"B","default",1,0,5,0.00,0.00} 937 938 endif 939 887 940 endif 888 941 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf
r1071 r1073 27 27 // same old equation, just written in a more complex form. 28 28 // 29 // TODO29 // (DONE) 30 30 // x- verify the direction of the tubes and indexing 31 31 // x- decide on the appropriate functional form for the tubes … … 109 109 // 110 110 // 111 // TODO 112 // -- UNITS!!!! currently this is mm, which certainly doesn't match anything else!!! 111 // (DONE) 112 // x- UNITS!!!! currently this is mm, which certainly doesn't match anything else!!! 113 // 113 114 // x- verify the direction of the tubes and indexing 114 115 // x- be sure I'm working in the right data folder (it is passed in, and the full path is used) … … 151 152 152 153 // TODO 153 // -- GAP IS HARD-WIRED 154 // -- GAP IS HARD-WIRED as a single constant value (there really are 4 values) 154 155 Variable offset,gap 155 156 156 157 // kPanelTouchingGap is in mm 158 // the gap is added to the RIGHT and TOP panels ONLY 159 // TODO -- replace with V_getDet_panel_gap(fname,detStr) once it is added to the file 157 160 gap = kPanelTouchingGap 158 161 159 162 if(cmpstr(orientation,"vertical")==0) 160 163 // this is data dimensioned as (Ntubes,Npix) 161 data_realDistX[][] = tube_width*p162 data_realDistY[][] = coefW[0][p] + coefW[1][p]*q + coefW[2][p]*q*q163 164 164 165 // adjust the x postion based on the beam center being nominally (0,0) in units of cm, not pixels … … 180 181 if(kBCTR_CM) 181 182 if(cmpstr("L",detStr[1]) == 0) 182 data_realDistX[][] = offset - (dimX - p)*tube_width // TODO should this be dimX-1-p = 47-p?183 // data_realDistX[][] = -offset - (dimX - p)*tube_width// TODO should this be dimX-1-p = 47-p?183 // data_realDistX[][] = offset - (dimX - p)*tube_width // TODO should this be dimX-1-p = 47-p? 184 data_realDistX[][] = offset - (dimX - p)*tube_width - gap/2 // TODO should this be dimX-1-p = 47-p? 184 185 else 185 data_realDistX[][] += offset + gap + tube_width //add to the Right det, not recalculate 186 // right 187 // data_realDistX[][] = tube_width*(p+1) + offset + gap //add to the Right det, 188 data_realDistX[][] = tube_width*(p+1) + offset + gap/2 //add to the Right det 186 189 endif 190 else 191 data_realDistX[][] = tube_width*(p) 187 192 endif 193 data_realDistY[][] = coefW[0][p] + coefW[1][p]*q + coefW[2][p]*q*q 188 194 189 195 190 196 elseif(cmpstr(orientation,"horizontal")==0) 191 197 // this is data (horizontal) dimensioned as (Npix,Ntubes) 192 data_realDistX[][] = coefW[0][q] + coefW[1][q]*p + coefW[2][q]*p*p193 198 data_realDistY[][] = tube_width*q 194 199 … … 208 213 if(kBCTR_CM) 209 214 if(cmpstr("T",detStr[1]) == 0) 210 data_realDistY[][] += offset + gap + tube_width 215 // data_realDistY[][] = tube_width*(q+1) + offset + gap 216 data_realDistY[][] = tube_width*(q+1) + offset + gap/2 211 217 else 212 data_realDistY[][] = offset - (dimY - q)*tube_width // TODO should this be dimY-1-q = 47-q? 218 // bottom 219 // data_realDistY[][] = offset - (dimY - q)*tube_width // TODO should this be dimY-1-q = 47-q? 220 data_realDistY[][] = offset - (dimY - q)*tube_width - gap/2 // TODO should this be dimY-1-q = 47-q? 213 221 endif 222 else 223 data_realDistY[][] = tube_width*(q) 214 224 endif 225 data_realDistX[][] = coefW[0][q] + coefW[1][q]*p + coefW[2][q]*p*p 215 226 216 227 else … … 325 336 // 326 337 // 327 // TODO328 // -- VERIFY the calculations329 // -- verify where this needs to be done (if the beam center is changed)330 // -- then the q-calculation needs to be re-done331 // -- the position along the tube length is referenced to tube[0], for no particular reason338 // (DONE) 339 // x- VERIFY the calculations 340 // x- verify where this needs to be done (if the beam center is changed) 341 // x- then the q-calculation needs to be re-done 342 // x- the position along the tube length is referenced to tube[0], for no particular reason 332 343 // It may be better to take an average? but [0] is an ASSUMPTION 333 // -- distance along tube is simple interpolation, or do I use the coefficients to334 // calculate the actual value335 // 336 // -- distance in the lateral direction is based on tube width, which is a fixed parameter337 // 344 // x- distance along tube is simple interpolation 345 // 346 // x- distance in the lateral direction is based on tube width, which is a fixed parameter 347 // 348 // the value in pixels is written to the local data folder, NOT to disk (it is recalculated as needed) 338 349 // 339 350 Function V_ConvertBeamCtr_to_pix(folder,detStr,destPath) … … 364 375 365 376 variable edge,delta 377 Variable gap = kPanelTouchingGap // TODO: -- replace with V_getDet_panel_gap(fname,detStr) 366 378 367 379 // … … 377 389 // R panel 378 390 edge = data_realDistX[0][0] 379 delta = abs(xCtr*10 - edge + kPanelTouchingGap)391 delta = abs(xCtr*10 - edge + gap) 380 392 x_pix[0] = -delta/tube_width //since the left edge of the R panel is pixel 0 381 393 endif … … 394 406 if(cmpstr("T",detStr[1]) == 0) 395 407 edge = data_realDistY[0][0] //tube 0 396 delta = abs(yCtr*10 - edge + kPanelTouchingGap)408 delta = abs(yCtr*10 - edge + gap) 397 409 y_pix[0] = -delta/tube_width //since the bottom edge of the T panel is pixel 0 398 410 else … … 478 490 //// 479 491 480 // TODO 481 // get rid of this in the real data 492 482 493 // 483 494 // TESTING ONLY … … 496 507 497 508 498 // TODO499 // get rid of this in the real data500 509 // 501 510 // TESTING ONLY … … 549 558 550 559 // 551 // TODO:552 // -- MUST VERIFY the definition of SDD and how (if) setback is written to the data files553 // -- currently I'm assuming that the SDD is the "nominal" value which is correct for the560 // (DONE) 561 // x- MUST VERIFY the definition of SDD and how (if) setback is written to the data files 562 // x- currently I'm assuming that the SDD is the "nominal" value which is correct for the 554 563 // L/R panels, but is not correct for the T/B panels (must add in the setback) 555 564 // … … 609 618 //function to calculate the overall q-value, given all of the necesary trig inputs 610 619 // 611 // TODO:612 // -- verify the calculation (accuracy - in all input conditions)613 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated614 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding620 // (DONE) 621 // x- verify the calculation (accuracy - in all input conditions) 622 // x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 623 // x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 615 624 // to each pixel 616 625 // … … 642 651 643 652 //calculates just the q-value in the x-direction on the detector 644 // TODO:645 // -- verify the calculation (accuracy - in all input conditions)646 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated647 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding653 // (DONE) 654 // x- verify the calculation (accuracy - in all input conditions) 655 // x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 656 // x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 648 657 // to each pixel 649 658 // … … 676 685 677 686 //calculates just the q-value in the y-direction on the detector 678 // TODO:679 // -- verify the calculation (accuracy - in all input conditions)680 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated681 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding687 // (DONE) 688 // x- verify the calculation (accuracy - in all input conditions) 689 // x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 690 // x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 682 691 // to each pixel 683 692 // … … 710 719 711 720 //calculates just the q-value in the z-direction on the detector 712 // TODO:713 // -- verify the calculation (accuracy - in all input conditions)714 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated715 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding721 // (DONE) 722 // x- verify the calculation (accuracy - in all input conditions) 723 // x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 724 // x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 716 725 // to each pixel 717 726 // 718 727 // not actually used for any calculations, but here for completeness if anyone asks, or for 2D data export 719 728 // 720 // this properly accounts for qz 729 // this properly accounts for qz, because it is qz 721 730 // 722 731 Function V_CalcQZ(xaxval,yaxval,xctr,yctr,sdd,lam,distX,distY) … … 745 754 746 755 // 747 // TODO -- VERIFY calculations 748 // -- This is the actual solid angle per pixel, not a ratio vs. some "unit SA" 756 // (DONE) 757 // x- VERIFY calculations 758 // x- This is the actual solid angle per pixel, not a ratio vs. some "unit SA" 749 759 // Do I just correct for the different area vs. the "nominal" central area? 750 // -- decide how to implement - eitherdirectly change the data values (as was done in the past)751 // or use this as a weighting for when the data is binned to I(q). In the second method, 2D data752 // would need this to be applied before exporting 753 // -- do I keep a wave note indicating that this correction has been applied to the data754 // so that it can be "un-applied"? 755 // -- do I calculate theta from geometry directly, or get it from Q (Assuming it's present?)756 // ( probablyjust from geometry, since I need SDD and dx and dy values...)760 // x- decide how to implement - YES - directly change the data values (as was done in the past) 761 // or (NOT done this way...use this as a weighting for when the data is binned to I(q). In the second method, 2D data 762 // would need this to be applied before exporting) 763 // x- do I keep a wave note indicating that this correction has been applied to the data 764 // so that it can be "un-applied"? NO 765 // x- do I calculate theta from geometry directly, or get it from Q (Assuming it's present?) 766 // (YES just from geometry, since I need SDD and dx and dy values...) 757 767 // 758 768 // … … 827 837 w /= solid_angle 828 838 829 830 // TODO: 839 // 831 840 // correctly apply the correction to the error wave (assume a perfect value?) 832 w_err /= solid_angle // is this correct??841 w_err /= solid_angle // 833 842 834 843 // TODO -- clean up after I'm satisfied computations are correct … … 844 853 // 845 854 // 846 // TODO : 847 // -- DoAlert 0,"This has not yet been updated for VSANS" 855 // NOV 2017 856 // Currently, this is not called from any VSANS routines. it is only referenced 857 // from V_Add_raw_to_work(), which would add two VSANS raw data files together. This has 858 // not yet been implemented. I am only keeping this function around to be sure that 859 // if/when V_Add_raw_to_work() is implemented, all of the functionality of V_DetCorr() is 860 // properly duplicated. 861 // 862 // 848 863 // 849 864 //performs solid angle and non-linear detector corrections to raw data as it is "added" to a work folder … … 977 992 978 993 979 994 // 995 // Large angle transmission correction 980 996 // 981 997 // DIVIDE the intensity by this correction to get the right answer 982 // TODO: 983 // -- DoAlert 0,"This has not yet been updated for VSANS" 984 // 985 // 986 998 // 999 // 987 1000 // Apply the large angle transmssion correction as the data is converted to WORK 988 1001 // so that whether the data is saved as 2D or 1D, the correction has properly been done. … … 1048 1061 endif 1049 1062 1050 // TODO1051 // -- properly calculate and apply the 2D error propagation1063 // (DONE) 1064 // x- properly calculate and apply the 2D error propagation 1052 1065 if(trans == 1) 1053 1066 lat_err[ii][jj] = 0 //no correction, no error … … 1077 1090 w_err = tmp_err 1078 1091 1079 // TODO:1080 // correctly apply the correction to the error wave (assume a perfect value?)1081 // w_err /= tmp //is this correct??1082 1092 1083 1093 // TODO -- clean up after I'm satisfied computations are correct … … 1127 1137 1128 1138 // 1129 // TODO:1130 1139 // 1131 1140 // kappa comes in as s_izero, so be sure to use 1/kappa_err … … 1256 1265 1257 1266 // 1258 // TODO: 1259 // -- DoAlert 0,"This has not yet been updated for VSANS" 1260 // 1261 //************************ 1262 //unused testing procedure, may not be up-to-date with other procedures 1263 //check before re-implementing 1267 // testing procedure, called from a menu selection 1264 1268 // 1265 1269 Proc V_DIV_a_Workfile(type) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_FileCatalog.ipf
r1064 r1073 17 17 // some experiments (magnetic, rotation, temperature scans, etc.) but are necessary for others. 18 18 // 19 // TODO PRIORITY:19 // (DONE): 20 20 // x- clean up the list of files that now accumulates in the RawVSANS folder!!! Everything is there, including 21 21 // files that are NOT RAW VSANS data (MASK and DIV, but these are HDF) … … 31 31 // clear out the folders in the RawVSANS folder, otherwise any changes/patches written to disk 32 32 // will not be read in, the "bad" local copy will be read in. 33 // TODO:33 // (DONE) 34 34 // x- this *may* be a very slow operation. Warn users. Give them a choice to keep local copies. If 35 35 // the "patched" values are written locally too, then maybe the update from disk is not needed. 36 36 // But typically, I'd like to see that the disk version really did get updated... 37 // --make a background task to periodically "kill" a few of the files? maybe too dangerous.38 // --change the V_GetHeaderInfoToWave function to allow "refreshing" of a single row, say after37 // x- (NO)make a background task to periodically "kill" a few of the files? maybe too dangerous. 38 // x- (NO)change the V_GetHeaderInfoToWave function to allow "refreshing" of a single row, say after 39 39 // a file has been patched - then the disk and local copies are in sync 40 40 // … … 160 160 ModifyTable width(Point)=0 //JUN04, remove point numbers - confuses users since point != run 161 161 162 // TODO:162 // (DONE) 163 163 // x- experimental hook with contextual menu 164 164 // … … 171 171 // clear out the folders in the RawVSANS folder, otherwise any changes/patches written to disk 172 172 // will not be read in, the "bad" local copy will be read in for any subsequent operations. 173 // TODO:173 // (DONE) 174 174 // x- this *may* be a very slow operation. Warn users. Give them a choice to keep local copies? If 175 175 // the "patched" values are written locally too, then maybe the update from disk is not needed. … … 192 192 numitems = ItemsInList(list,";") 193 193 194 // show a progress bar for filling the file catalog 195 Variable indefinite=0,useIgorDraw=1 196 NewPanel /N=ProgressPanel /W=(285,111,739,193) 197 ValDisplay valdisp0,win=ProgressPanel,pos={18,32},size={342,18},limits={0,numitems,0},barmisc={0,0} 198 ValDisplay valdisp0,win=ProgressPanel,value= _NUM:0 199 DrawText 20,24,"Refreshing file catalog... Please Wait..." 200 201 if( indefinite ) 202 ValDisplay valdisp0,win=ProgressPanel,mode= 4 // candy stripe 203 else 204 ValDisplay valdisp0,win=ProgressPanel,mode= 3 // bar with no fractional part 205 endif 206 if( useIgorDraw ) 207 ValDisplay valdisp0,win=ProgressPanel,highColor=(49535,1000,1000) //(0,65535,0) 208 endif 209 Button bStop,win=ProgressPanel,pos={375,32},size={50,20},title="Stop" 210 DoUpdate /W=ProgressPanel /E=1 // mark this as our progress window 211 212 194 213 //loop through all of the files in the list, reading CAT/SHORT information if the file is RAW SANS 195 //***version numbers have been removed***196 214 String str,fullName 197 215 Variable lastPoint … … 232 250 Endif 233 251 ii+=1 252 253 ValDisplay valdisp0,win=ProgressPanel,value= _NUM:ii 254 DoUpdate /W=ProgressPanel 255 234 256 while(ii<numitems) 257 258 KillWindow ProgressPanel 259 235 260 //Now sort them all based on some criterion that may be facility dependent (aim is to order them as collected) 236 261 V_SortWaves() 262 237 263 //Append the files that are not raw files to the list 238 239 264 V_AppendNotRAWFiles(notRAWlist) 240 265 KillWaves/Z notRAWlist … … 245 270 // 246 271 // clean out again, so that the file SAVE is not slow due to the large experiment size 247 // TODOx- decide if this is really necessary (not necessary at this point)272 // (DONE) x- decide if this is really necessary (not necessary at this point) 248 273 // 249 274 // V_CleanOutRawVSANS() … … 339 364 End 340 365 341 //sorts all of the waves of header information using the suffix (A123) 342 //the result is that all of the data is in the order that it was collected, 343 // regardless of how the prefix or run numbers were changed by the user 366 // 344 367 Function V_SortWaves() 345 368 Wave/T GFilenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames" … … 463 486 464 487 // //read the file alphanumeric suffix 465 // // TODOx- this does not exist for VSANS - so is there an equivalent, or delete? ((delete))488 // // (DONE) x- this does not exist for VSANS - so is there an equivalent, or delete? ((delete)) 466 489 // InsertPoints lastPoint,1,GSuffix 467 490 // GSuffix[lastPoint]="unknown" … … 492 515 493 516 //Attenuators 494 // TODO -- this is the "number" of the attenuator, but what is its relation to the 495 // stack of 4 plates? binary representation? 517 // (DONE) x- this is the "number" of the attenuator 496 518 InsertPoints lastPoint,1,GNumAttens 497 519 GNumAttens[lastPoint]=V_getAtten_number(fname) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf
r1072 r1073 468 468 String fname 469 469 470 Print "reading atten transmission" 471 String path = "entry:instrument:attenuator:attenuator_transmission" 472 return(V_getRealValueFromHDF5(fname,path)) 470 Print "Atten read - diverted to calculation" 471 return(V_CalculateAttenuationFactor(fname)) 472 473 // String path = "entry:instrument:attenuator:attenuator_transmission" 474 // return(V_getRealValueFromHDF5(fname,path)) 475 473 476 end 474 477 … … 478 481 String fname 479 482 480 String path = "entry:instrument:attenuator:attenuator_transmission_error" 481 return(V_getRealValueFromHDF5(fname,path)) 483 Print "Atten_err read - diverted to calculation" 484 return(V_CalculateAttenuationError(fname)) 485 486 // String path = "entry:instrument:attenuator:attenuator_transmission_error" 487 // return(V_getRealValueFromHDF5(fname,path)) 488 482 489 end 483 490 … … 1641 1648 End 1642 1649 1650 // gap when panels are "touching" 1651 // units are mm 1652 // returns gap value for TOP and RIGHT 1653 // returns 0 for BACK, BOTTOM and LEFT 1654 // force a return for BACK (no field in file) 1655 // B/L detectors have this field, and it should be set to zero in the file 1656 // 1657 Function V_getDet_panel_gap(fname,detStr) 1658 String fname,detStr 1659 1660 if(cmpstr(detStr,"B") == 0) 1661 return(0) 1662 endif 1663 // if(cmpstr(detStr,"FB") == 0 || cmpstr(detStr,"FL") == 0) 1664 // return(0) 1665 // endif 1666 // if(cmpstr(detStr,"MB") == 0 || cmpstr(detStr,"ML") == 0) 1667 // return(0) 1668 // endif 1669 1670 String path = "entry:instrument:detector_"+detStr+":panel_gap" 1671 return(V_getRealValueFromHDF5(fname,path)) 1672 1673 1674 End 1643 1675 1644 1676 Function/S V_getDetSettings(fname,detStr) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Annular.ipf
r1059 r1073 8 8 // and the number of bins to divide the 360 degree circle 9 9 // 10 // qWidth is +/- around the q-center 10 11 // 11 12 // … … 35 36 // TODO -- binType == 4 (slit mode) should never end up here, as it makes no sense 36 37 // 37 // -- really, the onl ebinning that makes any sense is "one", treating each panel individually,38 // -- really, the only binning that makes any sense is "one", treating each panel individually, 38 39 // so I may scrap the parameter, or ignore it. so don't count on it in the future. 39 40 // … … 56 57 // TODO 57 58 // detStr = "FLRTB" or "MLRTB", depending which panel the q-ring is centered on/ 58 // for now, no crossing of the rings onto different panels59 // for now, no crossing of the rings onto different carriages 59 60 60 61 V_fDoAnnularBin_QxQy2D(folderStr,detStr,qCtr_Ann,qWidth) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Utilities.ipf
r1064 r1073 40 40 // *** When other bin types are developed, DO NOT reassign these numbers. 41 41 // instead, skip the old numbers and assign new ones. 42 // old modes can be removed from the string constant ksBinTypeStr (above), but the 42 // 43 // - the numbers here in the switch can be out of order - it's fine 44 // 45 // old modes can be removed from the string constant ksBinTypeStr(n) (in V_Initialize.ipf), but the 43 46 // mode numbers are what many different binning, plotting, and reduction functions are 44 47 // switching on. In the future, it may be necessary to change the key (everywhere) to a string 45 48 // switch, but for now, stick with the numbers. 49 // 50 // Strconstant ksBinTypeStr = "F4-M4-B;F2-M2-B;F1-M1-B;F2-M1-B;F1-M2xTB-B;F2-M2xTB-B;SLIT-F2-M2-B;" 51 // 52 // 46 53 Function V_BinTypeStr2Num(binStr) 47 54 String binStr … … 49 56 Variable binType 50 57 strswitch(binStr) // string switch 51 case " One":58 case "F4-M4-B": 52 59 binType = 1 53 60 break // exit from switch 54 case " Two":61 case "F2-M2-B": 55 62 binType = 2 56 63 break // exit from switch 57 case "F our":64 case "F1-M1-B": 58 65 binType = 3 59 66 break // exit from switch 60 case "S lit Mode":67 case "SLIT-F2-M2-B": 61 68 binType = 4 62 69 break // exit from switch 63 70 71 case "F2-M1-B": 72 binType = 5 73 break 74 case "F1-M2xTB-B": 75 binType = 6 76 break 77 case "F2-M2xTB-B": 78 binType = 7 79 break 80 64 81 default: // optional default expression executed 65 82 binType = 0 66 83 Abort "Binning mode not found"// when no case matches 67 84 endswitch 85 68 86 return(binType) 69 87 end … … 86 104 // binType = V_GetBinningPopMode() 87 105 88 //// TODO: 89 // 90 // Back detector is handled spearately since there is nothing to combine 91 // 92 delQ = SetDeltaQ(folderStr,"B") 93 94 // dispatch based on binning type 95 if(binType == 1 || binType == 2 || binType == 3) 96 VC_fDoBinning_QxQy2D(folderStr, "B") //normal binning, nothing to combine 97 endif 98 99 // TODO -- this is only a temporary fix for slit mode 100 if(binType == 4) 101 /// this is for a tall, narrow slit mode 102 VC_fBinDetector_byRows(folderStr,"B") 103 endif 104 105 106 107 // these are the binning types where detectors are not combined 108 // other combined binning is below the loop 109 for(ii=0;ii<ItemsInList(ksDetectorListNoB);ii+=1) 110 detStr = StringFromList(ii, ksDetectorListNoB, ";") 106 // set delta Q for binning (used later inside VC_fDoBinning_QxQy2D) 107 for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 108 detStr = StringFromList(ii, ksDetectorListAll, ";") 111 109 112 // set delta Q for binning 113 delQ = SetDeltaQ(folderStr,detStr) 110 delQ = SetDeltaQ(folderStr,detStr) // this sets (overwrites) the global value for each panel type 111 endfor 112 113 114 switch(binType) 115 case 1: 116 VC_fDoBinning_QxQy2D(folderStr,"FL") 117 VC_fDoBinning_QxQy2D(folderStr,"FR") 118 VC_fDoBinning_QxQy2D(folderStr,"FT") 119 VC_fDoBinning_QxQy2D(folderStr,"FB") 120 VC_fDoBinning_QxQy2D(folderStr,"ML") 121 VC_fDoBinning_QxQy2D(folderStr,"MR") 122 VC_fDoBinning_QxQy2D(folderStr,"MT") 123 VC_fDoBinning_QxQy2D(folderStr,"MB") 124 VC_fDoBinning_QxQy2D(folderStr, "B") 125 126 break 127 case 2: 128 VC_fDoBinning_QxQy2D(folderStr,"FLR") 129 VC_fDoBinning_QxQy2D(folderStr,"FTB") 130 VC_fDoBinning_QxQy2D(folderStr,"MLR") 131 VC_fDoBinning_QxQy2D(folderStr,"MTB") 132 VC_fDoBinning_QxQy2D(folderStr, "B") 133 134 break 135 case 3: 136 VC_fDoBinning_QxQy2D(folderStr,"MLRTB") 137 VC_fDoBinning_QxQy2D(folderStr,"FLRTB") 138 VC_fDoBinning_QxQy2D(folderStr, "B") 139 140 break 141 case 4: /// this is for a tall, narrow slit mode 142 VC_fBinDetector_byRows(folderStr,"FL") 143 VC_fBinDetector_byRows(folderStr,"FR") 144 VC_fBinDetector_byRows(folderStr,"ML") 145 VC_fBinDetector_byRows(folderStr,"MR") 146 VC_fBinDetector_byRows(folderStr,"B") 147 148 break 149 case 5: 150 VC_fDoBinning_QxQy2D(folderStr,"FTB") 151 VC_fDoBinning_QxQy2D(folderStr,"FLR") 152 VC_fDoBinning_QxQy2D(folderStr,"MLRTB") 153 VC_fDoBinning_QxQy2D(folderStr, "B") 114 154 115 // dispatch based on binning type 116 if(binType==1) 117 VC_fDoBinning_QxQy2D(folderStr,detStr) 118 endif 155 break 156 case 6: 157 VC_fDoBinning_QxQy2D(folderStr,"FLRTB") 158 VC_fDoBinning_QxQy2D(folderStr,"MLR") 159 VC_fDoBinning_QxQy2D(folderStr, "B") 119 160 120 // TODO -- this is only a temporary fix for slit mode 121 if(binType == 4) 122 /// this is for a tall, narrow slit mode 123 VC_fBinDetector_byRows(folderStr,detStr) 124 endif 161 break 162 case 7: 163 VC_fDoBinning_QxQy2D(folderStr,"FTB") 164 VC_fDoBinning_QxQy2D(folderStr,"FLR") 165 VC_fDoBinning_QxQy2D(folderStr,"MLR") 166 VC_fDoBinning_QxQy2D(folderStr, "B") 125 167 126 endfor 127 128 // bin in pairs 129 if(binType == 2) 130 VC_fDoBinning_QxQy2D(folderStr,"MLR") 131 VC_fDoBinning_QxQy2D(folderStr,"MTB") 132 VC_fDoBinning_QxQy2D(folderStr,"FLR") 133 VC_fDoBinning_QxQy2D(folderStr,"FTB") 134 endif 135 136 // bin everything on front or middle together 137 if(binType == 3) 138 VC_fDoBinning_QxQy2D(folderStr,"MLRTB") 139 VC_fDoBinning_QxQy2D(folderStr,"FLRTB") 140 endif 168 break 169 170 default: 171 Abort "Binning mode not found in V_QBinAllPanels_Circular"// when no case matches 172 endswitch 173 141 174 142 175 return(0) … … 239 272 // 240 273 // TODO: 241 // -- !!! Resolution waves are currently skipped - these must be added274 // x- !!! Resolution waves are currently skipped - these must be added 242 275 // 243 276 // x- this currently ignores the binning type (one, two, etc. ) … … 255 288 // root:Packages:NIST:VSANS:RAW:iBin_qxqy_FB 256 289 // 290 // Now, the extensions needed for each binType are handled in a loop using the strings 291 // defined globally for each of the numbered binTypes 292 // 257 293 // binType = 1 = one 258 294 // binType = 2 = two 259 295 // binType = 3 = four 260 296 // binType = 4 = Slit Mode 297 // binType = 5... 261 298 // 262 299 // if binType is passed in as -9999, get the binning mode from the popup … … 270 307 Variable binType 271 308 309 272 310 if(binType==-9999) 273 311 binType = V_GetBinningPopMode() 274 312 endif 275 313 314 String binTypeString = V_getBinTypeString(binType) 315 if(strlen(binTypeString) == 0) 316 DoAlert 0,"binTypeString is null in V_1DConcatenate" 317 return(0) 318 endif 319 276 320 // SetDataFolder $("root:Packages:NIST:VSANS:"+folderStr) 277 321 SetDataFolder $(pathStr+folderStr) … … 280 324 KillWaves/Z tmp_q,tmp_i,tmp_s,tmp_qb,tmp_sq,tmp_fs 281 325 326 String q_waveListStr="" 327 String i_waveListStr="" 328 String s_waveListStr="" 329 String sq_waveListStr="" 330 String qb_waveListStr="" 331 String fs_waveListStr="" 332 333 Variable num,ii 334 String item="" 335 336 //Generate string lists of the waves to be concatenated based on the 337 // binTypeString (a global string constant with the extensions) 338 // 339 282 340 NVAR gIgnoreDetB = root:Packages:NIST:VSANS:Globals:gIgnoreDetB 283 284 String waveListStr="" 285 if(binType == 1) 286 // q-values 287 waveListStr="" 288 if(!gIgnoreDetB) 289 waveListStr = "qBin_qxqy_B" + tagStr + ";" 341 if(!gIgnoreDetB) 342 q_waveListStr = "qBin_qxqy_B" + tagStr + ";" 343 i_waveListStr = "iBin_qxqy_B" + tagStr + ";" 344 s_waveListStr = "eBin_qxqy_B" + tagStr + ";" 345 sq_waveListStr = "sigmaQ_qxqy_B" + tagStr + ";" 346 qb_waveListStr = "qBar_qxqy_B" + tagStr + ";" 347 fs_waveListStr = "fSubS_qxqy_B" + tagStr + ";" 348 endif 349 350 num = ItemsInList(binTypeString, ";") 351 for(ii=0;ii<num;ii+=1) 352 item = StringFromList(ii, binTypeString ,";") 353 354 // "B" was handled outside the loop, be sure to skip here 355 if(cmpstr(item,"B") != 0) 356 q_waveListStr += "qBin_qxqy_" + item + tagStr + ";" 357 i_waveListStr += "iBin_qxqy_" + item + tagStr + ";" 358 s_waveListStr += "eBin_qxqy_" + item + tagStr + ";" 359 sq_waveListStr += "sigmaQ_qxqy_" + item + tagStr + ";" 360 qb_waveListStr += "qBar_qxqy_" + item + tagStr + ";" 361 fs_waveListStr += "fSubS_qxqy_" + item + tagStr + ";" 290 362 endif 291 waveListStr += "qBin_qxqy_MB" + tagStr + ";" 292 waveListStr += "qBin_qxqy_MT" + tagStr + ";" 293 waveListStr += "qBin_qxqy_ML" + tagStr + ";" 294 waveListStr += "qBin_qxqy_MR" + tagStr + ";" 295 waveListStr += "qBin_qxqy_FB" + tagStr + ";" 296 waveListStr += "qBin_qxqy_FT" + tagStr + ";" 297 waveListStr += "qBin_qxqy_FL" + tagStr + ";" 298 waveListStr += "qBin_qxqy_FR" + tagStr + ";" 299 300 Concatenate/NP/O waveListStr, tmp_q 301 302 //intensity 303 waveListStr="" 304 if(!gIgnoreDetB) 305 waveListStr = "iBin_qxqy_B" + tagStr + ";" 306 endif 307 waveListStr += "iBin_qxqy_MB" + tagStr + ";" 308 waveListStr += "iBin_qxqy_MT" + tagStr + ";" 309 waveListStr += "iBin_qxqy_ML" + tagStr + ";" 310 waveListStr += "iBin_qxqy_MR" + tagStr + ";" 311 waveListStr += "iBin_qxqy_FB" + tagStr + ";" 312 waveListStr += "iBin_qxqy_FT" + tagStr + ";" 313 waveListStr += "iBin_qxqy_FL" + tagStr + ";" 314 waveListStr += "iBin_qxqy_FR" + tagStr + ";" 315 // waveListStr = "iBin_qxqy_B;iBin_qxqy_MB;iBin_qxqy_MT;iBin_qxqy_ML;iBin_qxqy_MR;" 316 // waveListStr += "iBin_qxqy_FB;iBin_qxqy_FT;iBin_qxqy_FL;iBin_qxqy_FR;" 363 endfor 364 365 // concatenate each of the sets 366 367 Concatenate/NP/O q_waveListStr, tmp_q 368 369 Concatenate/NP/O i_waveListStr, tmp_i 317 370 318 Concatenate/NP/O waveListStr, tmp_i 319 320 //error 321 waveListStr="" 322 if(!gIgnoreDetB) 323 waveListStr = "eBin_qxqy_B" + tagStr + ";" 324 endif 325 waveListStr += "eBin_qxqy_MB" + tagStr + ";" 326 waveListStr += "eBin_qxqy_MT" + tagStr + ";" 327 waveListStr += "eBin_qxqy_ML" + tagStr + ";" 328 waveListStr += "eBin_qxqy_MR" + tagStr + ";" 329 waveListStr += "eBin_qxqy_FB" + tagStr + ";" 330 waveListStr += "eBin_qxqy_FT" + tagStr + ";" 331 waveListStr += "eBin_qxqy_FL" + tagStr + ";" 332 waveListStr += "eBin_qxqy_FR" + tagStr + ";" 333 // waveListStr = "eBin_qxqy_B;eBin_qxqy_MB;eBin_qxqy_MT;eBin_qxqy_ML;eBin_qxqy_MR;" 334 // waveListStr += "eBin_qxqy_FB;eBin_qxqy_FT;eBin_qxqy_FL;eBin_qxqy_FR;" 335 336 Concatenate/NP/O waveListStr, tmp_s 371 Concatenate/NP/O s_waveListStr, tmp_s 337 372 338 //sigma Q 339 waveListStr="" 340 if(!gIgnoreDetB) 341 waveListStr = "sigmaQ_qxqy_B" + tagStr + ";" 342 endif 343 waveListStr += "sigmaQ_qxqy_MB" + tagStr + ";" 344 waveListStr += "sigmaQ_qxqy_MT" + tagStr + ";" 345 waveListStr += "sigmaQ_qxqy_ML" + tagStr + ";" 346 waveListStr += "sigmaQ_qxqy_MR" + tagStr + ";" 347 waveListStr += "sigmaQ_qxqy_FB" + tagStr + ";" 348 waveListStr += "sigmaQ_qxqy_FT" + tagStr + ";" 349 waveListStr += "sigmaQ_qxqy_FL" + tagStr + ";" 350 waveListStr += "sigmaQ_qxqy_FR" + tagStr + ";" 351 // waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MB;sigmaQ_qxqy_MT;sigmaQ_qxqy_ML;sigmaQ_qxqy_MR;" 352 // waveListStr += "sigmaQ_qxqy_FB;sigmaQ_qxqy_FT;sigmaQ_qxqy_FL;sigmaQ_qxqy_FR;" 353 354 Concatenate/NP/O waveListStr, tmp_sq 355 356 //Q bar 357 waveListStr="" 358 if(!gIgnoreDetB) 359 waveListStr = "qBar_qxqy_B" + tagStr + ";" 360 endif 361 waveListStr += "qBar_qxqy_MB" + tagStr + ";" 362 waveListStr += "qBar_qxqy_MT" + tagStr + ";" 363 waveListStr += "qBar_qxqy_ML" + tagStr + ";" 364 waveListStr += "qBar_qxqy_MR" + tagStr + ";" 365 waveListStr += "qBar_qxqy_FB" + tagStr + ";" 366 waveListStr += "qBar_qxqy_FT" + tagStr + ";" 367 waveListStr += "qBar_qxqy_FL" + tagStr + ";" 368 waveListStr += "qBar_qxqy_FR" + tagStr + ";" 369 // waveListStr = "qBar_qxqy_B;qBar_qxqy_MB;qBar_qxqy_MT;qBar_qxqy_ML;qBar_qxqy_MR;" 370 // waveListStr += "qBar_qxqy_FB;qBar_qxqy_FT;qBar_qxqy_FL;qBar_qxqy_FR;" 371 372 Concatenate/NP/O waveListStr, tmp_qb 373 374 //shadow fs 375 waveListStr="" 376 if(!gIgnoreDetB) 377 waveListStr = "fSubS_qxqy_B" + tagStr + ";" 378 endif 379 waveListStr += "fSubS_qxqy_MB" + tagStr + ";" 380 waveListStr += "fSubS_qxqy_MT" + tagStr + ";" 381 waveListStr += "fSubS_qxqy_ML" + tagStr + ";" 382 waveListStr += "fSubS_qxqy_MR" + tagStr + ";" 383 waveListStr += "fSubS_qxqy_FB" + tagStr + ";" 384 waveListStr += "fSubS_qxqy_FT" + tagStr + ";" 385 waveListStr += "fSubS_qxqy_FL" + tagStr + ";" 386 waveListStr += "fSubS_qxqy_FR" + tagStr + ";" 387 // waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MB;fSubS_qxqy_MT;fSubS_qxqy_ML;fSubS_qxqy_MR;" 388 // waveListStr += "fSubS_qxqy_FB;fSubS_qxqy_FT;fSubS_qxqy_FL;fSubS_qxqy_FR;" 389 390 Concatenate/NP/O waveListStr, tmp_fs 373 Concatenate/NP/O sq_waveListStr, tmp_sq 374 375 Concatenate/NP/O qb_waveListStr, tmp_qb 376 377 Concatenate/NP/O fs_waveListStr, tmp_fs 391 378 392 endif 393 394 if(binType == 2) 395 // q-values 396 waveListStr="" 397 if(!gIgnoreDetB) 398 waveListStr = "qBin_qxqy_B" + tagStr + ";" 399 endif 400 waveListStr += "qBin_qxqy_MTB" + tagStr + ";" 401 waveListStr += "qBin_qxqy_MLR" + tagStr + ";" 402 waveListStr += "qBin_qxqy_FTB" + tagStr + ";" 403 waveListStr += "qBin_qxqy_FLR" + tagStr + ";" 404 405 // waveListStr = "qBin_qxqy_B;qBin_qxqy_MTB;qBin_qxqy_MLR;" 406 // waveListStr += "qBin_qxqy_FTB;qBin_qxqy_FLR;" 407 408 Concatenate/NP/O waveListStr, tmp_q 409 410 //intensity 411 waveListStr="" 412 if(!gIgnoreDetB) 413 waveListStr = "iBin_qxqy_B" + tagStr + ";" 414 endif 415 waveListStr += "iBin_qxqy_MTB" + tagStr + ";" 416 waveListStr += "iBin_qxqy_MLR" + tagStr + ";" 417 waveListStr += "iBin_qxqy_FTB" + tagStr + ";" 418 waveListStr += "iBin_qxqy_FLR" + tagStr + ";" 419 420 // waveListStr = "iBin_qxqy_B;iBin_qxqy_MTB;iBin_qxqy_MLR;" 421 // waveListStr += "iBin_qxqy_FTB;iBin_qxqy_FLR;" 422 423 Concatenate/NP/O waveListStr, tmp_i 424 425 //error 426 waveListStr="" 427 if(!gIgnoreDetB) 428 waveListStr = "eBin_qxqy_B" + tagStr + ";" 429 endif 430 waveListStr += "eBin_qxqy_MTB" + tagStr + ";" 431 waveListStr += "eBin_qxqy_MLR" + tagStr + ";" 432 waveListStr += "eBin_qxqy_FTB" + tagStr + ";" 433 waveListStr += "eBin_qxqy_FLR" + tagStr + ";" 434 435 // waveListStr = "eBin_qxqy_B;eBin_qxqy_MTB;eBin_qxqy_MLR;" 436 // waveListStr += "eBin_qxqy_FTB;eBin_qxqy_FLR;" 437 438 Concatenate/NP/O waveListStr, tmp_s 439 440 // sigma Q 441 waveListStr="" 442 if(!gIgnoreDetB) 443 waveListStr = "sigmaQ_qxqy_B" + tagStr + ";" 444 endif 445 waveListStr += "sigmaQ_qxqy_MTB" + tagStr + ";" 446 waveListStr += "sigmaQ_qxqy_MLR" + tagStr + ";" 447 waveListStr += "sigmaQ_qxqy_FTB" + tagStr + ";" 448 waveListStr += "sigmaQ_qxqy_FLR" + tagStr + ";" 449 450 // waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MTB;sigmaQ_qxqy_MLR;" 451 // waveListStr += "sigmaQ_qxqy_FTB;sigmaQ_qxqy_FLR;" 452 453 Concatenate/NP/O waveListStr, tmp_sq 454 455 // Q bar 456 waveListStr="" 457 if(!gIgnoreDetB) 458 waveListStr = "qBar_qxqy_B" + tagStr + ";" 459 endif 460 waveListStr += "qBar_qxqy_MTB" + tagStr + ";" 461 waveListStr += "qBar_qxqy_MLR" + tagStr + ";" 462 waveListStr += "qBar_qxqy_FTB" + tagStr + ";" 463 waveListStr += "qBar_qxqy_FLR" + tagStr + ";" 464 465 // waveListStr = "qBar_qxqy_B;qBar_qxqy_MTB;qBar_qxqy_MLR;" 466 // waveListStr += "qBar_qxqy_FTB;qBar_qxqy_FLR;" 467 468 Concatenate/NP/O waveListStr, tmp_qb 469 470 // shadow fs 471 waveListStr="" 472 if(!gIgnoreDetB) 473 waveListStr = "fSubS_qxqy_B" + tagStr + ";" 474 endif 475 waveListStr += "fSubS_qxqy_MTB" + tagStr + ";" 476 waveListStr += "fSubS_qxqy_MLR" + tagStr + ";" 477 waveListStr += "fSubS_qxqy_FTB" + tagStr + ";" 478 waveListStr += "fSubS_qxqy_FLR" + tagStr + ";" 479 480 // waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MTB;fSubS_qxqy_MLR;" 481 // waveListStr += "fSubS_qxqy_FTB;fSubS_qxqy_FLR;" 482 483 Concatenate/NP/O waveListStr, tmp_fs 484 485 endif 486 487 if(binType == 3) 488 // q-values 489 waveListStr="" 490 if(!gIgnoreDetB) 491 waveListStr = "qBin_qxqy_B" + tagStr + ";" 492 endif 493 waveListStr += "qBin_qxqy_MLRTB" + tagStr + ";" 494 waveListStr += "qBin_qxqy_FLRTB" + tagStr + ";" 495 496 // waveListStr = "qBin_qxqy_B;qBin_qxqy_MLRTB;qBin_qxqy_FLRTB;" 497 498 Concatenate/NP/O waveListStr, tmp_q 499 500 //intensity 501 waveListStr="" 502 if(!gIgnoreDetB) 503 waveListStr = "iBin_qxqy_B" + tagStr + ";" 504 endif 505 waveListStr += "iBin_qxqy_MLRTB" + tagStr + ";" 506 waveListStr += "iBin_qxqy_FLRTB" + tagStr + ";" 507 508 // waveListStr = "iBin_qxqy_B;iBin_qxqy_MLRTB;iBin_qxqy_FLRTB;" 509 510 Concatenate/NP/O waveListStr, tmp_i 511 512 //error 513 waveListStr="" 514 if(!gIgnoreDetB) 515 waveListStr = "eBin_qxqy_B" + tagStr + ";" 516 endif 517 waveListStr += "eBin_qxqy_MLRTB" + tagStr + ";" 518 waveListStr += "eBin_qxqy_FLRTB" + tagStr + ";" 519 520 // waveListStr = "eBin_qxqy_B;eBin_qxqy_MLRTB;eBin_qxqy_FLRTB;" 521 522 Concatenate/NP/O waveListStr, tmp_s 523 524 // sigma Q 525 waveListStr="" 526 if(!gIgnoreDetB) 527 waveListStr = "sigmaQ_qxqy_B" + tagStr + ";" 528 endif 529 waveListStr += "sigmaQ_qxqy_MLRTB" + tagStr + ";" 530 waveListStr += "sigmaQ_qxqy_FLRTB" + tagStr + ";" 531 532 // waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MLRTB;sigmaQ_qxqy_FLRTB;" 533 534 Concatenate/NP/O waveListStr, tmp_sq 535 536 // Q bar 537 waveListStr="" 538 if(!gIgnoreDetB) 539 waveListStr = "qBar_qxqy_B" + tagStr + ";" 540 endif 541 waveListStr += "qBar_qxqy_MLRTB" + tagStr + ";" 542 waveListStr += "qBar_qxqy_FLRTB" + tagStr + ";" 543 544 // waveListStr = "qBar_qxqy_B;qBar_qxqy_MLRTB;qBar_qxqy_FLRTB;" 545 546 Concatenate/NP/O waveListStr, tmp_qb 547 548 // shadow fs 549 waveListStr="" 550 if(!gIgnoreDetB) 551 waveListStr = "fSubS_qxqy_B" + tagStr + ";" 552 endif 553 waveListStr += "fSubS_qxqy_MLRTB" + tagStr + ";" 554 waveListStr += "fSubS_qxqy_FLRTB" + tagStr + ";" 555 556 // waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MLRTB;fSubS_qxqy_FLRTB;" 557 558 Concatenate/NP/O waveListStr, tmp_fs 559 endif 560 561 // TODO - This is the identical set of waves as for the case of binType = 1. 562 // they have the same names, but are averaged differently since it's slit mode. 563 // I have separated this, since in practice the TB panels are probably best to ignore 564 // and NOT include in the averaging since the Qy range is so limited. 565 if(binType == 4) 566 // q-values 567 waveListStr="" 568 if(!gIgnoreDetB) 569 waveListStr = "qBin_qxqy_B" + tagStr + ";" 570 endif 571 // waveListStr += "qBin_qxqy_MB" + tagStr + ";" 572 // waveListStr += "qBin_qxqy_MT" + tagStr + ";" 573 waveListStr += "qBin_qxqy_ML" + tagStr + ";" 574 waveListStr += "qBin_qxqy_MR" + tagStr + ";" 575 // waveListStr += "qBin_qxqy_FB" + tagStr + ";" 576 // waveListStr += "qBin_qxqy_FT" + tagStr + ";" 577 waveListStr += "qBin_qxqy_FL" + tagStr + ";" 578 waveListStr += "qBin_qxqy_FR" + tagStr + ";" 579 // waveListStr = "qBin_qxqy_B;qBin_qxqy_MB;qBin_qxqy_MT;qBin_qxqy_ML;qBin_qxqy_MR;" 580 // waveListStr += "qBin_qxqy_FB;qBin_qxqy_FT;qBin_qxqy_FL;qBin_qxqy_FR;" 581 582 Concatenate/NP/O waveListStr, tmp_q 583 584 //intensity 585 waveListStr="" 586 if(!gIgnoreDetB) 587 waveListStr = "iBin_qxqy_B" + tagStr + ";" 588 endif 589 // waveListStr += "iBin_qxqy_MB" + tagStr + ";" 590 // waveListStr += "iBin_qxqy_MT" + tagStr + ";" 591 waveListStr += "iBin_qxqy_ML" + tagStr + ";" 592 waveListStr += "iBin_qxqy_MR" + tagStr + ";" 593 // waveListStr += "iBin_qxqy_FB" + tagStr + ";" 594 // waveListStr += "iBin_qxqy_FT" + tagStr + ";" 595 waveListStr += "iBin_qxqy_FL" + tagStr + ";" 596 waveListStr += "iBin_qxqy_FR" + tagStr + ";" 597 // waveListStr = "iBin_qxqy_B;iBin_qxqy_MB;iBin_qxqy_MT;iBin_qxqy_ML;iBin_qxqy_MR;" 598 // waveListStr += "iBin_qxqy_FB;iBin_qxqy_FT;iBin_qxqy_FL;iBin_qxqy_FR;" 599 600 Concatenate/NP/O waveListStr, tmp_i 601 602 //error 603 waveListStr="" 604 if(!gIgnoreDetB) 605 waveListStr = "eBin_qxqy_B" + tagStr + ";" 606 endif 607 // waveListStr += "eBin_qxqy_MB" + tagStr + ";" 608 // waveListStr += "eBin_qxqy_MT" + tagStr + ";" 609 waveListStr += "eBin_qxqy_ML" + tagStr + ";" 610 waveListStr += "eBin_qxqy_MR" + tagStr + ";" 611 // waveListStr += "eBin_qxqy_FB" + tagStr + ";" 612 // waveListStr += "eBin_qxqy_FT" + tagStr + ";" 613 waveListStr += "eBin_qxqy_FL" + tagStr + ";" 614 waveListStr += "eBin_qxqy_FR" + tagStr + ";" 615 // waveListStr = "eBin_qxqy_B;eBin_qxqy_MB;eBin_qxqy_MT;eBin_qxqy_ML;eBin_qxqy_MR;" 616 // waveListStr += "eBin_qxqy_FB;eBin_qxqy_FT;eBin_qxqy_FL;eBin_qxqy_FR;" 617 618 Concatenate/NP/O waveListStr, tmp_s 619 620 //sigma Q 621 waveListStr="" 622 if(!gIgnoreDetB) 623 waveListStr = "sigmaQ_qxqy_B" + tagStr + ";" 624 endif 625 // waveListStr += "sigmaQ_qxqy_MB" + tagStr + ";" 626 // waveListStr += "sigmaQ_qxqy_MT" + tagStr + ";" 627 waveListStr += "sigmaQ_qxqy_ML" + tagStr + ";" 628 waveListStr += "sigmaQ_qxqy_MR" + tagStr + ";" 629 // waveListStr += "sigmaQ_qxqy_FB" + tagStr + ";" 630 // waveListStr += "sigmaQ_qxqy_FT" + tagStr + ";" 631 waveListStr += "sigmaQ_qxqy_FL" + tagStr + ";" 632 waveListStr += "sigmaQ_qxqy_FR" + tagStr + ";" 633 // waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MB;sigmaQ_qxqy_MT;sigmaQ_qxqy_ML;sigmaQ_qxqy_MR;" 634 // waveListStr += "sigmaQ_qxqy_FB;sigmaQ_qxqy_FT;sigmaQ_qxqy_FL;sigmaQ_qxqy_FR;" 635 636 Concatenate/NP/O waveListStr, tmp_sq 637 638 //Q bar 639 waveListStr="" 640 if(!gIgnoreDetB) 641 waveListStr = "qBar_qxqy_B" + tagStr + ";" 642 endif 643 // waveListStr += "qBar_qxqy_MB" + tagStr + ";" 644 // waveListStr += "qBar_qxqy_MT" + tagStr + ";" 645 waveListStr += "qBar_qxqy_ML" + tagStr + ";" 646 waveListStr += "qBar_qxqy_MR" + tagStr + ";" 647 // waveListStr += "qBar_qxqy_FB" + tagStr + ";" 648 // waveListStr += "qBar_qxqy_FT" + tagStr + ";" 649 waveListStr += "qBar_qxqy_FL" + tagStr + ";" 650 waveListStr += "qBar_qxqy_FR" + tagStr + ";" 651 // waveListStr = "qBar_qxqy_B;qBar_qxqy_MB;qBar_qxqy_MT;qBar_qxqy_ML;qBar_qxqy_MR;" 652 // waveListStr += "qBar_qxqy_FB;qBar_qxqy_FT;qBar_qxqy_FL;qBar_qxqy_FR;" 653 654 Concatenate/NP/O waveListStr, tmp_qb 655 656 //shadow fs 657 waveListStr="" 658 if(!gIgnoreDetB) 659 waveListStr = "fSubS_qxqy_B" + tagStr + ";" 660 endif 661 // waveListStr += "fSubS_qxqy_MB" + tagStr + ";" 662 // waveListStr += "fSubS_qxqy_MT" + tagStr + ";" 663 waveListStr += "fSubS_qxqy_ML" + tagStr + ";" 664 waveListStr += "fSubS_qxqy_MR" + tagStr + ";" 665 // waveListStr += "fSubS_qxqy_FB" + tagStr + ";" 666 // waveListStr += "fSubS_qxqy_FT" + tagStr + ";" 667 waveListStr += "fSubS_qxqy_FL" + tagStr + ";" 668 waveListStr += "fSubS_qxqy_FR" + tagStr + ";" 669 // waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MB;fSubS_qxqy_MT;fSubS_qxqy_ML;fSubS_qxqy_MR;" 670 // waveListStr += "fSubS_qxqy_FB;fSubS_qxqy_FT;fSubS_qxqy_FL;fSubS_qxqy_FR;" 671 672 Concatenate/NP/O waveListStr, tmp_fs 673 674 endif 379 675 380 676 381 // Can't kill here, since they are still needed to sort and write out! … … 711 416 712 417 713 // TODO 714 // (appears to be unused, in favor of the version that uses the global strings) 715 // needs: 716 // -- trim the beamstop out (based on shadow?) 717 // -- trim out zero q from the file (bad actor in analysis functions) 718 // -- trim num from the highQ end or lowQ end? 719 // -- splits the res wave into individual waves in anticipation of concatenation 720 // -- or -- deal with the res wave after? 721 // 722 // -- make a copy of the waves? 723 // -- then, what is the concatenate function looking for?? 724 // 725 Function V_Trim1DData(dataFolder,binType,nBeg,nEnd) 726 String dataFolder 727 Variable binType,nBeg,nEnd 728 729 Variable npt,ii 730 SetDataFolder $("root:Packages:NIST:VSANS:"+dataFolder) 731 732 Printf "%d points removed from beginning, %d points from the end (of each set) before concatenating\r",nbeg,nend 733 734 // for each binType block: 735 // declare the waves 736 // make a copy of the waves?? 737 // //Break out resolution wave into separate waves 738 // delete the beginning points from everything 739 // trim off the last nEnd points from everything 740 // DeletePoints num-nEnd,nEnd, qw,iw,sw 741 // // delete all points where the shadow is < 0.98 742 ////Put resolution contents back??? 743 744 if(binType == 1) 745 Wave/Z q_fb = qBin_qxqy_FB 746 Wave/Z q_ft = qBin_qxqy_FT 747 Wave/Z q_fl = qBin_qxqy_FL 748 Wave/Z q_fr = qBin_qxqy_FR 749 Wave/Z q_mb = qBin_qxqy_MB 750 Wave/Z q_mt = qBin_qxqy_MT 751 Wave/Z q_ml = qBin_qxqy_ML 752 Wave/Z q_mr = qBin_qxqy_MR 753 Wave/Z q_b = qBin_qxqy_B 754 755 Wave/Z i_fb = iBin_qxqy_FB 756 Wave/Z i_ft = iBin_qxqy_FT 757 Wave/Z i_fl = iBin_qxqy_FL 758 Wave/Z i_fr = iBin_qxqy_FR 759 Wave/Z i_mb = iBin_qxqy_MB 760 Wave/Z i_mt = iBin_qxqy_MT 761 Wave/Z i_ml = iBin_qxqy_ML 762 Wave/Z i_mr = iBin_qxqy_MR 763 Wave/Z i_b = iBin_qxqy_B 764 765 Wave/Z s_fb = eBin_qxqy_FB 766 Wave/Z s_ft = eBin_qxqy_FT 767 Wave/Z s_fl = eBin_qxqy_FL 768 Wave/Z s_fr = eBin_qxqy_FR 769 Wave/Z s_mb = eBin_qxqy_MB 770 Wave/Z s_mt = eBin_qxqy_MT 771 Wave/Z s_ml = eBin_qxqy_ML 772 Wave/Z s_mr = eBin_qxqy_MR 773 Wave/Z s_b = eBin_qxqy_B 774 775 776 777 DeletePoints 0,nBeg, q_fb,q_ft,q_fl,q_fr,q_mb,q_mt,q_ml,q_mr,q_b 778 DeletePoints 0,nBeg, i_fb,i_ft,i_fl,i_fr,i_mb,i_mt,i_ml,i_mr,i_b 779 DeletePoints 0,nBeg, s_fb,s_ft,s_fl,s_fr,s_mb,s_mt,s_ml,s_mr,s_b 780 //since each set may have a different number of points 781 npt = numpnts(q_fb) 782 DeletePoints npt-nEnd,nEnd, q_fb,i_fb,s_fb 783 784 npt = numpnts(q_ft) 785 DeletePoints npt-nEnd,nEnd, q_ft,i_ft,s_ft 786 787 npt = numpnts(q_fl) 788 DeletePoints npt-nEnd,nEnd, q_fl,i_fl,s_fl 789 790 npt = numpnts(q_fr) 791 DeletePoints npt-nEnd,nEnd, q_fr,i_fr,s_fr 792 793 npt = numpnts(q_mb) 794 DeletePoints npt-nEnd,nEnd, q_mb,i_mb,s_mb 795 796 npt = numpnts(q_mt) 797 DeletePoints npt-nEnd,nEnd, q_mt,i_mt,s_mt 798 799 npt = numpnts(q_ml) 800 DeletePoints npt-nEnd,nEnd, q_ml,i_ml,s_ml 801 802 npt = numpnts(q_mr) 803 DeletePoints npt-nEnd,nEnd, q_mr,i_mr,s_mr 804 805 npt = numpnts(q_b) 806 DeletePoints npt-nEnd,nEnd, q_b,i_b,s_b 807 808 endif 809 810 if(binType == 2) 811 Wave/Z q_ftb = qBin_qxqy_FTB 812 Wave/Z q_flr = qBin_qxqy_FLR 813 Wave/Z q_mtb = qBin_qxqy_MTB 814 Wave/Z q_mlr = qBin_qxqy_MLR 815 Wave/Z q_b = qBin_qxqy_B 816 817 Wave/Z i_ftb = iBin_qxqy_FTB 818 Wave/Z i_flr = iBin_qxqy_FLR 819 Wave/Z i_mtb = iBin_qxqy_MTB 820 Wave/Z i_mlr = iBin_qxqy_MLR 821 Wave/Z i_b = iBin_qxqy_B 822 823 Wave/Z s_ftb = eBin_qxqy_FTB 824 Wave/Z s_flr = eBin_qxqy_FLR 825 Wave/Z s_mtb = eBin_qxqy_MTB 826 Wave/Z s_mlr = eBin_qxqy_MLR 827 Wave/Z s_b = eBin_qxqy_B 828 829 830 DeletePoints 0,nBeg, q_ftb,q_flr,q_mtb,q_mlr,q_b 831 DeletePoints 0,nBeg, i_ftb,i_flr,i_mtb,i_mlr,i_b 832 DeletePoints 0,nBeg, s_ftb,s_flr,s_mtb,s_mlr,s_b 833 //since each set may have a different number of points 834 npt = numpnts(q_ftb) 835 DeletePoints npt-nEnd,nEnd, q_ftb,i_ftb,s_ftb 836 837 npt = numpnts(q_flr) 838 DeletePoints npt-nEnd,nEnd, q_flr,i_flr,s_flr 839 840 npt = numpnts(q_mtb) 841 DeletePoints npt-nEnd,nEnd, q_mtb,i_mtb,s_mtb 842 843 npt = numpnts(q_mlr) 844 DeletePoints npt-nEnd,nEnd, q_mlr,i_mlr,s_mlr 845 846 npt = numpnts(q_b) 847 DeletePoints npt-nEnd,nEnd, q_b,i_b,s_b 848 849 850 endif 851 852 if(binType == 3) 853 Wave/Z q_flrtb = qBin_qxqy_FLRTB 854 Wave/Z q_mlrtb = qBin_qxqy_MLRTB 855 Wave/Z q_b = qBin_qxqy_B 856 857 Wave/Z i_flrtb = iBin_qxqy_FLRTB 858 Wave/Z i_mlrtb = iBin_qxqy_MLRTB 859 Wave/Z i_b = iBin_qxqy_B 860 861 Wave/Z s_flrtb = eBin_qxqy_FLRTB 862 Wave/Z s_mlrtb = eBin_qxqy_MLRTB 863 Wave/Z s_b = eBin_qxqy_B 864 865 DeletePoints 0,nBeg, q_flrtb,q_mlrtb,q_b 866 DeletePoints 0,nBeg, i_flrtb,i_mlrtb,i_b 867 DeletePoints 0,nBeg, s_flrtb,s_mlrtb,s_b 868 //since each set may have a different number of points 869 npt = numpnts(q_flrtb) 870 DeletePoints npt-nEnd,nEnd, q_flrtb,i_flrtb,s_flrtb 871 872 npt = numpnts(q_mlrtb) 873 DeletePoints npt-nEnd,nEnd, q_mlrtb,i_mlrtb,s_mlrtb 874 875 npt = numpnts(q_b) 876 DeletePoints npt-nEnd,nEnd, q_b,i_b,s_b 877 878 endif 879 880 // TODO - This is the identical set of waves as for the case of binType = 1. 881 // they have the same names, but are averaged differently since it's slit mode. 882 // I have separated this, since in practice the TB panels are probably best to ignore 883 // and NOT include in the averaging since the Qy range is so limited. 884 if(binType == 4) 885 Wave/Z q_fb = qBin_qxqy_FB 886 Wave/Z q_ft = qBin_qxqy_FT 887 Wave/Z q_fl = qBin_qxqy_FL 888 Wave/Z q_fr = qBin_qxqy_FR 889 Wave/Z q_mb = qBin_qxqy_MB 890 Wave/Z q_mt = qBin_qxqy_MT 891 Wave/Z q_ml = qBin_qxqy_ML 892 Wave/Z q_mr = qBin_qxqy_MR 893 Wave/Z q_b = qBin_qxqy_B 894 895 Wave/Z i_fb = iBin_qxqy_FB 896 Wave/Z i_ft = iBin_qxqy_FT 897 Wave/Z i_fl = iBin_qxqy_FL 898 Wave/Z i_fr = iBin_qxqy_FR 899 Wave/Z i_mb = iBin_qxqy_MB 900 Wave/Z i_mt = iBin_qxqy_MT 901 Wave/Z i_ml = iBin_qxqy_ML 902 Wave/Z i_mr = iBin_qxqy_MR 903 Wave/Z i_b = iBin_qxqy_B 904 905 Wave/Z s_fb = eBin_qxqy_FB 906 Wave/Z s_ft = eBin_qxqy_FT 907 Wave/Z s_fl = eBin_qxqy_FL 908 Wave/Z s_fr = eBin_qxqy_FR 909 Wave/Z s_mb = eBin_qxqy_MB 910 Wave/Z s_mt = eBin_qxqy_MT 911 Wave/Z s_ml = eBin_qxqy_ML 912 Wave/Z s_mr = eBin_qxqy_MR 913 Wave/Z s_b = eBin_qxqy_B 914 915 DeletePoints 0,nBeg, q_fb,q_ft,q_fl,q_fr,q_mb,q_mt,q_ml,q_mr,q_b 916 DeletePoints 0,nBeg, i_fb,i_ft,i_fl,i_fr,i_mb,i_mt,i_ml,i_mr,i_b 917 DeletePoints 0,nBeg, s_fb,s_ft,s_fl,s_fr,s_mb,s_mt,s_ml,s_mr,s_b 918 //since each set may have a different number of points 919 npt = numpnts(q_fb) 920 DeletePoints npt-nEnd,nEnd, q_fb,i_fb,s_fb 921 922 npt = numpnts(q_ft) 923 DeletePoints npt-nEnd,nEnd, q_ft,i_ft,s_ft 924 925 npt = numpnts(q_fl) 926 DeletePoints npt-nEnd,nEnd, q_fl,i_fl,s_fl 927 928 npt = numpnts(q_fr) 929 DeletePoints npt-nEnd,nEnd, q_fr,i_fr,s_fr 930 931 npt = numpnts(q_mb) 932 DeletePoints npt-nEnd,nEnd, q_mb,i_mb,s_mb 933 934 npt = numpnts(q_mt) 935 DeletePoints npt-nEnd,nEnd, q_mt,i_mt,s_mt 936 937 npt = numpnts(q_ml) 938 DeletePoints npt-nEnd,nEnd, q_ml,i_ml,s_ml 939 940 npt = numpnts(q_mr) 941 DeletePoints npt-nEnd,nEnd, q_mr,i_mr,s_mr 942 943 npt = numpnts(q_b) 944 DeletePoints npt-nEnd,nEnd, q_b,i_b,s_b 945 946 endif 947 948 SetDataFolder root: 949 return(0) 950 end 951 952 953 954 / 418 // 955 419 Proc V_Load_Data_ITX() 956 420 V_Load_itx("","",0,0) … … 1050 514 // Duplicate/O $("root:"+n2), $w2 1051 515 1052 516 // no resolution matrix to make 1053 517 1054 518 … … 1056 520 End 1057 521 522 523 524 // string function to select the correct string constant 525 // that corresponds to the selected binType. This string constant 526 // contains the list of extensions to be used for plotting, saving, etc. 527 // 528 // returns null string if no match 529 // 530 Function/S V_getBinTypeString(binType) 531 Variable binType 532 533 String detListStr="" 534 if(binType == 1) 535 detListStr = ksBinType1 536 endif 537 if(binType == 2) 538 detListStr = ksBinType2 539 endif 540 if(binType == 3) 541 detListStr = ksBinType3 542 endif 543 if(binType == 4) 544 detListStr = ksBinType4 545 endif 546 if(binType == 5) 547 detListStr = ksBinType5 548 endif 549 if(binType == 6) 550 detListStr = ksBinType6 551 endif 552 if(binType == 7) 553 detListStr = ksBinType7 554 endif 555 556 557 return(detListStr) 558 End 1058 559 1059 560 // given strings of the number of points to remove, loop over the detectors … … 1067 568 String nBegStr,nEndStr 1068 569 1069 String detListStr 1070 if(binType == 1) 1071 detListStr = ksBinType1 1072 endif 1073 if(binType == 2) 1074 detListStr = ksBinType2 1075 endif 1076 if(binType == 3) 1077 detListStr = ksBinType3 1078 endif 1079 if(binType == 4) 1080 detListStr = ksBinType4 1081 endif 570 String detListStr="" 571 572 detListStr = V_getBinTypeString(binType) //the list of extensions 1082 573 if(strlen(detListStr)==0) 1083 574 return(0) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Initialize.ipf
r1064 r1073 31 31 // this need never change from 1 32 32 Constant kBCTR_CM = 1 //set to 1 to use beam center in cm. O to use pixels 33 34 // // TODO: -- replace this constant with V_getDet_panel_gap(fname,detStr) 33 35 Constant kPanelTouchingGap = 10 // TODO -- measure this gap when panels "touch", UNITS OF mm, not cm 34 36 … … 46 48 47 49 // for defining which "bin type" corresponds to which set of extensions for I(q) data 50 // !! see V_BinTypeStr2Num() for the numbering, not the order of the list 51 // 48 52 ////////////////// 49 Strconstant ksBinTypeStr = "One;Two;Four;Slit Mode;" 50 Strconstant ksBinType1 = "B;FT;FB;FL;FR;MT;MB;ML;MR;" //these are the "active" extensions 51 Strconstant ksBinType2 = "B;FTB;FLR;MTB;MLR;" 52 Strconstant ksBinType3 = "B;FLRTB;MLRTB;" 53 Strconstant ksBinType4 = "B;FT;FB;FL;FR;MT;MB;ML;MR;" 53 //Strconstant ksBinTypeStr = "One;Two;Four;Slit Mode;" 54 Strconstant ksBinTypeStr = "F4-M4-B;F2-M2-B;F1-M1-B;F2-M1-B;F1-M2xTB-B;F2-M2xTB-B;SLIT-F2-M2-B;" 55 Strconstant ksBinType1 = "FT;FB;FL;FR;MT;MB;ML;MR;B;" //these are the "active" extensions 56 Strconstant ksBinType2 = "FTB;FLR;MTB;MLR;B;" 57 Strconstant ksBinType3 = "FLRTB;MLRTB;B;" 58 //Strconstant ksBinType4 = "FT;FB;FL;FR;MT;MB;ML;MR;B;" 59 Strconstant ksBinType4 = "FL;FR;ML;MR;B;" //in SLIT mode 60 Strconstant ksBinType5 = "FTB;FLR;MLRTB;B;" 61 Strconstant ksBinType6 = "FLRTB;MLR;B;" 62 Strconstant ksBinType7 = "FTB;FLR;MLR;B;" 54 63 /////////////////// 55 64 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Instrument_Resolution.ipf
r1072 r1073 228 228 // MAR 2011 - removed the del_r terms, they don't apply since no bining is done to the 2D data 229 229 // 230 Function get2DResolution(inQ,phi,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,r_dist,SigmaQX,SigmaQY,fSubS)230 Function V_get2DResolution(inQ,phi,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,r_dist,SigmaQX,SigmaQY,fSubS) 231 231 Variable inQ, phi,lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r,usingLenses,r_dist 232 232 Variable &SigmaQX,&SigmaQY,&fSubS //these are the output quantities at the input Q value -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MainPanel.ipf
r1050 r1073 114 114 String ctrlName 115 115 116 ReduceAFile() 116 V_ReductionProtocolPanel() 117 // ReduceAFile() 117 118 End 118 119 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Marquee_Operations.ipf
r1064 r1073 242 242 bottom = round(V_bottom) 243 243 244 // NOTE:245 // this function MODIFIES x and y values on return, converting them to panel coordinates246 244 // detector panel is identified from the (left,top) coordinate (x1,y2) 247 245 String detStr = V_FindDetStrFromLoc(left,right,bottom,top) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MaskUtils.ipf
r1064 r1073 40 40 //// DRAWING/SAVING 41 41 // 42 // TODO:42 // (DONE) 43 43 // x- CHANGE the mask behavior to a more logical choice - and consistent with SANS 44 44 // x- CHANGE to: … … 46 46 // 0 == no Mask == keep data 47 47 // x- and then make the corresponding changes in the I(Q) routines 48 49 48 // 50 49 // x- move the mask generating utilities from VC_HDF5_Utils into this procedure - to keep 51 50 // all of the mask procedures together … … 56 55 // this is done through a window hook function (LR moves tube number, up/down = add/delete) 57 56 // 58 // TODO 59 // -- make the arrow keys Igor 6 compatible - search for specialKeyCode or Keyboard Events in the help file 57 // (DONE) 58 // x- (NO)- Igor 7 is necessary for some VSANS functionality, so do not support Igor 6 59 // x (no)make the arrow keys Igor 6 compatible - search for specialKeyCode or Keyboard Events in the help file 60 60 // and what needs to be replaced for Igor 6 61 // TODO62 // -- for L/R panels, the maksing of columns should be sufficient. Tubes are vertical. For the T/B panels61 // DONE 62 // x- for L/R panels, the maksing of columns should be sufficient. Tubes are vertical. For the T/B panels 63 63 // the L/R panels cast a vertical shadow (=vertical mask) AND the tubes are horizontal, so the individual 64 64 // tubes will likely need to be masked in a horizontal line too, per tube. ADD this in... … … 455 455 // x- currently is hard-wired for the simulation path! need to make it more generic, especially for RAW data 456 456 // 457 // -- need to adjust the size of the image subwindows to keep the model458 // calculation from spilling over onto the table (maybe just move the table)457 // -- need to adjust the size of the image subwindows 458 // 459 459 // -- need to do something for panel "B". currently ignored 460 // -- currently the pixel sizes for "real" data is incorrect in the file 461 // and this is why the plots are incorrectly sized 462 // -- error checking if the data does not exist in selected work folder 460 // 463 461 // 464 462 // draw the selected panel and the model calculation, adjusting for the … … 595 593 // overlay the mask 596 594 // 597 // 595 // (DONE) 598 596 // x- remove the old mask first 599 597 // x- make the mask "toggle" to remove it … … 728 726 // 729 727 // TODO 730 // -- make the number of pixels GLOBAL 728 // -- make the number of pixels GLOBAL to pick up the right numbers for the detector dimensions 731 729 // x- there will be lots of work to do to develop the procedures necessary to actually generate the 732 730 // 9 data sets to become the MASK file contents. More complexity here than for the simple SANS case. … … 843 841 844 842 845 // TODO846 // -- currently, there are no dummy fill values or attributes for the fake MASK file843 // (DONE) 844 // x- currently, there are no dummy fill values or attributes for the fake MASK file 847 845 // 848 846 Proc Setup_VSANS_MASK_Struct() -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Menu.ipf
r1070 r1073 69 69 70 70 // 71 Menu "SANS"71 xMenu "SANS" 72 72 "Initialize" 73 73 "SANS Help" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MultipleReduce.ipf
r1050 r1073 6 6 // 7 7 // Procedures for the MRED panel to allow quick batch reduction of data files 8 // -as of 8/01, use the new method of requiring only run numbers to select the datafiles9 // and these data failes need not be consecutively numbered10 8 // 11 9 //****note that much of this file is becoming obsolete as improved methods for … … 17 15 // TODO 18 16 // -- these procedures are in the process of being updated for VSANS 19 // and are highly susceptible to change as user preferences bocome apparent20 17 // and are highly susceptible to change pending user feedback 18 // 21 19 22 20 //panel to allow reduction of a series of files using a selected protocol … … 102 100 EndMacro 103 101 104 ////simple procedure to bring the CAT TABLE to the front if it is present105 ////alerts user, but does nothing else if CAT TABLE is not present106 ////called by several panels107 ////108 //Proc ShowCATWindow()109 // DoWindow/F CatVSTable110 // if(V_flag==0)111 // DoAlert 0,"There is no File Catalog table. Use the File Catalog button to create one."112 // Endif113 //End114 102 115 103 … … 117 105 //that is COMMA delimited, and creates a new list that is also COMMA delimited 118 106 //and contains the full path:file;vers for each file in the list 119 //and ensures that files in returned list are RAW data 107 //and ensures that files in returned list are RAW data, and can be found on disk 120 108 // 121 109 Function/S V_FullNameListFromFileList(list) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf
r1072 r1073 2216 2216 2217 2217 //////////////////////////////////////////////////////// 2218 2219 // TODO: 2220 // -- calculation works, needs proper inputs (solid angle aware)2221 // -- Open beam method needs to be verified in V_AskForAbsoluteParams_Quest()2218 // Absolute scale 2219 2220 // x- calculation works, needs proper inputs (solid angle aware) 2221 // x- Open beam method needs to be verified in V_AskForAbsoluteParams_Quest() 2222 2222 Variable c2,c3,c4,c5,kappa_err 2223 2223 //do absolute scaling if desired … … 2273 2273 If(cmpstr("ask",prot[3])==0) 2274 2274 //get file from user 2275 // TODO2276 2275 // x- fill in the get file prompt, and handle the result 2277 2276 Prompt mskFileName,"MASK File",popup,V_PickMASKButton("") … … 2334 2333 // bin and plot the data 2335 2334 2336 // TODO 2337 // -- this switch does nothing -- fill it in 2335 // 2338 2336 // x- need to convert BINTYPE keyword into a numerical value to pass 2339 2337 // … … 2351 2349 // TODO: 2352 2350 // -- do I calculate the proper resolution here? I've already decoded the binning type 2353 // and the averaging type has been specified by the protocol 2351 // and the averaging type has been specified by the protocol. 2352 // 2353 // currently, the resolution is calculated every time that the data is averaged (in VC_fDoBinning_QxQy2D) 2354 // 2354 2355 // -- if I calculate the resolution here, then the Trimming routines must be updated 2355 // to trim the resolution waves also. This positioning may work for2356 // to trim the resolution waves also. This will work for the columns present in 2356 2357 // pinhole resolution, but anything using the matrix method - it won't work - and I'll need 2357 2358 // a different solution … … 2410 2411 2411 2412 2412 // TODO2413 // 2413 2414 // x- how do I get the sample file name? 2414 2415 // local variable samFileLoaded is the file name loaded (contains the extension) 2415 2416 // 2416 //save data if desired 2417 //save data if desired - dispatch as needed 2417 2418 String fullpath = "", newfileName="" 2418 2419 String saveType = StringByKey("SAVE",prot[5],"=",";") //does user want to save data? 2420 2419 2421 If( (cmpstr(saveType[0,2],"Yes")==0) && (cmpstr(av_type,"none") != 0) ) 2420 2422 //then save … … 2444 2446 //if this doesn't exist, a dialog will be presented by setting dialog = 1 2445 2447 // 2446 //2447 2448 Variable dialog = 0 2448 2449 2449 // TODO2450 // -- need to define nBeg and nEnd somewhere2451 // -- currently hard-wired2452 // --do I need to define these "per-panel"?2453 2454 2450 PathInfo/S catPathName 2455 2451 String item = StringByKey("NAME",prot[5],"=",";") //Auto or Manual naming … … 2485 2481 // SaveAsPNG(activeType,fullpath,dialog) 2486 2482 break 2487 default:2483 case "Circular": //in SANS, this was the default, but is dangerous, so make it explicit here 2488 2484 // if (useXMLOutput == 1) 2489 2485 // WriteXMLWaves_W_Protocol(activeType,fullPath,dialog) … … 2492 2488 // endif 2493 2489 // 2494 // TODO: 2495 // -- fill in all of the cases, default is only the "standard" circular average I(q) 2496 // -- get the trim strings from somewhere-- from the file or from the protocol?? 2490 // x- get the trim strings from somewhere-- from the file or from the protocol?? 2497 2491 // then replace the null strings being passed 2498 2492 2499 2493 if(cmpstr(saveType,"Yes - Concatenate")==0) 2500 V_Trim1DDataStr(activeType,binType,prot[7],prot[8]) // TODO -- passing null strings uses global or default trim values2501 // V_Trim1DData(activeType,binType,nBeg,nEnd) 2494 V_Trim1DDataStr(activeType,binType,prot[7],prot[8]) // x- passing null strings uses global or default trim values 2495 2502 2496 V_ConcatenateForSave("root:Packages:NIST:VSANS:",activeType,"",binType) // this removes q=0 point, concatenates, sorts 2503 2497 V_Write1DData("root:Packages:NIST:VSANS:",activeType,newFileName+"."+exten) //don't pass the full path, just the name … … 2509 2503 endif 2510 2504 Print "data written to: "+ newFileName+"."+exten 2505 2506 break 2507 default: 2508 DoAlert 0, "av_type not found in dispatch to write file" 2511 2509 2512 2510 endswitch … … 2660 2658 // store these locally 2661 2659 2662 // TODO 2660 2663 2661 // x- need to get the panel string for the sum. 2664 2662 // x- the detector string is currently hard-wired … … 2670 2668 Print "empty err/counts = ",empty_ct_err/emptyCts 2671 2669 2672 // TODO 2673 // -- get all of the proper values for the calculation2670 // 2671 // x- get all of the proper values for the calculation 2674 2672 // -x currently the attenuation is incorrect 2675 2673 // such that kappa_err = 1*kappa 2676 // -- verify the calculation (no solid angle needed??) 2677 2678 DoAlert 0,"This calculation is not reliable - something is wrong" 2679 2674 // x- verify the calculation (no solid angle needed??) 2675 2680 2676 // get the attenuation factor for the empty beam 2681 // TODO-- the attenuation is not written by NICE to the file2677 // -- the attenuation is not written by NICE to the file 2682 2678 // so I need to calculate it myself from the tables 2683 2679 // … … 2706 2702 kappa_err = sqrt(kappa_err) * kappa 2707 2703 2708 // TODO 2709 // -- set the parameters in the global string 2704 // x- set the parameters in the global string 2710 2705 junkStr = num2str(kappa) 2711 2706 errStr = num2Str(kappa_err) … … 2713 2708 2714 2709 2715 Printf "Kappa was (maybe)successfully calculated as = %g +/- %g (%g %)\r",kappa,kappa_err,(kappa_err/kappa)*1002710 Printf "Kappa was successfully calculated as = %g +/- %g (%g %)\r",kappa,kappa_err,(kappa_err/kappa)*100 2716 2711 2717 2712 // restore preferences on exit -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_RAW_Data_Panel.ipf
r1064 r1073 179 179 TitleBox title_file,pos={606,178},size={76,20},variable= root:Packages:NIST:VSANS:Globals:gLastLoadedFile 180 180 TitleBox title_dataPresent,pos={606,210},size={76,20},variable= root:Packages:NIST:VSANS:Globals:gCurDispFile 181 TitleBox title_status,pos={606,240},size={200,200}, variable= root:Packages:NIST:VSANS:Globals:gStatusText181 TitleBox title_status,pos={606,240},size={200,200},fsize=12,variable= root:Packages:NIST:VSANS:Globals:gStatusText 182 182 183 183 // Button button_tagFile,pos={720,412},size={70,20},proc=V_TagFileButtonProc,title="Tag File" … … 832 832 833 833 834 // TODO834 // 835 835 // 836 836 // opens a separate panel with the I(q) representation of the data 837 // ? controls here to select how the data is processed/grouped/saved, etc. 838 // 839 // -- currently just the graph, no controls 840 // -- this re-bins the data every time by calling V_QBinAllPanels(folderStr,binType) from inside V_BinningModePopup() 837 // controls on the panel select how the data is processed/grouped, etc. 838 // 839 // 841 840 Function V_IvsQPanelButtonProc(ba) : ButtonControl 842 841 STRUCT WMButtonAction &ba … … 848 847 V_PlotData_Panel() //-9999 requests a read from the popup on the panel 849 848 Variable binType = V_GetBinningPopMode() 850 V_BinningModePopup("",binType,"") // does default circular binning and updates the graph 849 ControlInfo/W=V_1D_Data popup0 850 V_BinningModePopup("",binType,S_Value) // does binning of current popString and updates the graph 851 851 852 852 break … … 864 864 // see the file V_IQ_Annular.ipf for all of the features yet to be added. 865 865 // 866 // -- currently just the graph, no controls867 // -- this re-bins the data every time by calling V_QBinAllPanels(folderStr,binType) from inside V_BinningModePopup()866 // x- currently just the graph, no controls 867 // 868 868 Function V_annularAvgButtonProc(ba) : ButtonControl 869 869 STRUCT WMButtonAction &ba -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Utilities_General.ipf
r1064 r1073 6 6 // 7 7 // for use by multiple panels and packages 8 9 10 //prompts user to choose the local folder that contains the SANS Data 8 // 9 10 11 //prompts user to choose the local folder that contains the VSANS Data 11 12 //only one folder can be used, and its path is catPathName (and is a NAME, not a string) 12 13 //this will overwrite the path selection … … 76 77 return(WaveExists(w)) 77 78 end 79 80 78 81 // 79 82 // tests if two values are close enough to each other … … 94 97 95 98 96 // TODO:97 // -- this must be called as needed to force a re-read of the data from disk99 // (DONE): 100 // x- this must be called as needed to force a re-read of the data from disk 98 101 // "as needed" means that when an operation is done that needs to ensure 99 102 // a fresh read from disk, it must take care of the kill. 100 // -- the ksBaseDFPath needs to be removed. It's currently pointing to RawVSANS, which is103 // x- the ksBaseDFPath needs to be removed. It's currently pointing to RawVSANS, which is 101 104 // really not used as intended anymore. 105 // 106 // *** this appears to be unused, in favor of V_CleanupData_w_Progress(0,1) ********** 102 107 // 103 108 Function V_KillNamedDataFolder(fname) … … 115 120 end 116 121 117 // TODO:122 // (DONE) 118 123 // x- this still does not quite work. If there are no sub folders present in the RawVSANS folder 119 124 // it still thinks there is (1) item there. 120 // -- if I replace the semicolon with a comma, it thinks there are two folders present and appears125 // x- if I replace the semicolon with a comma, it thinks there are two folders present and appears 121 126 // to delete the RawVSANS folder itself! seems very dangerous...this is because DataFolderDir returns 122 127 // a comma delimited list, but with a semicolon and \r at the end. need to remove these... … … 212 217 endif 213 218 214 ValDisplay valdisp0,win=ProgressPanel,value= _NUM:num ,win=ProgressPanel219 ValDisplay valdisp0,win=ProgressPanel,value= _NUM:num 215 220 DoUpdate /W=ProgressPanel 216 221 while(1) … … 501 506 V_PlotData_Panel() // read the binType from the panel 502 507 Variable binType = V_GetBinningPopMode() 503 V_BinningModePopup("",binType,"") // does default circular binning and updates the graph 508 ControlInfo/W=V_1D_Data popup0 509 V_BinningModePopup("",binType,S_Value) // does default circular binning and updates the graph 504 510 505 511 … … 607 613 // (check the instrument name...) 608 614 609 // TODO -- as was written by SANS, this function is expecting fname to be the path:fileName615 // (DONE) x- as was written by SANS, this function is expecting fname to be the path:fileName 610 616 // - but are the V_get() functions OK with getting a full path, and what do they 611 617 // do when they fail? I don't want them to spit up another open file dialog 612 618 // 613 // -- problem -- if "sans1234.abs" is passed, then V_getStringFromHDF5(fname,path,num)619 // x- problem -- if "sans1234.abs" is passed, then V_getStringFromHDF5(fname,path,num) 614 620 // will remove the extension and look for the sans1234 folder -- which may or may not be present. 615 621 // If it is present, then sans1234 validates as RAW data -- which is incorrect! 616 // -- so I need a way to exclude everything that does not have the proper extension...622 // x- so I need a way to exclude everything that does not have the proper extension... 617 623 // 618 624 // … … 673 679 674 680 675 // TODO -- the file name structure for VSANS file is undecided681 // (DONE) x- the file name structure for VSANS file is undecided 676 682 // so some of these base functions will need to change 677 683 // -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_VSANS_Preferences.ipf
r1056 r1073 93 93 // Special global to prevent fake data from "B" detector from being written out 94 94 val = NumVarOrDefault("root:Packages:NIST:VSANS:Globals:gIgnoreDetB", 1 ) 95 Variable/G root:Packages:NIST:VSANS:Globals:gIgnoreDetB = 095 Variable/G root:Packages:NIST:VSANS:Globals:gIgnoreDetB = 1 96 96 97 97 DoAlert 0,"The Back detector will be ignored. Change this in the Preferences Panel" 98 98 99 // flag to allow adding raw data files with different attenuation (normally not done) 99 100 // val = NumVarOrDefault("root:Packages:NIST:VSANS:Globals:gDoAdjustRAW_Atten",0) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WorkFolderUtils.ipf
r1055 r1073 607 607 // (3) dead time correction 608 608 // TODO: 609 // x- remove the hard-wired test - done610 609 // -- test for correct operation 611 610 // x- loop over all of the detectors … … 646 645 647 646 // (4) solid angle correction 648 // TODO-- this currently calculates the correction factor AND applys it to the data647 // -- this currently calculates the correction factor AND applys it to the data 649 648 // -- as a result, the data values are very large since they are divided by a very small 650 649 // solid angle per pixel. But all of the count values are now on the basis of 651 650 // counts/(solid angle) --- meaning that they can all be binned together for I(q) 652 // -and- TODO - this will need to betaken into account for absolute scaling (this part is already done)651 // -and- - this is taken into account for absolute scaling (this part is already done) 653 652 // 654 653 // the solid angle correction is calculated for ALL detector panels. -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Write_VSANS_QIS.ipf
r1064 r1073 4 4 5 5 6 / TODO:6 // TODO: 7 7 // -- this is a temporary solution before a real writer is created 8 8 // -- resolution is not generated here (and it shouldn't be) since resolution is not known yet.
Note: See TracChangeset
for help on using the changeset viewer.