- Timestamp:
- Sep 10, 2009 3:45:30 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/U_CALC.ipf
r550 r551 15 15 // 16 16 // - more presets 17 // - fast ways to increase/decrease number of points 18 // - fast ways to increase/decrease counting time 19 // 20 // - plot as countrate, not absolute scale 21 // - 3e-5 cutoff 22 // - ? don't plot lowest angle range (but needs to be in the count time) 17 18 // 19 // X plot as countrate, not absolute scale 20 // X 3e-5 cutoff 21 // X ? don't plot lowest angle range (but needs to be in the count time) 23 22 // - need empty beam and empty cell count rate vs. aperture (Cd vs. Gd?) 24 23 // … … 28 27 // or at least compare to what the empty cell would give in the same count time 29 28 // 30 // model the direct beam?? currently the "red" region from -1 to 0.6 is almost entirely29 // -? model the direct beam?? currently the "red" region from -1 to 0.6 is almost entirely 31 30 // the primary beam, so it's a bit artificial (qmin is really ~ 3e-5) 32 31 // 33 32 34 33 // 35 // Need T_wide, T_rock, I peak for proper absolute scaling 34 // Need T_wide, T_rock, I peak for proper absolute scaling, but I don't know if it's really important 35 // to be able to simlulate to this extent 36 36 // 37 37 … … 103 103 Variable/G gCtTime6 = 2000 104 104 Variable/G gIncr6 = 2 105 106 Variable/G gAngLow7 = 50 107 Variable/G gAngHigh7 = 95 108 Variable/G gNumPts7 = 10 109 Variable/G gCtTime7 = 0 110 Variable/G gIncr7 = 5 105 111 106 112 // results, setup values … … 287 293 Variable pos=strsearch(platform,"WINDOWS",0) 288 294 if(pos >= 0) //windows 289 Display /W=(55,44, 955,544) /K=1295 Display /W=(55,44,855,450) /K=1 290 296 else //mac 291 297 Display /W=(55,44,1055,544) /K=1 … … 297 303 ControlBar/L 500 298 304 299 GroupBox group0,pos={5,1},size={493,1 59},title="Instrument Setup"300 GroupBox group1,pos={5,1 65},size={240,147},title="Sample Setup"301 GroupBox group2,pos={5,3 25},size={259,147},title="Results"305 GroupBox group0,pos={5,1},size={493,177},title="Instrument Setup" 306 GroupBox group1,pos={5,183},size={240,147},title="Sample Setup" 307 GroupBox group2,pos={5,343},size={259,147},title="Results" 302 308 303 309 PopupMenu popup0,pos={17,19},size={165,20},title="Sample Aperture Diam (in)" … … 316 322 SetVariable setvar1d,pos={left+299,top},size={100,15},title="# points",value= gNumPts1 317 323 SetVariable setvar1e,pos={left+399,top},size={93,15},title="count (s)",value= gCtTime1 318 SetVariable setvar1a,labelBack=(65535,32768,32768) 324 // SetVariable setvar1a,labelBack=(65535,32768,32768) //old rainbow 325 SetVariable setvar1a,labelBack=(49858,65535,65535) 319 326 320 327 pt += inc … … 324 331 SetVariable setvar2d,pos={left+299,top+pt},size={100,15},title="# points",value= gNumPts2 325 332 SetVariable setvar2e,pos={left+399,top+pt},size={93,15},title="count (s)",value= gCtTime2 326 SetVariable setvar2a labelBack=(65535,65533,32768) 333 // SetVariable setvar2a labelBack=(65535,65533,32768) //old rainbow 334 SetVariable setvar2a labelBack=(21074,8995,21074) 327 335 328 336 pt += inc … … 332 340 SetVariable setvar3d,pos={left+299,top+pt},size={100,15},title="# points",value= gNumPts3 333 341 SetVariable setvar3e,pos={left+399,top+pt},size={93,15},title="count (s)",value= gCtTime3 334 SetVariable setvar3a labelBack=(32769,65535,32768) 342 // SetVariable setvar3a labelBack=(32769,65535,32768) //old rainbow 343 SetVariable setvar3a labelBack=(0,60652,60652) 335 344 336 345 pt += inc … … 340 349 SetVariable setvar4d,pos={left+299,top+pt},size={100,15},title="# points",value= gNumPts4 341 350 SetVariable setvar4e,pos={left+399,top+pt},size={93,15},title="count (s)",value= gCtTime4 342 SetVariable setvar4a labelBack=(32768,65535,65535) 351 // SetVariable setvar4a labelBack=(32768,65535,65535) //old rainbow 352 SetVariable setvar4a labelBack=(0,51400,0) 343 353 344 354 pt += inc … … 348 358 SetVariable setvar5d,pos={left+299,top+pt},size={100,15},title="# points",value= gNumPts5 349 359 SetVariable setvar5e,pos={left+399,top+pt},size={93,15},title="count (s)",value= gCtTime5 350 SetVariable setvar5a labelBack=(32768,54615,65535) 360 // SetVariable setvar5a labelBack=(32768,54615,65535) //old rainbow 361 SetVariable setvar5a labelBack=(59367,49344,0) 351 362 352 363 pt += inc … … 356 367 SetVariable setvar6d,pos={left+299,top+pt},size={100,15},title="# points",value= gNumPts6 357 368 SetVariable setvar6e,pos={left+399,top+pt},size={93,15},title="count (s)",value= gCtTime6 358 SetVariable setvar6a labelBack=(44253,29492,58982) 369 // SetVariable setvar6a labelBack=(44253,29492,58982) //old rainbow 370 SetVariable setvar6a labelBack=(54998,0,0) 371 372 pt += inc 373 SetVariable setvar7a,pos={left+17,top+pt},size={90,15},title="theta min",value= gAngLow7 374 SetVariable setvar7b,pos={left+113,top+pt},size={89,15},title="theta max",value= gAngHigh7 375 SetVariable setvar7c,pos={left+209,top+pt},size={89,15},title="increm",value= gIncr7 376 SetVariable setvar7d,pos={left+299,top+pt},size={100,15},title="# points",value= gNumPts7 377 SetVariable setvar7e,pos={left+399,top+pt},size={93,15},title="count (s)",value= gCtTime7 378 // SetVariable setvar7a labelBack=(44253,29492,58982) //old rainbow 379 SetVariable setvar7a labelBack=(39321,21845,51657) 359 380 360 381 // the action procedures and limits/increments … … 365 386 SetVariable setvar5a proc=ThetaMinSetVarProc 366 387 SetVariable setvar6a proc=ThetaMinSetVarProc 388 SetVariable setvar7a proc=ThetaMinSetVarProc 367 389 368 390 // … … 373 395 SetVariable setvar5b proc=ThetaMaxSetVarProc 374 396 SetVariable setvar6b proc=ThetaMaxSetVarProc 397 SetVariable setvar7b proc=ThetaMaxSetVarProc 375 398 // 376 399 SetVariable setvar1c proc=IncrSetVarProc,limits={0.01,0.1,0.01} … … 380 403 SetVariable setvar5c proc=IncrSetVarProc,limits={0.5,5,1} 381 404 SetVariable setvar6c proc=IncrSetVarProc,limits={1,10,2} 405 SetVariable setvar7c proc=IncrSetVarProc,limits={1,20,2} 382 406 // 383 407 SetVariable setvar1d proc=NumPtsSetVarProc,limits={2,50,1} … … 387 411 SetVariable setvar5d proc=NumPtsSetVarProc,limits={2,50,1} 388 412 SetVariable setvar6d proc=NumPtsSetVarProc,limits={2,50,1} 413 SetVariable setvar7d proc=NumPtsSetVarProc,limits={2,50,1} 389 414 // 390 415 SetVariable setvar1e proc=CtTimeSetVarProc,limits={-1,50000,1} … … 394 419 SetVariable setvar5e proc=CtTimeSetVarProc,limits={-1,50000,100} 395 420 SetVariable setvar6e proc=CtTimeSetVarProc,limits={-1,50000,100} 396 397 Button button0,pos={left+280,180},size={60,20},fColor=(65535,65535,0),proc=U_SimPlotButtonProc,title="Plot" 398 CheckBox check0_2,pos={left+280,230},size={60,14},title="CountRate?",variable= root:Packages:NIST:USANS:Globals:U_Sim:g_1D_PlotCR 399 CheckBox check0_3,pos={left+280,250},size={60,14},title="Noise?",variable= root:Packages:NIST:USANS:Globals:U_Sim:g_1D_AddNoise 400 CheckBox check0_4 title="Show EMP?",pos={left+280,270},proc=ShowEMPCheckProc,value=0 421 SetVariable setvar7e proc=CtTimeSetVarProc,limits={-1,50000,100} 422 423 Button button0,pos={left+280,200},size={130,20},fColor=(65535,65535,0),proc=U_SimPlotButtonProc,title="Simulate USANS" 424 CheckBox check0_2,pos={left+280,250},size={60,14},title="CountRate?",variable= root:Packages:NIST:USANS:Globals:U_Sim:g_1D_PlotCR 425 CheckBox check0_3,pos={left+280,270},size={60,14},title="Noise?",variable= root:Packages:NIST:USANS:Globals:U_Sim:g_1D_AddNoise 426 CheckBox check0_4 title="Show EMP?",pos={left+280,290},proc=ShowEMPCheckProc,value=0 401 427 402 428 … … 405 431 ThetaEditMode(2) //checked on startup 406 432 407 // instrumentsetup408 SetVariable U_setvar0_1,pos={left+20,2 11},size={160,15},title="Thickness (cm)"433 // sample setup 434 SetVariable U_setvar0_1,pos={left+20,231},size={160,15},title="Thickness (cm)" 409 435 SetVariable U_setvar0_1,limits={0,inf,0.1},value= root:Packages:NIST:USANS:Globals:U_Sim:gThick 410 SetVariable U_setvar0_3,pos={left+20,2 35},size={160,15},title="Sample Transmission"436 SetVariable U_setvar0_3,pos={left+20,255},size={160,15},title="Sample Transmission" 411 437 SetVariable U_setvar0_3,limits={0,1,0.01},value= root:Packages:NIST:USANS:Globals:U_Sim:gSamTrans 412 PopupMenu U_popup0,pos={left+20, 185},size={165,20},proc=Sim_USANS_ModelPopMenuProc,title="Model"438 PopupMenu U_popup0,pos={left+20,205},size={165,20},proc=Sim_USANS_ModelPopMenuProc,title="Model" 413 439 PopupMenu U_popup0,mode=1,value= #"U_FunctionPopupList()" 414 SetVariable setvar0,pos={left+20,2 59},size={120,15},title="Empty Level",disable=2440 SetVariable setvar0,pos={left+20,279},size={120,15},title="Empty Level",disable=2 415 441 SetVariable setvar0,limits={0,10,0.01},value= root:Packages:NIST:USANS:Globals:U_Sim:g_EmptyLevel 416 SetVariable setvar0_1,pos={left+20, 284},size={120,15},title="Bkg Level",disable=2442 SetVariable setvar0_1,pos={left+20,304},size={120,15},title="Bkg Level",disable=2 417 443 SetVariable setvar0_1,limits={0,10,0.01},value= root:Packages:NIST:USANS:Globals:U_Sim:g_BkgLevel 418 444 … … 420 446 421 447 // a box for the results 422 SetVariable totalTime,pos={left+20,350},size={150,15},title="Count time (h:m)",value= gTotTimeStr 423 // ValDisplay valdisp0,pos={338,210},size={220,13},title="Total detector counts" 424 // ValDisplay valdisp0,limits={0,0,0},barmisc={0,1000},value= root:Packages:NIST:USANS:Globals:U_Sim:g_1DTotCts 425 ValDisplay valdisp0_2,pos={left+20,380},size={220,13},title="Fraction of beam scattered" 448 SetVariable totalTime,pos={left+20,370},size={150,15},title="Count time (h:m)",value= gTotTimeStr 449 ValDisplay valdisp0_2,pos={left+20,395},size={220,13},title="Fraction of beam scattered" 426 450 ValDisplay valdisp0_2,limits={0,0,0},barmisc={0,1000},value= root:Packages:NIST:USANS:Globals:U_Sim:g_1DFracScatt 427 ValDisplay valdisp0_3,pos={left+20,410},size={220,13},title="Estimated transmission" 451 ValDisplay valdisp0_2,disable=1 452 ValDisplay valdisp0_3,pos={left+20,420},size={220,13},title="Estimated transmission" 428 453 ValDisplay valdisp0_3,limits={0,0,0},barmisc={0,1000},value=root:Packages:NIST:USANS:Globals:U_Sim:g_1DEstTrans 429 Button button1,pos={left+20,440},size={50,20},proc=U_SaveButtonProc,title="Save" 454 ValDisplay valdisp0_3,disable=1 455 Button button1,pos={left+20,440},size={150,20},proc=U_SaveButtonProc,title="Save Simulated Data" 430 456 431 457 … … 550 576 End 551 577 552 // hard-wired for 6controls578 // hard-wired for 7 controls 553 579 // return value is in seconds 554 580 // global display string is set with hrs:min … … 557 583 Variable ii,num,totTime=0 558 584 String pathStr="root:Packages:NIST:USANS:Globals:U_Sim:" 559 num= 6585 num=7 560 586 561 587 for(ii=1;ii<=num;ii+=1) … … 585 611 End 586 612 587 // changes edit mode of the theta min/max boxes for simplified setup613 // changes edit mode of the theta min/max boxes and increment for simplified setup 588 614 // val = 2 = disable 589 615 // val = 0 = edit enabled … … 593 619 SetVariable setvar1a,win=UCALC,disable=val 594 620 SetVariable setvar1b,win=UCALC,disable=val 621 SetVariable setvar1c,win=UCALC,disable=val 595 622 596 623 SetVariable setvar2a,win=UCALC,disable=val 597 624 SetVariable setvar2b,win=UCALC,disable=val 625 SetVariable setvar2c,win=UCALC,disable=val 598 626 599 627 SetVariable setvar3a,win=UCALC,disable=val 600 628 SetVariable setvar3b,win=UCALC,disable=val 629 SetVariable setvar3c,win=UCALC,disable=val 601 630 602 631 SetVariable setvar4a,win=UCALC,disable=val 603 632 SetVariable setvar4b,win=UCALC,disable=val 633 SetVariable setvar4c,win=UCALC,disable=val 604 634 605 635 SetVariable setvar5a,win=UCALC,disable=val 606 636 SetVariable setvar5b,win=UCALC,disable=val 637 SetVariable setvar5c,win=UCALC,disable=val 607 638 608 639 SetVariable setvar6a,win=UCALC,disable=val 609 640 SetVariable setvar6b,win=UCALC,disable=val 610 641 SetVariable setvar6c,win=UCALC,disable=val 642 643 SetVariable setvar7a,win=UCALC,disable=val 644 SetVariable setvar7b,win=UCALC,disable=val 645 SetVariable setvar7c,win=UCALC,disable=val 611 646 return(0) 612 647 End … … 735 770 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 736 771 737 num = 6//# of angular ranges772 num = 7 //# of angular ranges 738 773 739 774 // only try to plot ranges with non-zero count times … … 832 867 Imon = GetUSANSBeamIntensity() //based on the aperture size, select the beam intensity 833 868 Print "imon=",imon 869 834 870 // calculate the scattering cross section simply to be able to estimate the transmission 835 871 // unfortunately, this calculation is useless in the USANS range. So although it's calculated, the 872 // results are never reported. 873 // -- the main issue is that the integration range is optimized for SANS, and is not useful for USANS 874 // -there are only a few points in the USANS range, and extending it lower caused issues before. 836 875 CalculateRandomDeviate(funcUnsmeared,$coefStr,wavelength,"root:Packages:NIST:SAS:ran_dev",sig_sas) 837 876 … … 1069 1108 // add SIM data to the graph if it exists and is not already on the graph 1070 1109 // 1110 // 1111 // ** currently, I have changed the graph to not display the angle at the top. I have not yet 1112 // found a way to keep the scaling of the two axes in-sync when the empty cell data is added to the 1113 // graph (versus Q) 1114 // 1071 1115 Function GraphSIM() 1072 1116 … … 1090 1134 1091 1135 // lines for the no-noise result vs angle 1092 AppendToGraph/T Smeared_inten vs angle 1136 // AppendToGraph/T Smeared_inten vs angle 1137 AppendToGraph Smeared_inten vs Sim_USANS_q 1093 1138 ModifyGraph rgb(Smeared_inten)=(1,12815,52428) 1094 1139 ModifyGraph mode(Smeared_inten)=4,marker(Smeared_inten)=19,msize(Smeared_inten)=2 … … 1098 1143 AppendToGraph Sim_USANS_i vs Sim_USANS_q 1099 1144 ModifyGraph mode(Sim_USANS_i)=3,marker(Sim_USANS_i)=19,msize(Sim_USANS_i)=4 1100 ModifyGraph zColor(Sim_USANS_i)={setNumber,1,6,Rainbow,0} //force the colors from 1->6 1145 //don't reverse the dbZ21 or the highest angle will have "invisible" light blue error bars 1146 ModifyGraph zColor(Sim_USANS_i)={setNumber,1,7,dBZ21,0} //better for 7 colors 1147 // ModifyGraph zColor(Sim_USANS_i)={setNumber,1,7,Rainbow,0} //force the colors from 1->7 1101 1148 ModifyGraph useMrkStrokeRGB(Sim_USANS_i)=1 1102 1149 ErrorBars/T=0 Sim_USANS_i Y,wave=(Sim_USANS_s,Sim_USANS_s) … … 1104 1151 ModifyGraph log=1 1105 1152 ModifyGraph mirror(left)=1 1153 // if no top axis, then 1154 // ModifyGraph mirror(bottom)=1 1106 1155 ModifyGraph grid=2 1107 1156 ModifyGraph standoff=0 1108 1157 1109 1158 // to make sure that the scales are the same (but fails on zoom) 1110 // SetAxis bottom 2e-06,0.003 1111 // SetAxis top 2e-06/5.55e-5,0.003/5.55e-5 1159 NewFreeAxis/O/T top_angle 1160 ModifyFreeAxis/Z top_angle,master= bottom,hook= TransformAngleAxisHook 1161 ModifyGraph lblPos(top_angle)=50,freePos(top_angle)=0 1162 ModifyGraph log(top_angle)=1 1112 1163 1113 1164 SetDrawEnv linefgc= (39321,1,1),dash= 3,linethick= 3 1114 1165 SetDrawEnv xcoord= bottom 1115 1166 DrawLine 3e-05,0.01,3e-05,0.99 1116 1117 Label top "Angle"1167 1168 Label top_angle "Angle" 1118 1169 Label bottom "Q (1/A)" 1119 1170 Label left "Counts or Count Rate" … … 1125 1176 End 1126 1177 1178 Function TransformAngleAxisHook(s) 1179 STRUCT WMAxisHookStruct &s 1180 1181 s.max= s.max/5.55e-5 1182 s.min= s.min/5.55e-5 1183 1184 return 0 1185 End 1127 1186 1128 1187 //fakes a folder with loaded 1-d usans data, no calculation of the matrix … … 1283 1342 NVAR gIncr6 = gIncr6 1284 1343 1285 1344 NVAR gAngLow7 = gAngLow7 1345 NVAR gAngHigh7 = gAngHigh7 1346 NVAR gNumPts7 = gNumPts7 1347 NVAR gCtTime7 = gCtTime7 1348 NVAR gIncr7 = gIncr7 1286 1349 1287 1350 strswitch(popStr) // string switch … … 1324 1387 gIncr6 = 2 1325 1388 1389 gAngLow7 = 50 1390 gAngHigh7 = 95 1391 gNumPts7 = 10 1392 gCtTime7 = 0 1393 gIncr7 = 5 1394 1326 1395 break 1327 1396 case "Medium Count": … … 1362 1431 gCtTime6 = 1200 1363 1432 gIncr6 = 2 1364 1433 1434 gAngLow7 = 50 1435 gAngHigh7 = 95 1436 gNumPts7 = 10 1437 gCtTime7 = 0 1438 gIncr7 = 5 1439 1365 1440 break 1366 1441 case "Long Count": … … 1402 1477 gIncr6 = 2 1403 1478 1479 gAngLow7 = 50 1480 gAngHigh7 = 95 1481 gNumPts7 = 10 1482 gCtTime7 = 3000 1483 gIncr7 = 5 1484 1404 1485 break 1405 1486 default: … … 1453 1534 String baseName="SIMUL" 1454 1535 1455 num = 6//# of angular ranges1536 num = 7 //# of angular ranges 1456 1537 1457 1538 // only try to plot ranges with non-zero count times
Note: See TracChangeset
for help on using the changeset viewer.