- Timestamp:
- Jul 23, 2012 11:00:55 AM (11 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_FlipperPanel.ipf
r853 r858 212 212 213 213 Make/O/T/N=1 $("CondCell_"+popStr) 214 WAVE/T cell=$("CondCell_"+popStr) 215 cell[0] = "Enter cell name" 214 216 215 217 Make/O/D/N=(1,8) $("Cond_"+popStr) … … 397 399 398 400 // do the calculations: 401 // cr1 = TotalCR_FromRun(w[selRow][%UU_Trans],err_cr1,1) 402 // cr2 = TotalCR_FromRun(w[selRow][%DU_Trans],err_cr2,1) 403 // cr3 = TotalCR_FromRun(w[selRow][%DD_Trans],err_cr3,1) 404 // cr4 = TotalCR_FromRun(w[selRow][%UD_Trans],err_cr4,1) 405 // cr5 = TotalCR_FromRun(w[selRow][%Blocked],err_cr5,1) //blocked beam is NOT normalized to zero attenuators 406 // Print "The Blocked CR is *NOT* rescaled to zero attenuators -- FlipperAverageButtonProc" 399 407 cr1 = TotalCR_FromRun(w[selRow][%UU_Trans],err_cr1,0) 400 408 cr2 = TotalCR_FromRun(w[selRow][%DU_Trans],err_cr2,0) 401 409 cr3 = TotalCR_FromRun(w[selRow][%DD_Trans],err_cr3,0) 402 410 cr4 = TotalCR_FromRun(w[selRow][%UD_Trans],err_cr4,0) 403 // cr5 = TotalCR_FromRun(w[selRow][%Blocked],err_cr5,1) //blocked beam is NOT normalized to zero attenuators404 // Print "The Blocked CR is *NOT* rescaled to zero attenuators -- FlipperAverageButtonProc"405 411 cr5 = TotalCR_FromRun(w[selRow][%Blocked],err_cr5,0) //blocked beam is normalized to zero attenuators 406 412 Print "The Blocked CR *IS* rescaled to zero attenuators -- FlipperAverageButtonProc" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf
r855 r858 89 89 // for the menu 90 90 Menu "Macros" 91 "Flipping Ratio",ShowFlippingRatioPanel() 91 92 "1 Fundamental Cell Parameters",ShowCellParamPanel() 92 93 "2 Cell Decay",ShowCellDecayPanel() … … 1450 1451 1451 1452 //////////////////////////////////////////// 1453 1454 1455 // 1456 // a simple little panel to calculate the flipping ratio. 1457 // 3 input files, calculates the flipping ratio, then simply reports the result 1458 // 1459 1460 Proc ShowFlippingRatioPanel() 1461 1462 // init folders 1463 // ASK before initializing cell constants 1464 // open the panel 1465 DoWindow/F FlipRatio 1466 if(V_flag == 0) 1467 FlippingRatioPanel() 1468 endif 1469 1470 end 1471 1472 Proc FlippingRatioPanel() 1473 PauseUpdate; Silent 1 // building window... 1474 NewPanel /W=(455,44,805,245)/N=FlipRatio/K=1 as "Flipping Ratio" 1475 ModifyPanel cbRGB=(65535,49157,16385) 1476 // ShowTools/A 1477 SetDrawLayer UserBack 1478 GroupBox group0,pos={12,9},size={307,123},title="Flipping Ratio" 1479 SetVariable setvar0,pos={23,35},size={150,15},title="UU or DD File" 1480 SetVariable setvar0,limits={-inf,inf,0},value= _NUM:0 1481 SetVariable setvar1,pos={23,58},size={150,15},title="UD or DU File" 1482 SetVariable setvar1,limits={-inf,inf,0},value= _NUM:0 1483 SetVariable setvar2,pos={23,82},size={150,15},title="Blocked beam" 1484 SetVariable setvar2,limits={-inf,inf,0},value= _NUM:0 1485 SetVariable setvar3,pos={23,104},size={240,16},title="Flipping Ratio",fSize=12 1486 SetVariable setvar3,fStyle=1,limits={-inf,inf,0},value= _STR:"enter the run numbers" 1487 Button button0,pos={214,55},size={90,20},proc=CalcFlippingRatioButtonProc,title="Calculate" 1488 EndMacro 1489 1490 1491 1492 Function CalcFlippingRatioButtonProc(ba) : ButtonControl 1493 STRUCT WMButtonAction &ba 1494 1495 1496 Variable num0,num1,num2,cr0,cr1,cr2,err_cr0,err_cr1,err_cr2 1497 Variable tmp0,tmp1,tmp2,flip,flip_err 1498 String str="" 1499 1500 switch( ba.eventCode ) 1501 case 2: // mouse up 1502 // click code here 1503 1504 ControlInfo setvar0 1505 num0 = V_Value 1506 ControlInfo setvar1 1507 num1 = V_Value 1508 ControlInfo setvar2 1509 num2 = V_Value 1510 1511 cr0 = TotalCR_FromRun(num0,err_cr0,0) //last zero means yes, normalize everything to zero atten 1512 cr1 = TotalCR_FromRun(num1,err_cr1,0) 1513 cr2 = TotalCR_FromRun(num2,err_cr2,0) // this one is the blocked beam 1514 1515 1516 flip = (cr0-cr2)/(cr1-cr2) 1517 tmp0 = 1/(cr1-cr2) 1518 tmp1 = -1*flip/(cr1-cr2) 1519 tmp2 = flip/(cr1-cr2) - 1/(cr1-cr2) 1520 flip_err = tmp0^2*err_cr0^2 + tmp1^2*err_cr1^2 +tmp2^2*err_cr2^2 1521 flip_err = sqrt(flip_err) 1522 1523 1524 1525 Printf "Flipping ratio = %g +/- %g (%g%)\r",flip,flip_err,flip_err/flip*100 1526 str = num2str(flip)+" +/- "+num2str(flip_err) 1527 SetVariable setvar3,value=_STR:str 1528 1529 break 1530 case -1: // control being killed 1531 break 1532 endswitch 1533 1534 return 0 1535 End 1536 1537 1538 /////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.