 Timestamp:
 Jul 22, 2009 5:43:18 PM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf
r535 r541 1255 1255 1256 1256 1257 // as a standalone panel, extra control bar (right) and subwindow implementations don't work right1258 // for various reasons...1259 1257 Window Sim_1D_Panel() : Panel 1260 1258 PauseUpdate; Silent 1 // building window... 1261 1259 NewPanel /W=(92,556,713,818)/K=1 as "1D SANS Simulator" 1262 SetVariable MC_setvar0,pos={28,73},size={144,15},bodyWidth=80,title="# of neutrons"1263 SetVariable MC_setvar0,format="%5.4g"1264 SetVariable MC_setvar0,limits={0,inf,100},value= root:Packages:NIST:SAS:gImon1265 SetVariable MC_setvar0_1,pos={2 8,119},size={131,15},bodyWidth=60,title="Thickness (cm)"1260 SetVariable cntVar,pos={26,68},size={160,15},title="Counting time(s)",format="%d" 1261 SetVariable cntVar,limits={1,36000,10},value= root:Packages:NIST:SAS:gCntTime 1262 SetVariable cntVar, proc=Sim_1D_CountTimeSetVarProc 1263 SetVariable MC_setvar0_1,pos={26,91},size={160,15},title="Thickness (cm)" 1266 1264 SetVariable MC_setvar0_1,limits={0,inf,0.1},value= root:Packages:NIST:SAS:gThick 1267 SetVariable MC_setvar0_2,pos={28,96},size={149,15},bodyWidth=60,title="Incoherent XS (cm)" 1268 SetVariable MC_setvar0_2,limits={0,inf,0.1},value= root:Packages:NIST:SAS:gSig_incoh 1269 // SetVariable MC_setvar0_3,pos={28,142},size={150,15},bodyWidth=60,title="Sample Radius (cm)" 1270 // SetVariable MC_setvar0_3,limits={inf,inf,0.1},value= root:Packages:NIST:SAS:gR2 1271 SetVariable setvar0_3,pos={105,484},size={50,20},disable=1 1265 SetVariable MC_setvar0_1, proc=Sim_1D_SamThickSetVarProc 1266 1267 SetVariable MC_setvar0_3,pos={26,114},size={160,15},title="Sample Transmission" 1268 SetVariable MC_setvar0_3,limits={0,1,0.01},value= root:Packages:NIST:SAS:gSamTrans 1269 SetVariable MC_setvar0_3, proc=Sim_1D_SamTransSetVarProc 1270 1272 1271 PopupMenu MC_popup0,pos={13,13},size={165,20},proc=Sim_1D_ModelPopMenuProc,title="Model Function" 1273 1272 PopupMenu MC_popup0,mode=1,value= #"MC_FunctionPopupList()" 1274 // Button MC_button0,pos={17,181},size={130,20},proc=Sim_1D_DoItButtonProc,title="Do 1D Simulation" 1275 // Button MC_button0,fColor=(3,52428,1) 1276 // Button MC_button1,pos={17,208},size={80,20},proc=Sim_1D_Display2DButtonProc,title="Show 2D" 1277 GroupBox group0,pos={15,42},size={267,130},title="Sample Setup" 1278 SetVariable cntVar,pos={190,73},size={80,15},proc=Sim_1D_CountTimeSetVarProc,title="time(s)" 1279 SetVariable cntVar,format="%d" 1280 SetVariable cntVar,limits={1,600,1},value= root:Packages:NIST:SAS:gCntTime 1281 // Button MC_button2,pos={17,234},size={100,20},proc=SaveAsVAXButtonProc,title="Save 2D VAX" 1282 CheckBox check0,pos={216,180},size={68,14},title="Raw counts",variable = root:Packages:NIST:SAS:gRawCounts 1283 CheckBox check0_1,pos={216,199},size={60,14},title="Yes Offset",variable= root:Packages:NIST:SAS:gDoTraceOffset 1284 // CheckBox check0_2,pos={216,199+19},size={60,14},title="Beam Stop in",variable= root:Packages:NIST:SAS:gBeamStopIn 1285 // CheckBox check0_3,pos={216,199+2*19},size={60,14},title="use XOP",variable= root:Packages:NIST:SAS:gUse_MC_XOP 1286 1287 String fldrSav0= GetDataFolder(1) 1288 SetDataFolder root:Packages:NIST:SAS: 1289 Edit/W=(344,23,606,248)/HOST=# results_desc,results 1290 ModifyTable format(Point)=1,width(Point)=0,width(results_desc)=150 1291 SetDataFolder fldrSav0 1292 RenameWindow #,T_results 1293 SetActiveSubwindow ## 1294 1273 Button MC_button0,pos={17,181},size={130,20},proc=Sim_1D_DoItButtonProc,title="Do 1D Simulation" 1274 Button MC_button0,fColor=(3,52428,1) 1275 GroupBox group0,pos={15,42},size={280,130},title="Sample Setup" 1276 CheckBox check0_1,pos={216,179},size={60,14},title="Yes Offset",variable= root:Packages:NIST:SAS:gDoTraceOffset 1277 CheckBox check0_2,pos={216,199},size={60,14},title="Abs scale?",variable= root:Packages:NIST:SAS:g_1D_DoABS 1278 CheckBox check0_3,pos={216,219},size={60,14},title="Noise?",variable= root:Packages:NIST:SAS:g_1D_AddNoise 1279 1280 // a box for the results 1281 GroupBox group1,pos={314,23},size={277,163},title="Simulation Results" 1282 ValDisplay valdisp0,pos={326,48},size={220,13},title="Total detector counts" 1283 ValDisplay valdisp0,limits={0,0,0},barmisc={0,1000},value= root:Packages:NIST:SAS:g_1DTotCts 1284 ValDisplay valdisp0_1,pos={326,72},size={220,13},title="Estimated count rate (1/s)" 1285 ValDisplay valdisp0_1,limits={0,0,0},barmisc={0,1000},value=root:Packages:NIST:SAS:g_1DEstDetCR 1286 ValDisplay valdisp0_2,pos={326,96},size={220,13},title="Fraction of beam scattered" 1287 ValDisplay valdisp0_2,limits={0,0,0},barmisc={0,1000},value= root:Packages:NIST:SAS:g_1DFracScatt 1288 ValDisplay valdisp0_3,pos={326,121},size={220,13},title="Estimated transmission" 1289 ValDisplay valdisp0_3,limits={0,0,0},barmisc={0,1000},value=root:Packages:NIST:SAS:g_1DEstTrans 1295 1290 // set the flags here  do the simulation, but not 2D 1296 1291 … … 1310 1305 Variable dval = sva.dval 1311 1306 1312 // get the neutron flux, multiply, and reset the global for # neutrons 1313 NVAR imon=root:Packages:NIST:SAS:gImon 1314 imon = dval*beamIntensity() 1307 ReCalculateInten(1) 1308 1309 break 1310 endswitch 1311 1312 return 0 1313 End 1314 1315 Function Sim_1D_SamThickSetVarProc(sva) : SetVariableControl 1316 STRUCT WMSetVariableAction &sva 1317 1318 switch( sva.eventCode ) 1319 case 1: // mouse up 1320 case 2: // Enter key 1321 case 3: // Live update 1322 Variable dval = sva.dval 1323 1324 ReCalculateInten(1) 1325 1326 break 1327 endswitch 1328 1329 return 0 1330 End 1331 1332 Function Sim_1D_SamTransSetVarProc(sva) : SetVariableControl 1333 STRUCT WMSetVariableAction &sva 1334 1335 switch( sva.eventCode ) 1336 case 1: // mouse up 1337 case 2: // Enter key 1338 case 3: // Live update 1339 Variable dval = sva.dval 1340 1341 ReCalculateInten(1) 1315 1342 1316 1343 break … … 1338 1365 1339 1366 1340 1341 //Function Sim_1D_DoItButtonProc(ba) : ButtonControl 1342 // STRUCT WMButtonAction &ba 1343 // 1344 // switch( ba.eventCode ) 1345 // case 2: // mouse up 1346 // // click code here 1347 // NVAR doMC = root:Packages:NIST:SAS:gDoMonteCarlo 1348 // doMC = 1 1349 // ReCalculateInten(1) 1350 // doMC = 0 //so the next time won't be MC 1351 // break 1352 // endswitch 1353 // 1354 // return 0 1355 //End 1356 // 1357 // 1358 //Function Sim_1D_Display2DButtonProc(ba) : ButtonControl 1359 // STRUCT WMButtonAction &ba 1360 // 1361 // switch( ba.eventCode ) 1362 // case 2: // mouse up 1363 // // click code here 1364 // Execute "ChangeDisplay(\"SAS\")" 1365 // break 1366 // endswitch 1367 // 1368 // return 0 1369 //End 1367 Function Sim_1D_DoItButtonProc(ba) : ButtonControl 1368 STRUCT WMButtonAction &ba 1369 1370 switch( ba.eventCode ) 1371 case 2: // mouse up 1372 1373 ReCalculateInten(1) 1374 1375 break 1376 endswitch 1377 1378 return 0 1379 End
Note: See TracChangeset
for help on using the changeset viewer.