- Timestamp:
- Feb 3, 2016 4:14:30 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Test_RAW_Panel.ipf
r976 r977 1 1 #pragma rtGlobals=3 // Use modern global access method and strict wave access. 2 3 2 #pragma version=1.0 3 #pragma IgorVersion=6.1 4 5 // 4 6 // this will become the equivalent of "RawWindowHook" 5 6 7 // 8 // Procedures to display the detector data along with whatever visualization tools 9 // necessary to understand the data 10 // 11 12 13 // TODO 14 // 15 // -- have the status automatically fill in when a new file is loaded, rather than needing a click of the "status" button 16 // -- need a place somewhere to show the currently displayed folder 17 // -- checkboxes for "active" corrections? 18 // -- display of Q, counts, QxQy, X and Y 19 // -- do I need a color bar? or is this not used at all? I like it to be there, or the colors are a waste of information 20 // (then... where do I put the color bar?) 21 // -- define the "hook" function, and attach it to the panel (or the main detector subwindow?) 22 // 23 24 25 // 26 // call this after loading data to either draw the data display panel or to update the contents 27 // 28 // TODO 29 // -- make sure that the "type" input is correctly used for the updating of the data, values, etc. 30 // -- add a procedure to define the global variables for pos, counts, QxQy, etc. 31 // 7 32 Proc UpdateDisplayInformation(type) 8 33 String type … … 10 35 DoWindow VSANS_Data 11 36 if(V_flag==0) 37 38 VSANSDataPanelGlobals() 39 12 40 VSANS_DataPanel() //draws the panel 41 // fake a click on all three tabs - to populate the data 42 FakeTabClick(2) 43 FakeTabClick(1) 44 FakeTabClick(0) 13 45 endif 14 46 15 // update the information here - in either case 47 // TODO: update the information here - in either case 48 // what isn't automatically picked up? What is "stale" on the display? 16 49 17 50 end 18 51 19 20 Window VSANS_DataPanel() :Panel 52 // 53 // creates/initializes the globals for display of the data panel 54 // 55 Function VSANSDataPanelGlobals() 56 57 SetDataFolder root:Packages:NIST:VSANS:Globals 58 59 Variable/G gXPos=0 60 Variable/G gYPos=0 61 Variable/G gQX=0 62 Variable/G gQY=0 63 Variable/G gQQ=0 64 Variable/G gNCounts=0 65 String/G gCurDispFile = "default string" 66 String/G gCurTitle = "" 67 68 SetDataFolder root: 69 End 70 71 // TODO 72 // 73 // -- fill in the proper window title in the DoWindow/T command 74 // -- add help text for all of the controls 75 // 76 Window VSANS_DataPanel() : Panel 21 77 PauseUpdate; Silent 1 // building window... 22 NewPanel /W=(37,45,10 42,784) /N=VSANS_Data78 NewPanel /W=(37,45,1038,719) /N=VSANS_Data 23 79 ShowTools/A 80 81 DoWindow/T VSANS_Data,"VSANS_Data"//+cur_folder 82 SetWindow VSANS_Data,hook(dataHook)=VSANSDataHook,hookevents=2 24 83 25 84 SetDrawLayer UserBack 26 85 SetDrawEnv linethick= 2,dash= 1,fillpat= 0 27 DrawRect 200, 140,310,23086 DrawRect 200,70,310,160 28 87 SetDrawEnv linethick= 2,dash= 1,fillpat= 0 29 DrawRect 320, 140,430,23088 DrawRect 320,70,430,160 30 89 SetDrawEnv linethick= 2,dash= 1,fillpat= 0 31 DrawRect 440, 140,550,23090 DrawRect 440,70,550,160 32 91 33 92 SetDrawEnv fsize= 18 34 DrawText 230,1 85,"Front"93 DrawText 230,115,"Front" 35 94 SetDrawEnv fsize= 18 36 DrawText 348,1 85,"Middle"95 DrawText 348,115,"Middle" 37 96 SetDrawEnv fsize= 18 38 DrawText 476,1 85,"Back"97 DrawText 476,115,"Back" 39 98 40 99 ToolsGrid visible=1 41 100 42 TabControl tab0,pos={13,111},size={572,617},proc=VDataTabProc,tabLabel(0)="Front" 101 102 TabControl tab0,pos={13,41},size={572,617},proc=VDataTabProc,tabLabel(0)="Front" 43 103 TabControl tab0,tabLabel(1)="Middle",tabLabel(2)="Back",value= 2 44 Button button0,pos={619,135},size={140,20} 45 Button button0_1,pos={769,135},size={140,20} 46 Button button0_2,pos={623,189},size={140,20} 47 Button button0_3,pos={773,189},size={140,20} 48 Button button0_4,pos={622,247},size={140,20} 49 Button button0_5,pos={772,247},size={140,20} 50 104 105 // on the side 106 Button button_status,pos={607,146},size={70,20},proc=StatusButtonProc,title="Status" 107 Button button_IvsQ,pos={689,113},size={70,20},proc=IvsQPanelButtonProc,title="I vs. Q" 108 Button button_file_m,pos={619,55},size={50,20},proc=File_m_ButtonProc,title="File <" 109 Button button_file_p,pos={679,55},size={50,20},proc=File_p_ButtonProc,title="File >" 110 Button button_log,pos={689,146},size={70,20},proc=LogLinButtonProc,title="isLin",userData="0" 111 Button button_tab_p,pos={648,81},size={50,20},proc=Tab_p_ButtonProc,title="Tab >" 112 Button button_isolate,pos={606,114},size={70,20},proc=IsolateButtonProc,title="Isolate" 113 114 TitleBox title_file,pos={606,178},size={76,20},variable= file_name 115 TitleBox title_status,pos={606,210},size={76,20},variable= file_name 116 117 Button button_tagFile,pos={603,412},size={70,20},proc=TagFileButtonProc,title="Tag File" 118 Button button_BeamCtr,pos={603,450},size={70,20},proc=BeamCtrButtonProc,title="Beam Ctr" 119 120 // on the tabs, always visible 121 TitleBox title_xy,pos={24,71},size={76,20},variable= file_name 122 Slider slider_hi,pos={558,224},size={16,80},proc=HiMapSliderProc 123 Slider slider_hi,limits={0,2,0},value= 2,ticks= 0 124 Slider slider_lo,pos={558,315},size={16,80},proc=LowMapSliderProc 125 Slider slider_lo,limits={0,2,0},value= 0,ticks= 0 126 127 SetVariable xpos,pos={22,97},size={50,17},title="X " 128 SetVariable xpos,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:gXPos 129 SetVariable xpos,help={"x-position on the detector"},frame=0,noedit=1 130 SetVariable ypos,pos={22,121},size={50,17},title="Y " 131 SetVariable ypos,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:gYPos 132 SetVariable ypos,help={"y-position on the detector"},frame=0,noedit=1 133 SetVariable counts,pos={22,151},size={150,17},title="Counts " 134 SetVariable counts,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:gNCounts 135 SetVariable counts,help={"Neutron counts"},frame=0,noedit=1 136 SetVariable qxval,pos={83,94},size={85,17},title="qX" 137 SetVariable qxval,help={"q value in the x-direction on the detector"},frame=0,noedit=1 138 SetVariable qxval,format="%+7.5f",limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:gQX 139 SetVariable qyval,pos={83,113},size={85,17},title="qY" 140 SetVariable qyval,help={"q value in the y-direction on the detector"},frame=0,noedit=1 141 SetVariable qyval,format="%+7.5f",limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:gQY 142 SetVariable q_pos,pos={83,132},size={85,17},title="q " 143 SetVariable q_pos,help={"q-value on the detector at (x,y)"},format="%+7.5f" 144 SetVariable q_pos,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:gQQ,frame=0,noedit=1 145 146 Make/O/D tmp_asdf 51 147 // for back panels (in pixels?) 52 Display/W=(50, 239,546,710)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX148 Display/W=(50,185,545,620)/HOST=# tmp_asdf 53 149 RenameWindow #,det_panelsB 54 150 ModifyGraph mode=2 // mode = 2 = dots … … 61 157 62 158 // for middle panels (in pixels?) 63 Display/W=(50, 239,546,710)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX159 Display/W=(50,185,545,620)/HOST=# tmp_asdf 64 160 RenameWindow #,det_panelsM 65 161 ModifyGraph mode=2 // mode = 2 = dots … … 72 168 73 169 // for front panels (in pixels?) 74 Display/W=(50, 239,546,710)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX170 Display/W=(50,185,545,620)/HOST=# tmp_asdf 75 171 RenameWindow #,det_panelsF 76 172 ModifyGraph mode=2 // mode = 2 = dots … … 84 180 EndMacro 85 181 182 // 183 // event code 4 = mouse moved 184 // 185 // TODO 186 // -- figure out how to respond only to events in the main window 187 // -- figure out which is the correct image to respond "from" 188 // 189 Function VSANSDataHook(s) 190 STRUCT WMWinHookStruct &s 191 192 Variable hookResult = 0 193 194 switch(s.eventCode) 195 case 0: // Activate 196 // Handle activate 197 // Print "Activate" 198 break 199 200 case 1: // Deactivate 201 // Handle deactivate 202 break 203 204 case 3: //mouse down 205 // Print "mouse down" 206 break 207 208 case 4: // mouse moved 209 NVAR xloc = root:Packages:NIST:VSANS:Globals:gXPos 210 NVAR yloc = root:Packages:NIST:VSANS:Globals:gYPos 211 Variable xaxval,yaxval 212 213 // is the mouse location within the "main" display window? 214 // if so, do something, if not, do nothing? 215 // right now, the "main" display is at (50,185,545,620). its name depends on the active tab 216 217 // if out of bounds, exit now 218 // TODO - currently the values are hard-wired. eliminate this 219 if(s.mouseLoc.h < 50 || s.mouseLoc.h > 545 || s.mouseLoc.v < 185 || s.mouseLoc.v > 620) 220 break 221 endif 222 223 // if(in bounds) 224 // get the point location 225 // update the globals 226 // if detectors are drawn to scale on the graph, then qxqy can be calculated 227 // but which data instance am I pointing to? 228 // endif 229 230 GetWindow $s.winName activeSW 231 String activeSubwindow = S_value 232 if (CmpStr(activeSubwindow,"VSANS_Data#det_panelsF") == 0) 233 // front active, do something 234 // xloc = s.mouseLoc.h 235 // yloc = s.mouseLoc.v 236 237 xaxval= AxisValFromPixel("","bottom",s.mouseLoc.h) 238 yaxval= AxisValFromPixel("","left",s.mouseLoc.v) 239 xloc = round(xaxval) 240 yloc = round(yaxval) 241 endif 242 243 break 244 // And so on . . . 245 endswitch 246 247 return hookResult // 0 if nothing done, else 1 248 End 86 249 87 250 // … … 94 257 // 95 258 // TODO 96 // -- add all of the controls of the VCALC panel (log scaling, adjusting the axes, etc.) 97 // -- get the panel to be correctly populated first, rather than needing to click everywhere to fill in 259 // -- add all of the controls of the VCALC panel (log scaling, adjusting the axes, etc.) 260 // x- get the panel to be correctly populated first, rather than needing to click everywhere to fill in 261 // x- remove the dependency on VCALC being initialized first, and using dummy waves from there... 262 // 98 263 Function VDataTabProc(tca) : TabControl 99 264 STRUCT WMTabControlAction &tca … … 103 268 Variable tab = tca.tab 104 269 105 SetDataFolder root:Packages:NIST:VSANS:VCALC 106 RemoveFromGraph/Z /W=VSANS_Data#det_panelsB fv_degY 107 RemoveFromGraph/Z /W=VSANS_Data#det_panelsM fv_degY 108 RemoveFromGraph/Z /W=VSANS_Data#det_panelsF fv_degY 270 // SetDataFolder root:Packages:NIST:VSANS:VCALC 271 SetDataFolder root: 272 RemoveFromGraph/Z /W=VSANS_Data#det_panelsB tmp_asdf 273 RemoveFromGraph/Z /W=VSANS_Data#det_panelsM tmp_asdf 274 RemoveFromGraph/Z /W=VSANS_Data#det_panelsF tmp_asdf 109 275 SetDataFolder root: 110 276 … … 120 286 ModifyImage/W=VSANS_Data#det_panelsB ''#0 ctab= {*,*,ColdWarm,0} 121 287 endif 122 MoveSubWindow/W=VSANS_Data#det_panelsB fnum=(50,239,546,710) 123 MoveSubWindow/W=VSANS_Data#det_panelsM fnum=(320,140,430,230) 124 MoveSubWindow/W=VSANS_Data#det_panelsF fnum=(200,140,310,230) 288 MoveSubWindow/W=VSANS_Data#det_panelsB fnum=(50,185,545,620) 289 MoveSubWindow/W=VSANS_Data#det_panelsM fnum=(320,70,430,160) 290 MoveSubWindow/W=VSANS_Data#det_panelsF fnum=(200,70,310,160) 291 292 SetActiveSubWindow VSANS_Data#det_panelsB 125 293 SetDataFolder root: 126 294 endif 127 295 128 296 if(tab==1) 129 297 //SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle … … 152 320 ModifyImage/W=VSANS_Data#det_panelsM ''#3 ctab= {*,*,ColdWarm,0} 153 321 endif 154 MoveSubWindow/W=VSANS_Data#det_panelsM fnum=(50,239,546,710) 155 MoveSubWindow/W=VSANS_Data#det_panelsB fnum=(440,140,550,230) 156 MoveSubWindow/W=VSANS_Data#det_panelsF fnum=(200,140,310,230) 322 MoveSubWindow/W=VSANS_Data#det_panelsM fnum=(50,185,545,620) 323 MoveSubWindow/W=VSANS_Data#det_panelsB fnum=(440,70,550,160) 324 MoveSubWindow/W=VSANS_Data#det_panelsF fnum=(200,70,310,160) 325 326 SetActiveSubWindow VSANS_Data#det_panelsM 157 327 SetDataFolder root: 158 328 endif … … 184 354 ModifyImage/W=VSANS_Data#det_panelsF ''#3 ctab= {*,*,ColdWarm,0} 185 355 endif 186 MoveSubWindow/W=VSANS_Data#det_panelsF fnum=(50,239,546,710) 187 MoveSubWindow/W=VSANS_Data#det_panelsB fnum=(440,140,550,230) 188 MoveSubWindow/W=VSANS_Data#det_panelsM fnum=(320,140,430,230) 356 MoveSubWindow/W=VSANS_Data#det_panelsF fnum=(50,185,545,620) 357 MoveSubWindow/W=VSANS_Data#det_panelsB fnum=(440,70,550,160) 358 MoveSubWindow/W=VSANS_Data#det_panelsM fnum=(320,70,430,160) 359 360 SetActiveSubWindow VSANS_Data#det_panelsF 189 361 SetDataFolder root: 190 362 endif … … 198 370 return 0 199 371 End 372 373 374 // fake click on each tab to populate the data 375 Function FakeTabClick(tab) 376 Variable tab 377 378 STRUCT WMTabControlAction tca 379 380 tca.eventCode = 2 //fake mouse up 381 tca.tab = tab 382 VDataTabProc(tca) 383 384 TabControl tab0,win=VSANS_Data,value= tab //select the proper tab 385 return(0) 386 End 387 388 // TODO 389 // 390 // move one file number back 391 // 392 Function File_m_ButtonProc(ba) : ButtonControl 393 STRUCT WMButtonAction &ba 394 395 switch( ba.eventCode ) 396 case 2: // mouse up 397 // click code here 398 break 399 case -1: // control being killed 400 break 401 endswitch 402 403 return 0 404 End 405 406 // TODO 407 // 408 // move one file number forward 409 // 410 Function File_p_ButtonProc(ba) : ButtonControl 411 STRUCT WMButtonAction &ba 412 413 switch( ba.eventCode ) 414 case 2: // mouse up 415 // click code here 416 break 417 case -1: // control being killed 418 break 419 endswitch 420 421 return 0 422 End 423 424 // 425 // button that mimics a click on the tab, cycling through the tabs 0->1->2->0 etc. 426 // only goes one direction 427 // 428 Function Tab_p_ButtonProc(ba) : ButtonControl 429 STRUCT WMButtonAction &ba 430 431 switch( ba.eventCode ) 432 case 2: // mouse up 433 // click code here 434 ControlInfo/W=VSANS_Data tab0 435 436 V_Value += 1 437 if(V_Value == 3) 438 V_Value = 0 //reset to 0 439 endif 440 FakeTabClick(V_Value) 441 break 442 case -1: // control being killed 443 break 444 endswitch 445 446 return 0 447 End 448 449 // TODO 450 // 451 // isolates a single panel to allow a better view of the details 452 // useful for T/B panels which are partially blocked from view 453 // 454 // will open a separate graph or panel to display the selected detector 455 // (lots to do here, depending what is necessary for instrument troubleshooting) 456 // - like being able to turn corrections on/off and view with different axes (pix, mm, Q) 457 // 458 Function IsolateButtonProc(ba) : ButtonControl 459 STRUCT WMButtonAction &ba 460 461 switch( ba.eventCode ) 462 case 2: // mouse up 463 // click code here 464 break 465 case -1: // control being killed 466 break 467 endswitch 468 469 return 0 470 End 471 472 // TODO 473 // 474 // opens a separate panel with the I(q) representation of the data 475 // ? controls here to select how the data is processed/grouped/saved, etc. 476 // 477 Function IvsQPanelButtonProc(ba) : ButtonControl 478 STRUCT WMButtonAction &ba 479 480 switch( ba.eventCode ) 481 case 2: // mouse up 482 // click code here 483 break 484 case -1: // control being killed 485 break 486 endswitch 487 488 return 0 489 End 490 491 // TODO 492 // 493 // gets the status of the currently displayed file and dumps it to the panel (not the cmd window) 494 // - lots to decide here about what is the important stuff to display. There's a lot more information now 495 // 496 Function StatusButtonProc(ba) : ButtonControl 497 STRUCT WMButtonAction &ba 498 499 switch( ba.eventCode ) 500 case 2: // mouse up 501 // click code here 502 break 503 case -1: // control being killed 504 break 505 endswitch 506 507 return 0 508 End 509 510 511 // TODO 512 // toggle the (z) value of the display log/lin 513 // 514 Function LogLinButtonProc(ba) : ButtonControl 515 STRUCT WMButtonAction &ba 516 517 switch( ba.eventCode ) 518 case 2: // mouse up 519 // click code here 520 521 // which tab is active? does it matter - or do I log-scale everything? 522 // log/lin current state is in the S_UserData string (0=linear, 1=log) 523 ControlInfo/W=VSANS_Data button_log 524 Variable curState,newState 525 String newStateStr,newTitleStr 526 527 curState = str2num(S_UserData) 528 529 if(curState == 0) 530 newState = 1 531 newStateStr="1" 532 newTitleStr = "isLog" 533 else 534 newState = 0 535 newStateStr="0" 536 newTitleStr = "isLin" 537 endif 538 539 // update the button and the global value 540 Button button_log,userData=newStateStr,title=newTitleStr 541 NVAR state = root:Packages:NIST:VSANS:Globals:gIsLogScale 542 state = newState 543 544 // on the front: 545 ModifyImage/W=VSANS_Data#det_panelsF ''#0 log=newState 546 ModifyImage/W=VSANS_Data#det_panelsF ''#1 log=newState 547 ModifyImage/W=VSANS_Data#det_panelsF ''#2 log=newState 548 ModifyImage/W=VSANS_Data#det_panelsF ''#3 log=newState 549 //on the middle: 550 ModifyImage/W=VSANS_Data#det_panelsM ''#0 log=newState 551 ModifyImage/W=VSANS_Data#det_panelsM ''#1 log=newState 552 ModifyImage/W=VSANS_Data#det_panelsM ''#2 log=newState 553 ModifyImage/W=VSANS_Data#det_panelsM ''#3 log=newState 554 // on the back: 555 ModifyImage/W=VSANS_Data#det_panelsB ''#0 log=newState 556 557 break 558 case -1: // control being killed 559 break 560 endswitch 561 562 return 0 563 End 564 565 // TODO 566 // possibly function to "tag" files right here in the disaply with things 567 // like their intent, or other values that reduction will need, 568 Function TagFileButtonProc(ba) : ButtonControl 569 STRUCT WMButtonAction &ba 570 571 switch( ba.eventCode ) 572 case 2: // mouse up 573 // click code here 574 DoAlert 0, "TagFileButtonProc(ba) unfinished" 575 576 577 break 578 case -1: // control being killed 579 break 580 endswitch 581 582 return 0 583 End 584 585 //TODO 586 // 587 //link this to the beam center finding panel 588 // 589 Function BeamCtrButtonProc(ba) : ButtonControl 590 STRUCT WMButtonAction &ba 591 592 switch( ba.eventCode ) 593 case 2: // mouse up 594 // click code here 595 break 596 case -1: // control being killed 597 break 598 endswitch 599 600 return 0 601 End 602 603 // TODO 604 // 605 // link this slider to the "high" end of the color mapping for whatever is currently displayed 606 // 607 Function HiMapSliderProc(sa) : SliderControl 608 STRUCT WMSliderAction &sa 609 610 switch( sa.eventCode ) 611 case -1: // control being killed 612 break 613 default: 614 if( sa.eventCode & 1 ) // value set 615 Variable curval = sa.curval 616 endif 617 break 618 endswitch 619 620 return 0 621 End 622 623 // TODO 624 // 625 // link this slider to the "low" end of the color mapping for whatever is currently displayed 626 // 627 Function LowMapSliderProc(sa) : SliderControl 628 STRUCT WMSliderAction &sa 629 630 switch( sa.eventCode ) 631 case -1: // control being killed 632 break 633 default: 634 if( sa.eventCode & 1 ) // value set 635 Variable curval = sa.curval 636 endif 637 break 638 endswitch 639 640 return 0 641 End 642 643 644
Note: See TracChangeset
for help on using the changeset viewer.