Changeset 942 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Timestamp:
- Jun 20, 2014 11:44:52 AM (9 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/EventModeProcessing.ipf
r941 r942 203 203 Proc EventModePanel() 204 204 PauseUpdate; Silent 1 // building window... 205 NewPanel /W=(82,44,8 54,664)/N=EventModePanel/K=2205 NewPanel /W=(82,44,884,664)/N=EventModePanel/K=2 206 206 DoWindow/C EventModePanel 207 207 ModifyPanel fixedSize=1,noEdit =1 … … 209 209 SetDrawLayer UserBack 210 210 DrawText 479,345,"Stream Data" 211 DrawLine 563,338,7 31,338212 DrawText 479,419,"Oscillatory Data"213 DrawLine 578,411,731,411211 DrawLine 563,338,775,338 212 DrawText 479,419,"Oscillatory or Stream Data" 213 DrawLine 647,411,775,411 214 214 215 215 // ShowTools/A 216 216 Button button0,pos={14,87},size={150,20},proc=LoadEventLog_Button,title="Load Event Log File" 217 217 Button button0,fSize=12 218 TitleBox tb1,pos={475,500},size={ 135,24},fSize=10218 TitleBox tb1,pos={475,500},size={266,86},fSize=10 219 219 TitleBox tb1,variable= root:Packages:NIST:Event:gEventDisplayString 220 220 221 CheckBox chkbox2,pos={376,151},size={81,1 4},proc=LogIntEvent_Proc,title="Log Intensity"221 CheckBox chkbox2,pos={376,151},size={81,15},proc=LogIntEvent_Proc,title="Log Intensity" 222 222 CheckBox chkbox2,fSize=10,variable= root:Packages:NIST:Event:gEvent_logint 223 CheckBox chkbox3,pos={14,125},size={119,1 4},title="Remove Bad Events?",fSize=10223 CheckBox chkbox3,pos={14,125},size={119,15},title="Remove Bad Events?",fSize=10 224 224 CheckBox chkbox3,variable= root:Packages:NIST:Event:gRemoveBadEvents 225 225 226 Button doneButton,pos={7 08,36},size={50,20},proc=EventDone_Proc,title="Done"226 Button doneButton,pos={738,36},size={50,20},proc=EventDone_Proc,title="Done" 227 227 Button doneButton,fSize=12 228 Button button2,pos={419,28},size={140,20},proc=ShowEventDataButtonProc,title="Show Event Data" 229 Button button3,pos={419,56},size={140,20},proc=ShowBinDetailsButtonProc,title="Show Bin Details" 230 Button button5,pos={419,85},size={140,20},proc=ExportSlicesButtonProc,title="Export Slices as VAX" 231 Button button6,pos={718,9},size={40,20},proc=EventModeHelpButtonProc,title="?" 232 233 234 Button button7,pos={487,197},size={120,20},proc=AdjustEventDataButtonProc,title="Adjust Events" 235 Button button8,pos={619,197},size={120,20},proc=CustomBinButtonProc,title="Custom Bins" 236 Button button4,pos={487,227},size={120,20},proc=UndoTimeSortButtonProc,title="Undo Time Sort" 237 Button button18,pos={619,227},size={120,20},proc=EC_ImportWavesButtonProc,title="Import Edited" 238 228 Button button2,pos={486,200},size={140,20},proc=ShowEventDataButtonProc,title="Show Event Data" 229 Button button3,pos={486,228},size={140,20},proc=ShowBinDetailsButtonProc,title="Show Bin Details" 230 Button button5,pos={633,228},size={140,20},proc=ExportSlicesButtonProc,title="Export Slices as VAX" 231 Button button6,pos={748,9},size={40,20},proc=EventModeHelpButtonProc,title="?" 232 233 Button button7,pos={211,33},size={120,20},proc=AdjustEventDataButtonProc,title="Adjust Events" 234 Button button8,pos={653,201},size={120,20},proc=CustomBinButtonProc,title="Custom Bins" 235 Button button4,pos={211,63},size={120,20},proc=UndoTimeSortButtonProc,title="Undo Time Sort" 236 Button button18,pos={211,90},size={120,20},proc=EC_ImportWavesButtonProc,title="Import Edited" 239 237 240 238 SetVariable setvar0,pos={208,149},size={160,16},proc=sliceSelectEvent_Proc,title="Display Time Slice" 241 239 SetVariable setvar0,fSize=10 242 240 SetVariable setvar0,limits={0,1000,1},value= root:Packages:NIST:Event:gEvent_tsdisp 243 SetVariable setvar1,pos={ 206,26},size={160,16},title="Number of slices",fSize=10241 SetVariable setvar1,pos={389,29},size={160,16},title="Number of slices",fSize=10 244 242 SetVariable setvar1,limits={1,1000,1},value= root:Packages:NIST:Event:gEvent_nslices 245 SetVariable setvar2,pos={ 206,51},size={160,16},title="Max Time (s)",fSize=10243 SetVariable setvar2,pos={389,54},size={160,16},title="Max Time (s)",fSize=10 246 244 SetVariable setvar2,value= root:Packages:NIST:Event:gEvent_t_longest 247 245 248 PopupMenu popup0,pos={ 206,74},size={119,20},proc=BinTypePopMenuProc,title="Bin Spacing"246 PopupMenu popup0,pos={389,77},size={119,20},proc=BinTypePopMenuProc,title="Bin Spacing" 249 247 PopupMenu popup0,fSize=10 250 248 PopupMenu popup0,mode=1,popvalue="Equal",value= #"\"Equal;Fibonacci;Custom;\"" 251 Button button1,pos={ 206,100},size={120,20},fSize=12,proc=ProcessEventLog_Button,title="Bin Event Data"249 Button button1,pos={389,103},size={120,20},fSize=12,proc=ProcessEventLog_Button,title="Bin Event Data" 252 250 253 251 Button button10,pos={488,305},size={100,20},proc=SplitFileButtonProc,title="Split Big File" 254 252 Button button14,pos={488,350},size={120,20},proc=Stream_LoadDecim,title="Load Split List" 255 Button button19,pos={6 19,350},size={120,20},proc=Stream_LoadAdjustedList,title="Load Edited List"256 Button button20,pos={6 50,376},size={90,20},proc=ShowList_ToLoad,title="Show List"253 Button button19,pos={649,350},size={120,20},proc=Stream_LoadAdjustedList,title="Load Edited List" 254 Button button20,pos={680,376},size={90,20},proc=ShowList_ToLoad,title="Show List" 257 255 SetVariable setvar3,pos={487,378},size={150,16},title="Decimation factor" 258 256 SetVariable setvar3,fSize=10 … … 262 260 Button button16_1,pos={488,450},size={110,20},proc=AccumulateSlicesButton,title="Add Next Slice" 263 261 Button button17_2,pos={620,425},size={110,20},proc=AccumulateSlicesButton,title="Display Total" 264 265 262 266 263 CheckBox chkbox1_0,pos={25,34},size={69,14},title="Oscillatory",fSize=10 … … 273 270 CheckBox chkbox1_3,proc=EventModeRadioProc,value=0,mode=1 274 271 275 GroupBox group0_0,pos={5,5},size={174,112},title=" Mode",fSize=12,fStyle=1276 GroupBox group0_1,pos={ 192,5},size={192,123},title="Binning",fSize=12,fStyle=1277 GroupBox group0_2,pos={4 03,5},size={173,109},title="Viewing",fSize=12,fStyle=1278 GroupBox group0_3,pos={ 476,169},size={277,92},title="Editing",fSize=12,fStyle=1279 GroupBox group0_4,pos={474,278},size={ 279,200},title="BigFiles",fSize=12272 GroupBox group0_0,pos={5,5},size={174,112},title="(1) Loading Mode",fSize=12,fStyle=1 273 GroupBox group0_1,pos={372,5},size={192,127},title="(3) Bin Events",fSize=12,fStyle=1 274 GroupBox group0_2,pos={477,169},size={310,92},title="(4) View / Export",fSize=12,fStyle=1 275 GroupBox group0_3,pos={191,5},size={165,117},title="(2) Edit Events",fSize=12,fStyle=1 276 GroupBox group0_4,pos={474,278},size={312,200},title="Split / Accumulate Files",fSize=12 280 277 GroupBox group0_4,fStyle=1 281 278 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MC_SimulationScripting.ipf
r940 r942 12 12 // Example_1DSim() 13 13 // Example_2DSim() 14 // Example_Loop_1DSim() 15 // Example_Loop_2DSim() 14 16 // 15 17 // and also the instructions below in the "basic cycle" … … 126 128 127 129 /// un-comment this by removing the "x" from the word xMenu. Then compile. 128 xMenu "Macros" 129 Submenu "Simulation Scripting - Beta" 130 "Save Configuration",Sim_saveConfProc() 131 "Move to Configuration",Sim_moveConfProc() 132 "List Configurations",ListSASCALCConfigs() 133 "1D Count Rates",DryRunProc_1D() 134 "2D Dry Run",DryRunProc_2D() 135 "Optimal Count Times",OptimalCountProc() 136 "Make Table to Combine By Name",MakeCombineTable_byName() 137 "Combine by Name",DoCombineFiles_byName(lowQfile,medQfile,hiQfile,saveName) 138 "Turn Off Dead Time Correction",Sim_SetDeadTimeTiny() 139 "-" 140 "Setup Sim Example",Setup_Sim_Example() 141 "Run 1D Sim Example",Example_1DSim() 142 "Run 2D Sim Example",Example_2DSim() 143 End 144 End 145 130 Menu "Macros" 131 Submenu "Simulation Scripting - Beta" 132 ScriptItem(0),Sim_saveConfProc() 133 ScriptItem(1),Sim_moveConfProc() 134 ScriptItem(2),ListSASCALCConfigs() 135 ScriptItem(3),DryRunProc_1D() 136 ScriptItem(4),DryRunProc_2D() 137 ScriptItem(5),OptimalCountProc() 138 ScriptItem(6),MakeCombineTable_byName() 139 ScriptItem(7),DoCombineFiles_byName(lowQfile,medQfile,hiQfile,saveName) 140 ScriptItem(8),Sim_SetDeadTimeTiny() 141 ScriptItem(9) 142 ScriptItem(10),Setup_Sim_Example() 143 ScriptItem(11),Example_1DSim() 144 ScriptItem(12),Example_2DSim() 145 ScriptItem(13) 146 ScriptItem(14),DisplayProcedure "Example_1DSim" 147 End 148 End 149 150 Function/S ScriptItem(num) 151 Variable num 152 153 String str="" 154 155 if(exists("root:SANS_RED_VERSION") && exists("root:Packages:NIST:SANS_ANA_VERSION")) 156 switch(num) 157 case 0: 158 str = "Save Configuration" 159 break 160 case 1: 161 str = "Move to Configuration" 162 break 163 case 2: 164 str = "List Configurations" 165 break 166 case 3: 167 str = "1D Count Rates" 168 break 169 case 4: 170 str = "2D Dry Run" 171 break 172 case 5: 173 str = "Optimal Count Times" 174 break 175 case 6: 176 str = "Make Table to Combine By Name" 177 break 178 case 7: 179 str = "Combine by Name" 180 break 181 case 8: 182 str = "Turn Off Dead Time Correction" 183 break 184 case 9: 185 str = "-" 186 break 187 case 10: 188 str = "Setup Sim Example" 189 break 190 case 11: 191 str = "Run 1D Sim Example" 192 break 193 case 12: 194 str = "Run 2D Sim Example" 195 break 196 case 13: 197 str = "-" 198 break 199 case 14: 200 str = "Display Example Code" 201 break 202 endswitch 203 endif 204 205 return(str) 206 end 146 207 147 208 ////////// --- START OF EXAMPLE SCRIPTS --- //////////////// 148 209 149 210 // 150 // run this before the examplesto make sure that the proper named configurations and function exist.211 // run this before either the 1D or 2D example to make sure that the proper named configurations and function exist. 151 212 // this function will overwrite any same-named configurations 152 213 // … … 162 223 // include the model and plot it, so that it will exist. Post to queue so they execute in order 163 224 Execute/P "INSERTINCLUDE \"SchulzSpheres_Sq_v40\"" 225 Execute/P "INSERTINCLUDE \"DAB_Model_v40\"" 164 226 Execute/P "COMPILEPROCEDURES " 165 227 Execute/P "PlotSchulzSpheres_SC(256,0.001,0.7)" 228 Execute/P "PlotDAB_Model(256,0.001,0.7)" 166 229 167 230 Execute/P "SASCALC()" … … 333 396 return(0) 334 397 End 398 399 400 // 401 // 402 // This example will run the same sample with three different thicknesses, at 403 // 1m, 4m, 13m 404 // 405 // empty beam measurements at all three distances, sample transmission at 13m 406 // 407 // total simulation time is < 600 seconds on my old machine... 408 // do a dry run first to see how long it'll take. 409 // 410 // 411 Function Example_Loop_2DSim() 412 413 String confList,ctTimeList,titleStr,transConfList,transCtTimeList 414 Variable runIndex,val,totalTime 415 String funcStr 416 417 tic() 418 419 Sim_SetSimulationType(0) //kill the simulation panel 420 Sim_SetSimulationType(2) //open the 2D simulation panel 421 Sim_SetSimTimeWarning(36000) //sets the threshold for the warning dialog to 10 hours 422 totalTime = 0 423 424 425 //(1) determine the (unsmeared) function name (we'll set this right before the simulation) 426 funcStr = "DAB_model" 427 Wave cw = $("root:"+getFunctionCoef(funcStr)) 428 429 //(2) set the standard sample cell size (1" diam banjo cell) 430 // and set the conditions for beam stop in, and raw counts 431 Sim_SetSampleRadius(1.27) // sam radius (cm) 432 Sim_SetRawCountsCheck(1) // raw cts? 1== yes 433 Sim_SetBeamStopInOut(1) // BS in? 1==yes 434 435 //(3) model coefficients here, if needed. Wave name is "cw" 436 // then set the sample thickness and incoherent cross section 437 438 cw = {1e-05,200,0.1} 439 440 // as needed - look at the parameter list for the model 441 442 Sim_SetThickness(0.2) // thickness (cm) 443 Sim_SetIncohXS(1.3) // incoh XS 444 445 //(4) starting run index for the saved raw data files. this will automatically increment 446 // as the sample is "Run" 447 runIndex = 500 448 449 450 //(5) run the transmissions and empty beam first, before you forget them 451 452 // run the empty beam at all configurations 453 // This will automatically change the function to "EC_Empirical" and "empty beam" conditions 454 transConfList = "Config_1m;Config_4m;Config_13m;" 455 transCtTimeList = "1;1;1;" 456 titleStr = "Empty Beam" 457 totalTime += Sim_RunEmptyBeamTrans_2D(transConfList,transCtTimeList,titleStr,runIndex) 458 459 460 //(6) set the configuration list, times, a single sample label, and the starting run index 461 // -- the mumber of listed configurations must match the number of discrete count times 462 confList = "" // these will be filled in the loop 463 ctTimeList = "" 464 transConfList = "Config_13m" // trans only @ 13m 465 transCtTimeList = "1;" // trans count time = 1s 466 titleStr = "MySample 1" 467 468 // runIndex is PBR and updates as the number of files are written 469 470 Variable ii,jj 471 472 // any, all, or more settings can be set up to change in the loop 473 // -- be sure these waves are the same length and the values correspond. 474 Make/O/D thick = {0.1,0.2,0.5,0.1,0.2,0.5,0.1,0.2,0.5} 475 Make/O/D ctTime = {100,100,100,300,300,300,900,900,900} 476 Make/O/D/T conf = {"Config_1m","Config_1m","Config_1m","Config_4m","Config_4m","Config_4m","Config_13m","Config_13m","Config_13m"} 477 478 479 Sim_SetModelFunction(funcStr) // model function name 480 481 for(ii=0;ii<numpnts(thick);ii+=1) 482 Sim_SetThickness(thick[ii]) // thickness (cm) 483 484 confList = conf[ii] +";" 485 titleStr = "DAB simulation, thick = "+num2str(thick[ii]) 486 ctTimeList = num2str(ctTime[ii])+";" 487 488 // this runs the transmissions (only at 13m) 489 if(cmpstr(conf[ii],"Config_13m")==0) 490 totalTime += Sim_RunTrans_2D(transConfList,transCtTimeList,titleStr,runIndex) 491 endif 492 493 // this runs the sample 494 totalTime += Sim_RunSample_2D(confList,ctTimeList,titleStr,runIndex) 495 496 endfor 497 498 Print "runIndex = ",runIndex 499 500 Sim_SetSimTimeWarning(10) 501 502 toc() 503 504 return(totalTime) 505 End 506 507 508 335 509 336 510 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SANS_Utilities.ipf
r886 r942 255 255 End 256 256 257 Function setMREDFileList(str) 258 String str 259 260 SVAR/Z list = root:myGlobals:MRED:gFileNumList 261 if(SVAR_Exists(list)==0) //check for myself 262 DoAlert 0,"The Multiple Reduce Panel must be open for you to use this function" 263 Return(1) 264 endif 265 266 list = str 267 268 //force an update If the SVAR exists, then the panel does too - MRED cleans up after itself when done 269 DoWindow/F Multiple_Reduce_Panel //bring to front 270 MRedPopMenuProc("MRFilesPopup",0,"") //parse the list, pop the menu 271 272 return(0) 273 End 257 258 259 // for testing, not used anymore 260 //Proc FillMREDList() 261 // setMREDFileList(rStr) 262 // DoUpdate 263 //End 264 265 //Function setMREDFileList(str) 266 // String str 267 // 268 // SVAR/Z list = root:myGlobals:MRED:gFileNumList 269 // if(SVAR_Exists(list)==0) //check for myself 270 // DoAlert 0,"The Multiple Reduce Panel must be open for you to use this function" 271 // Return(1) 272 // endif 273 // 274 // list = str 275 // 276 // //force an update If the SVAR exists, then the panel does too - MRED cleans up after itself when done 277 // DoWindow/F Multiple_Reduce_Panel //bring to front 278 // MRedPopMenuProc("MRFilesPopup",0,"") //parse the list, pop the menu 279 // 280 // return(0) 281 //End 274 282 275 283 Proc FillEMPUsingSelection() … … 328 336 End 329 337 330 Proc FillMREDList()331 setMREDFileList(rStr)332 DoUpdate333 End334 338 335 339
Note: See TracChangeset
for help on using the changeset viewer.