- Timestamp:
- May 31, 2018 10:12:09 AM (5 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VSANS_Includes.ipf
r1100 r1104 17 17 #include "GaussUtils_v40" 18 18 #include "NIST_XML_v40" 19 #include "USANS_SlitSmearing_v40" 20 19 21 // 20 22 //#include "NCNR_Utils" //needed to load linear fits, mostly VAX file name junk -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Attenuation.ipf
r1073 r1104 261 261 End 262 262 263 // TODO -- this may not correctly mimic the enumerated type of the file264 // but I need to fudge this somehow265 //266 // returns null string if the type cannot be deduced, calling procedure is responsible267 // for properly handling this error condition268 //269 Function/S V_DeduceMonochromatorType(fname)270 String fname271 272 String typeStr=""273 274 if(cmpstr(V_getVelSelStatus(fname),"IN") == 0)275 typeStr = "velocity_selector"276 endif277 278 if(cmpstr(V_getWhiteBeamStatus(fname),"IN") == 0)279 typeStr = "white_beam"280 endif281 282 if(cmpstr(V_getCrystalStatus(fname),"IN") == 0)283 typeStr = "crystal"284 endif285 286 return(typeStr)287 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Initialize.ipf
r1101 r1104 422 422 Printf "Hook cleaned out RawVSANS, experiment saved\r" 423 423 424 KillDataFolder/Z root:Packages:NIST:VSANS:RAW 425 KillDataFolder/Z root:Packages:NIST:VSANS:SAM 426 KillDataFolder/Z root:Packages:NIST:VSANS:EMP 427 KillDataFolder/Z root:Packages:NIST:VSANS:BGD 428 KillDataFolder/Z root:Packages:NIST:VSANS:COR 429 KillDataFolder/Z root:Packages:NIST:VSANS:DIV 430 KillDataFolder/Z root:Packages:NIST:VSANS:MSK 431 KillDataFolder/Z root:Packages:NIST:VSANS:ABS 432 KillDataFolder/Z root:Packages:NIST:VSANS:CAL 433 KillDataFolder/Z root:Packages:NIST:VSANS:STO 434 KillDataFolder/Z root:Packages:NIST:VSANS:SUB 435 KillDataFolder/Z root:Packages:NIST:VSANS:DRK 436 KillDataFolder/Z root:Packages:NIST:VSANS:ADJ 424 425 // these KillDF are a bad idea - it wipes out all of the current work 426 // whenever a save is done - which is the opposite of what you want 427 // to happen when you save! 428 429 // KillDataFolder/Z root:Packages:NIST:VSANS:RAW 430 // KillDataFolder/Z root:Packages:NIST:VSANS:SAM 431 // KillDataFolder/Z root:Packages:NIST:VSANS:EMP 432 // KillDataFolder/Z root:Packages:NIST:VSANS:BGD 433 // KillDataFolder/Z root:Packages:NIST:VSANS:COR 434 // KillDataFolder/Z root:Packages:NIST:VSANS:DIV 435 // KillDataFolder/Z root:Packages:NIST:VSANS:MSK 436 // KillDataFolder/Z root:Packages:NIST:VSANS:ABS 437 // KillDataFolder/Z root:Packages:NIST:VSANS:CAL 438 // KillDataFolder/Z root:Packages:NIST:VSANS:STO 439 // KillDataFolder/Z root:Packages:NIST:VSANS:SUB 440 // KillDataFolder/Z root:Packages:NIST:VSANS:DRK 441 // KillDataFolder/Z root:Packages:NIST:VSANS:ADJ 437 442 438 443 // re-create anthing that was killed -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MaskUtils.ipf
r1093 r1104 10 10 // 11 11 // 12 // this is (at first) to be a very simple editor to generate masks row/column wise, not drawing13 // masks with arbitrary shape.14 //15 //16 12 // 17 13 // … … 22 18 23 19 // TODO 24 // -- when mask is loaded, need to be sure to clean up the "extra" waves that may be present25 // 26 // -- the overlay and the currentTube waves since these are not overwritten or killed when new mask20 // x- when mask is loaded, need to be sure to clean up the "extra" waves that may be present 21 // 22 // x- the overlay and the currentTube waves since these are not overwritten or killed when new mask 27 23 // data is read in from HDF. need to manually? check for these and delete then, or the data and 28 24 // mask overlay will be out of sync. … … 68 64 // x- draw a mask 69 65 // x- save a mask (all panels) 70 // -- move everything into it's own folder, rather than root:66 // x- move everything into it's own folder, rather than root: 71 67 // -- be able to save the mask name to the RAW data file 72 68 // -- be able to read a mask based on what name is in the data file … … 117 113 // TODO 118 114 // need buttons for: 119 // -- quit (to exit gracefully)120 // -- help (button is there, fill in the content)121 // 122 Proc V_MaskEditorPanel() : Panel115 // x- quit (to exit gracefully) (no, just close the window is fine) 116 // x- help (button is there, fill in the content) 117 // 118 Proc V_MaskEditorPanel() 123 119 PauseUpdate; Silent 1 // building window... 124 120 125 NewPanel /W=(662,418,1300,960)/N=MaskEditPanel /K=1 126 // ShowTools/A 127 128 PopupMenu popup_0,pos={20,50},size={109,20},proc=V_SetMaskPanelPopMenuProc,title="Detector Panel" 121 Display /W=(662,418,1300,960)/N=MaskEditPanel /K=1 122 123 ShowTools rect 124 ControlBar 100 125 126 PopupMenu popup_0,pos={18,40},size={109,20},proc=V_SetMaskPanelPopMenuProc,title="Detector Panel" 129 127 PopupMenu popup_0,mode=1,popvalue="FL",value= #"\"FL;FR;FT;FB;MR;ML;MT;MB;B;\"" 130 PopupMenu popup_2,pos={ 20,20},size={109,20},title="Data Source"//,proc=SetFldrPopMenuProc128 PopupMenu popup_2,pos={18,10},size={109,20},title="Data Source"//,proc=SetFldrPopMenuProc 131 129 PopupMenu popup_2,mode=1,popvalue="RAW",value= #"\"RAW;SAM;VCALC;\"" 132 130 133 SetVariable setvar0,pos={2 57.00,20.00},size={150.00,14.00},title="tube number"131 SetVariable setvar0,pos={226,32},size={112,23},title="tube number" 134 132 SetVariable setvar0,limits={0,127,1},value=root:Packages:NIST:VSANS:Globals:Mask:gMaskTube 135 Button button_0,pos={257,46.00},size={50.00,20.00},proc=V_AddToMaskButtonProc,title="Add" 136 Button button_1,pos={319.00,46.00},size={50.00,20.00},proc=V_RemoveFromMaskButtonProc,title="Del" 137 Button button_2,pos={409.00,46.00},size={90.00,20.00},proc=V_ToggleMaskButtonProc,title="Toggle" 138 Button button_3,pos={509.00,46.00},size={80.00,20.00},proc=V_SaveMaskButtonProc,title="Save" 139 Button button_4,pos={603.00,10.00},size={20.00,20.00},proc=V_DrawMaskHelpButtonProc,title="?" 140 CheckBox check_0,pos={190.00,23.00},size={37.00,15.00},proc=V_DrawMaskRadioCheckProc,title="Row" 133 Button button_0,pos={226,58},size={50.00,20.00},proc=V_AddToMaskButtonProc,title="Add" 134 Button button_1,pos={288,58},size={50.00,20.00},proc=V_RemoveFromMaskButtonProc,title="Del" 135 Button button_2,pos={496,41},size={90.00,20.00},proc=V_ToggleMaskButtonProc,title="Toggle" 136 Button button_3,pos={506,66},size={80.00,20.00},proc=V_SaveMaskButtonProc,title="Save" 137 CheckBox check_0,pos={174,35},size={37.00,15.00},proc=V_DrawMaskRadioCheckProc,title="Row" 141 138 CheckBox check_0,value= 0,mode=1 142 CheckBox check_1,pos={1 90.00,46.00},size={32.00,15.00},proc=V_DrawMaskRadioCheckProc,title="Col"139 CheckBox check_1,pos={174,58},size={32.00,15.00},proc=V_DrawMaskRadioCheckProc,title="Col" 143 140 CheckBox check_1,value= 1,mode=1 141 142 Button button_5,pos={18,70.00},size={70.00,20.00},proc=V_MaskToolsButton,title="Tools" 143 Button button_6,pos={380,33},size={90.00,20.00},proc=V_AddShapeToMaskButtonProc,title="Add Shape" 144 Button button_7,pos={380,58},size={90.00,20.00},proc=V_AddShapeToMaskButtonProc,title="Del Shape" 145 Button button_8,pos={556.00,14.00},size={30.00,20.00},proc=V_DrawMaskHelpButtonProc,title="?" 146 147 GroupBox group0,pos={163.00,5.00},size={188.00,90.00},title="Mask Tubes" 148 GroupBox group1,pos={365.00,5.00},size={122.00,90.00},title="Mask Shapes" 144 149 145 150 SetWindow MaskEditPanel, hook(MyHook)=V_MaskWindowHook … … 152 157 V_OverlayMask("FL",1) 153 158 159 SetDrawLayer/W=MaskEditPanel ProgFront 160 SetDrawEnv/W=MaskEditPanel xcoord= bottom,ycoord= left,save //be sure to use axis coordinate mode 154 161 EndMacro 155 162 … … 304 311 End 305 312 306 313 // toggles the view of the mask, either show the mask, or hide it 314 // 307 315 Function V_ToggleMaskButtonProc(ba) : ButtonControl 308 316 STRUCT WMButtonAction &ba … … 317 325 wave/Z overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") 318 326 319 CheckDisplayed/W=MaskEditPanel #DetDataoverlay327 CheckDisplayed/W=MaskEditPanel overlay 320 328 Variable state = !(V_flag) //if V_flag == 0, then set to 1 (and vice versa) 321 329 V_OverlayMask(str,state) … … 329 337 End 330 338 331 339 // adds a row (or column) to the mask 340 // 332 341 Function V_AddToMaskButtonProc(ba) : ButtonControl 333 342 STRUCT WMButtonAction &ba … … 363 372 End 364 373 374 // 375 //adds or erases the mask, based on which button was clicked 376 // (only checks for "add shape", otherwise erases mask) 377 // 378 Function V_AddShapeToMaskButtonProc(ba) : ButtonControl 379 STRUCT WMButtonAction &ba 380 381 switch( ba.eventCode ) 382 case 2: // mouse up 383 // click code here 384 ControlInfo popup_0 385 String str=S_Value 386 387 wave/Z data = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") 388 389 SetDrawLayer/W=MaskEditPanel ProgFront 390 SetDrawEnv/W=MaskEditPanel xcoord= bottom,ycoord= left,save //be sure to use axis coordinate mode 391 392 ImageGenerateROIMask/W=MaskEditPanel curDispPanel //M_ROIMask is in the root: folder 393 394 WAVE M_ROIMask=M_ROIMask 395 if(cmpstr("button_6",ba.ctrlName)==0) 396 data = (data || M_ROIMask) // 0=0, 1=1 == "drawing" more mask points 397 else 398 data = (M_ROIMask[p][q] == 1 && data[p][q] == 1) ? 0 : data[p][q] // if the drawn shape = 1, set the mask to 0 (erase) 399 endif 400 401 V_OverlayMask(str,1) 402 403 SetDrawLayer/K ProgFront 404 SetDrawLayer/W=MaskEditPanel ProgFront 405 SetDrawEnv/W=MaskEditPanel xcoord= bottom,ycoord= left,save //be sure to use axis coordinate mode 406 break 407 case -1: // control being killed 408 break 409 endswitch 410 411 return 0 412 End 413 414 // show the tools (they are there by default) 415 // 416 Function V_MaskToolsButton(ba) : ButtonControl 417 STRUCT WMButtonAction &ba 418 419 switch( ba.eventCode ) 420 case 2: // mouse up 421 // click code here 422 423 ShowTools rect 424 425 SetDrawLayer/W=MaskEditPanel ProgFront 426 SetDrawEnv/W=MaskEditPanel xcoord= bottom,ycoord= left,save //be sure to use axis coordinate mode 427 SetDrawEnv/W=MaskEditPanel fillPat=1 428 429 break 430 case -1: // control being killed 431 break 432 endswitch 433 434 return 0 435 End 436 437 // un-mask a row or column 438 // 365 439 Function V_RemoveFromMaskButtonProc(ba) : ButtonControl 366 440 STRUCT WMButtonAction &ba … … 409 483 // remove the old image (it may not be the right shape) 410 484 // -- but make sure it exists first... 411 String childList = ChildWindowList("MaskEditPanel") 412 Variable flag413 414 flag = WhichListItem("DetData", ChildList) //returns -1 if not in list, 0+ otherwise415 if(flag != -1)416 KillWindow MaskEditPanel#DetData 417 endif 418 419 flag = WhichListItem("ModelData", ChildList)420 if(flag != -1)421 KillWindow MaskEditPanel#ModelData 422 endif 485 486 String list = ImageNameList("", ";" ) 487 Variable num=ItemsInList(list) 488 Variable ii 489 for(ii=0;ii<num;ii+=1) 490 // Wave w = ImageNameToWaveRef("", StringFromList(ii, list,";")) 491 // CheckDisplayed/W=MaskEditPanel w 492 493 RemoveImage/W=MaskEditPanel $(StringFromList(ii, list,";")) 494 endfor 495 496 423 497 424 498 // draw the correct images … … 438 512 V_DrawMaskRadioCheckProc(cba) //call the radio button action proc 439 513 440 //overlay the mask 514 //overlay the mask (removes the old mask first) 441 515 V_OverlayMask(popStr,1) 516 517 SetDrawLayer/K ProgFront 518 SetDrawLayer/W=MaskEditPanel ProgFront 519 SetDrawEnv/W=MaskEditPanel xcoord= bottom,ycoord= left,save //be sure to use axis coordinate mode 442 520 443 521 break … … 457 535 // -- need to adjust the size of the image subwindows 458 536 // 459 // -- need to do something for panel "B". currently ignored537 // x- need to do something for panel "B". currently ignored 460 538 // 461 539 // … … 588 666 589 667 //draw the detector panel 590 Display/W=(left,top,right,bottom)/HOST=# 668 // Display/W=(left,top,right,bottom) 591 669 AppendImage curDispPanel 592 670 ModifyImage curDispPanel ctab= {*,*,ColdWarm,0} … … 595 673 Label left "Y pixels" 596 674 Label bottom "X pixels" 597 RenameWindow #,DetData 598 SetActiveSubwindow ## 675 599 676 600 677 DoUpdate … … 659 736 endif 660 737 661 CheckDisplayed/W=MaskEditPanel #DetDataoverlay738 CheckDisplayed/W=MaskEditPanel overlay 662 739 if(V_flag==0) //so the overlay doesn't get appended more than once 663 AppendImage/W=MaskEditPanel #DetDataoverlay664 AppendImage/W=MaskEditPanel #DetDatacurrentTube740 AppendImage/W=MaskEditPanel overlay 741 AppendImage/W=MaskEditPanel currentTube 665 742 // ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0.9,1,BlueRedGreen,0} ,minRGB=NaN,maxRGB=0 666 ModifyImage/W=MaskEditPanel #DetDataoverlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,40000)667 ModifyImage/W=MaskEditPanel #DetDatacurrentTube ctab= {0.9,1,CyanMagenta,0} ,minRGB=NaN,maxRGB=0743 ModifyImage/W=MaskEditPanel overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,40000) 744 ModifyImage/W=MaskEditPanel currentTube ctab= {0.9,1,CyanMagenta,0} ,minRGB=NaN,maxRGB=0 668 745 // ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0,*,BlueRedGreen,0} 669 746 endif … … 674 751 wave currentTube = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":currentTube") 675 752 676 CheckDisplayed/W=MaskEditPanel #DetDataoverlay753 CheckDisplayed/W=MaskEditPanel overlay 677 754 // Print "V_flag = ",V_flag 678 755 679 756 If(V_Flag == 1) //overlay is present 680 RemoveImage/W=MaskEditPanel #DetDataoverlay681 RemoveImage/W=MaskEditPanel #DetDatacurrentTube757 RemoveImage/W=MaskEditPanel overlay 758 RemoveImage/W=MaskEditPanel currentTube 682 759 endif 683 760 endif -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Utilities_Comparisons.ipf
r1102 r1104 397 397 398 398 399 399 // TODO -- this may not correctly mimic the enumerated type of the file 400 // but I need to fudge this somehow 401 // 402 // returns null string if the type cannot be deduced, calling procedure is responsible 403 // for properly handling this error condition 404 // 405 Function/S V_DeduceMonochromatorType(fname) 406 String fname 407 408 String typeStr="" 409 410 if(cmpstr(V_getVelSelStatus(fname),"IN") == 0) 411 typeStr = "velocity_selector" 412 endif 413 414 if(cmpstr(V_getWhiteBeamStatus(fname),"IN") == 0) 415 typeStr = "white_beam" 416 endif 417 418 if(cmpstr(V_getCrystalStatus(fname),"IN") == 0) 419 typeStr = "crystal" 420 endif 421 422 return(typeStr) 423 End 424 425
Note: See TracChangeset
for help on using the changeset viewer.