- Timestamp:
- Feb 6, 2012 12:19:28 PM (11 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_FlipperPanel.ipf
r832 r835 22 22 // two waves per condition "Cond_Name_Cell" and "CondCalc_Name_Cell" 23 23 // 24 MacroShowFlipperPanel()24 Proc ShowFlipperPanel() 25 25 26 26 // init folders … … 180 180 SetDataFolder root: 181 181 182 // update the globals that are displayed from the wave note 183 String nStr=Note(cond) 184 SVAR gPsmPf = root:Packages:NIST:Polarization:Cells:gPsmPf 185 SVAR gPsm = root:Packages:NIST:Polarization:Cells:gPsm 186 sprintf gPsmPf, "%g +/- %g",NumberByKey("P_sm_f", nStr, "=",","),NumberByKey("err_P_sm_f", nStr, "=",",") 187 sprintf gPsm, "%g +/- %g",NumberByKey("P_sm", nStr, "=",","),NumberByKey("err_P_sm", nStr, "=",",") 188 189 182 190 break 183 191 case -1: // control being killed … … 215 223 // generate the dummy wave note now, change as needed 216 224 String cellStr = StringFromList(1, popStr,"_") 217 String testStr = "P_sm_f= 2,err_P_sm_f=0,P_sm=0.6,err_P_sm=0,T0=asdf,"225 String testStr = "P_sm_f=0,err_P_sm_f=0,P_sm=0,err_P_sm=0,T0=undefined," 218 226 // testStr = ReplaceStringByKey("Cell", testStr, cellStr ,"=", ",", 0) 219 227 Note cond, testStr -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationCorrection.ipf
r829 r835 75 75 76 76 // main entry to the PolCor Panel 77 MacroShowPolCorSetup()77 Proc ShowPolCorSetup() 78 78 79 79 Variable restore=0 … … 269 269 Button button4,pos={620,18},size={30,20},proc=PolCorHelpParButtonProc,title="?" 270 270 Button button12,pos={440,473},size={120,20},proc=Display4XSButton,title="Display 4 XS" 271 Button button13,pos={440,446},size={120,20},proc=ClearPolCorEntries,title="Clear Entries" 271 272 272 273 PopupMenu popup1,pos={210,24},size={102,20},title="Condition" … … 1015 1016 1016 1017 Variable row,Psm, PsmPf, PCell,err_Psm, err_PsmPf, err_PCell 1017 Variable ii,jj,muPo,err_muPo,gam,err_gam,monCts,t1,num 1018 Variable ii,jj,muPo,err_muPo,gam,err_gam,monCts,t1,num,fileCount 1018 1019 1019 1020 Variable ea_uu, ea_ud, ea_dd, ea_du … … 1057 1058 1058 1059 // loop over the (10) rows in the listWave 1060 fileCount=0 1059 1061 for(ii=0;ii<num;ii+=1) 1060 1062 runStr = lb[ii][0] //the run number 1061 1063 if(cmpstr(runStr, "" ) != 0) 1062 1064 1065 fileCount += 1 //one more file is added 1063 1066 // get run number (str) 1064 1067 // get file name … … 1085 1088 // get file info (monitor counts) 1086 1089 monCts = getMonitorCount(fname) 1087 monCts /= 1e8 // just to get reasonable values1090 monCts /= 1e8 //to get a normalized value to add proportionally 1088 1091 1089 1092 Variable err_monCts … … 1209 1212 // can't take the SQRT here, since the matrix won't necessarily be full yet, 1210 1213 1211 1214 // but now need to re-normalize the row based on the number of files that were added 1215 // pType has only one value as passed in, so the row has already been set. It would be more correct 1216 // to switch based on pType... 1217 1218 matA[row][0] /= fileCount 1219 matA[row][1] /= fileCount 1220 matA[row][2] /= fileCount 1221 matA[row][3] /= fileCount 1222 1223 matA_err[row][0] /= fileCount 1224 matA_err[row][1] /= fileCount 1225 matA_err[row][2] /= fileCount 1226 matA_err[row][3] /= fileCount 1227 1212 1228 SetDataFolder root: 1213 1229 return(0) … … 2449 2465 End 2450 2466 2467 // clear the entries for all 4 XS for the currently selected Tab only 2468 // clears both the run numbers and the cell assignments 2469 // 2470 Function ClearPolCorEntries(ba) : ButtonControl 2471 STRUCT WMButtonAction &ba 2472 2473 switch( ba.eventCode ) 2474 case 2: // mouse up 2475 // click code here 2476 // 2477 // String type 2478 Variable tabNum 2479 ControlInfo/W=PolCor_Panel PolCorTab 2480 // type = S_value 2481 // Print "selected data type = ",type,V_Value 2482 tabNum = V_Value 2483 2484 WAVE/T twDD = $("root:Packages:NIST:Polarization:ListWave_"+num2str(tabNum)+"_DD") 2485 WAVE/T twUU = $("root:Packages:NIST:Polarization:ListWave_"+num2str(tabNum)+"_UU") 2486 WAVE/T twUD = $("root:Packages:NIST:Polarization:ListWave_"+num2str(tabNum)+"_UD") 2487 WAVE/T twDU = $("root:Packages:NIST:Polarization:ListWave_"+num2str(tabNum)+"_DU") 2488 2489 twDD = "" 2490 twUU = "" 2491 twUD = "" 2492 twDU = "" 2493 2494 break 2495 case -1: // control being killed 2496 break 2497 endswitch 2498 2499 return 0 2500 End 2451 2501 2452 2502 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf
r832 r835 3 3 4 4 // TODO: 5 // - on the decay panel. need to be able to manually enter a date that is to or an offset5 // x- on the decay panel. need to be able to manually enter a date that is to or an offset 6 6 // number of hours. currently it takes the first file as t=0, which is often not correct 7 7 // … … 16 16 // -1- Fundamental Cell Parameters -- these are constants, generally not editable. (this file) 17 17 // -2- Decay Parameters -- these are fitted values based on transmission mearurements (this file) 18 // -3- Flipper Panel is in its own procedure ( FlipperPanel.ipf)19 // -4- PolCor_Panel is in Pol arizationCorrection.ipf20 18 // -3- Flipper Panel is in its own procedure (Pol_FlipperPanel.ipf) 19 // -4- PolCor_Panel is in Pol_PolarizationCorrection.ipf 20 // 21 21 // 22 22 // Driven by 4 panels to get the necessary information from the users … … 71 71 // - Polarization correction is done with one click (one per tab). "_pc" tags are added to the resulting names, 72 72 // and copies of all of the associated waves are again copied (wasteful), but makes switching display very easy 73 // - Once all of the polariz tion correction is done, then the UU_pc (etc.) data can be reduced as usual (xx_pc = 4 passes)73 // - Once all of the polarization correction is done, then the UU_pc (etc.) data can be reduced as usual (xx_pc = 4 passes) 74 74 // - protocol is built as ususal, from this panel only (since the SAM, EMP, and BGD need to be switched, rather than loaded 75 75 // - protocols can be saved/recalled. … … 84 84 85 85 86 // for the menu 87 Menu "Macros" 88 "1 Fundamental Cell Parameters",ShowCellParamPanel() 89 "2 Cell Decay",ShowCellDecayPanel() 90 "3 Flipper States",ShowFlipperPanel() 91 "4 Polarization Correction",ShowPolCorSetup() 92 End 93 86 94 87 95 // … … 96 104 // Te=num 97 105 // err_Te=num 98 // mu=n num106 // mu=num 99 107 // err_mu=num 100 108 // … … 103 111 // all of the strings start w/ "gCell_" 104 112 // 105 MacroShowCellParamPanel()113 Proc ShowCellParamPanel() 106 114 107 115 // init folders … … 359 367 // all of the strings start w/ "gDecay_" 360 368 // 361 MacroShowCellDecayPanel()369 Proc ShowCellDecayPanel() 362 370 363 371 // init folders … … 426 434 Button button_6,pos={620,620},size={100,20},proc=WindowSnapshotButton,title="Snapshot" 427 435 Button button_7,pos={620,580},size={130,20},proc=ManualEnterDecayButton,title="Manual Entry" 428 436 CheckBox check0,mode=0,pos={600,550},title="Overrride T0?",value=0 429 437 430 438 … … 561 569 SetDataFolder root: 562 570 571 // 572 // now show the fit results, if any, from the wave note 573 // 574 SVAR gMuPo = root:Packages:NIST:Polarization:Cells:gMuPo 575 SVAR gPo = root:Packages:NIST:Polarization:Cells:gPo 576 SVAR gGamma = root:Packages:NIST:Polarization:Cells:gGamma 577 SVAR gT0 = root:Packages:NIST:Polarization:Cells:gT0 578 String nStr=note(decay) 579 580 581 // for the panel display 582 sprintf gMuPo, "%g +/- %g",NumberByKey("muP", nStr, "=",","),NumberByKey("err_muP", nStr, "=",",") 583 sprintf gPo, "%g +/- %g",NumberByKey("P0", nStr, "=",","),NumberByKey("err_P0", nStr, "=",",") 584 sprintf gGamma, "%g +/- %g",NumberByKey("gamma", nStr, "=",","),NumberByKey("err_gamma", nStr, "=",",") 585 gT0 = StringByKey("T0", nStr, "=",",") 586 587 588 // clear the graph - force the user to update it manually 589 // clear old data, and plot the new 590 // 591 SetDataFolder root:Packages:NIST:Polarization:Cells: 592 593 CheckDisplayed/W=DecayPanel#G0 tmp_muP,tmp_muP2,fit_tmp_muP 594 // if both present, bit 0 + bit 1 = 3 595 if(V_flag & 2^0) //check bit 0 596 RemoveFromGraph/W=DecayPanel#G0 tmp_muP 597 endif 598 if(V_flag & 2^1) 599 RemoveFromGraph/W=DecayPanel#G0 tmp_muP2 600 endif 601 if(V_flag & 2^2) 602 RemoveFromGraph/W=DecayPanel#G0 fit_tmp_muP 603 endif 604 605 // kill the text box (name is hard-wired) 606 TextBox/W=DecayPanel#G0/K/N=CF_tmp_muP 607 608 setDataFolder root: 609 563 610 break 564 611 case -1: // control being killed … … 588 635 589 636 // generate the dummy wave note now, change as needed 590 Note decay, "muP= 2,err_muP=0,P0=0.6,err_P0=0,T0=asdf,gamma=200,err_gamma=0,"637 Note decay, "muP=0,err_muP=0,P0=0,err_P0=0,T0=undefined,gamma=0,err_gamma=0," 591 638 592 639 // to hold the results of the calculation … … 657 704 // selRow = V_startRow 658 705 659 Variable sum_muP, err_avg_muP, sum_Po, err_avg_Po, avg_muP, avg_Po 706 Variable sum_muP, err_avg_muP, sum_Po, err_avg_Po, avg_muP, avg_Po, overrideT0 660 707 sum_muP = 0 661 708 sum_Po = 0 … … 663 710 err_avg_Po = 0 664 711 712 ControlInfo/W=DecayPanel check0 713 overrideT0 = V_Value 714 665 715 for(selRow=0;selRow<numRows;selRow+=1) 666 716 Print "calculate the row ",selRow 667 717 668 if(selRow == 0 )718 if(selRow == 0 && !overrideT0) 669 719 //find T0 670 720 fname = FindFileFromRunNumber(w[0][%Trans_He_In]) … … 677 727 Note w, noteStr 678 728 Print t0str 679 w[selRow][%elapsed_hr] = 0 //by definition 729 else 730 // manually entered on the panel to override the 731 SVAR gT0 = root:Packages:NIST:Polarization:Cells:gT0 732 t0Str = gT0 733 noteStr = note(w) 734 noteStr = ReplaceStringByKey("T0", noteStr, gT0 ,"=", ",", 0) 735 Note/K w 736 Note w, noteStr 737 Print t0str 680 738 endif 681 739
Note: See TracChangeset
for help on using the changeset viewer.