- Timestamp:
- May 27, 2016 4:42:06 PM (7 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Panel.ipf
r971 r1000 112 112 113 113 SetVariable FFTSetVar_4,pos={7,47},size={100,15},title="FFT time(s)" 114 SetVariable FFTSetVar_4,limits={0,0,0},value= FFT_estTime,noedit= 1,live= 1,format="% d"114 SetVariable FFTSetVar_4,limits={0,0,0},value= FFT_estTime,noedit= 1,live= 1,format="%g" 115 115 Button FFTButton_9,pos={200,400},size={100,20},proc=FFT_Get2DSlice,title="Get 2D Slice" 116 116 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf
r999 r1000 1430 1430 End 1431 1431 1432 // only return value for B and L/R detectors. everything else returns zero 1432 1433 Function V_getDet_LateralOffset(fname,detStr) 1433 1434 String fname,detStr 1434 1435 1436 if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0) 1437 return(0) 1438 endif 1439 if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0) 1440 return(0) 1441 endif 1442 1435 1443 String path = "entry:instrument:detector_"+detStr+":lateral_offset" 1436 1444 return(V_getRealValueFromHDF5(fname,path)) 1437 1445 End 1438 1446 1439 // TODO - be sure this is defined correctly (with correct units!) 1440 // -- only returns for T/B detectors 1441 Function V_getDet_TBSetback(fname,detStr) 1447 // only return values for T/B. everything else returns zero 1448 Function V_getDet_VerticalOffset(fname,detStr) 1442 1449 String fname,detStr 1443 1450 … … 1452 1459 endif 1453 1460 1461 String path = "entry:instrument:detector_"+detStr+":vertical_offset" 1462 return(V_getRealValueFromHDF5(fname,path)) 1463 End 1464 1465 // TODO - be sure this is defined correctly (with correct units!) 1466 // -- only returns for T/B detectors 1467 Function V_getDet_TBSetback(fname,detStr) 1468 String fname,detStr 1469 1470 if(cmpstr(detStr,"B") == 0) 1471 return(0) 1472 endif 1473 if(cmpstr(detStr,"FR") == 0 || cmpstr(detStr,"FL") == 0) 1474 return(0) 1475 endif 1476 if(cmpstr(detStr,"MR") == 0 || cmpstr(detStr,"ML") == 0) 1477 return(0) 1478 endif 1479 1454 1480 String path = "entry:instrument:detector_"+detStr+":setback" 1455 1481 return(V_getRealValueFromHDF5(fname,path)) … … 1458 1484 End 1459 1485 1460 //Function V_getDet_VerticalOffset(fname,detStr)1461 // String fname,detStr1462 //1463 // String path = "entry:instrument:detector_"+detStr+":vertical_offset"1464 // return(V_getRealValueFromHDF5(fname,path))1465 //End1466 1486 1467 1487 … … 1506 1526 //End 1507 1527 1508 Function/S V_getDetType(fname,detStr)1509 String fname,detStr1510 1511 String path = "entry:instrument:detector_"+detStr+":type"1512 Variable num=601513 return(V_getStringFromHDF5(fname,path,num))1514 End1528 //Function/S V_getDetType(fname,detStr) 1529 // String fname,detStr 1530 // 1531 // String path = "entry:instrument:detector_"+detStr+":type" 1532 // Variable num=60 1533 // return(V_getStringFromHDF5(fname,path,num)) 1534 //End 1515 1535 1516 1536 Function V_getDet_x_pixel_size(fname,detStr) … … 1541 1561 End 1542 1562 1543 // TODO -- be clear on how this is defined. Separation as defined from what point? Units?1544 Function V_getDetPanelSeparation(fname,detStr)1545 String fname,detStr1546 1547 String path = "entry:instrument:detector_"+detStr+":separation"1548 if(cmpstr(detStr,"B") == 0)1549 return(0)1550 else1551 return(V_getRealValueFromHDF5(fname,path))1552 endif1553 End1563 // this has been deleted from the definition 1564 //Function V_getDetPanelSeparation(fname,detStr) 1565 // String fname,detStr 1566 // 1567 // String path = "entry:instrument:detector_"+detStr+":separation" 1568 // if(cmpstr(detStr,"B") == 0) 1569 // return(0) 1570 // else 1571 // return(V_getRealValueFromHDF5(fname,path)) 1572 // endif 1573 //End 1554 1574 1555 1575 // TODO -- write this function to return a WAVE with the data … … 1688 1708 1689 1709 /////// sample_aperture (1) (data folder) 1710 // this is the INTERNAL sample aperture 1711 // 1690 1712 Function/S V_getSampleAp_Description(fname) 1691 1713 String fname … … 1738 1760 1739 1761 /////// sample_aperture_2 (data folder) 1762 // sample aperture (2) is the external paerture, which may or may not be present 1740 1763 1741 1764 Function/S V_getSampleAp2_Description(fname) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Write.ipf
r994 r1000 3908 3908 End 3909 3909 3910 // this is only written for B and L/R detectors 3910 3911 Function V_writeDet_LateralOffset(fname,detStr,val) 3911 3912 String fname,detStr … … 3913 3914 3914 3915 // String path = "entry:instrument:detector_"+detStr+":lateral_offset" 3915 3916 3917 if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0) 3918 return(0) 3919 endif 3920 if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0) 3921 return(0) 3922 endif 3923 3916 3924 Make/O/D/N=1 wTmpWrite 3917 3925 // Make/O/R/N=1 wTmpWrite 3918 3926 String groupName = "/entry/instrument/detector_"+detStr 3919 3927 String varName = "lateral_offset" 3928 wTmpWrite[0] = val 3929 3930 variable err 3931 err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 3932 if(err) 3933 Print "HDF write err = ",err 3934 endif 3935 // now be sure to kill the data folder to force a re-read of the data next time this file is read in 3936 // err = V_KillNamedDataFolder(fname) 3937 // if(err) 3938 // Print "DataFolder kill err = ",err 3939 // endif 3940 return(err) 3941 End 3942 3943 3944 // this is only written for T/B detectors 3945 Function V_writeDet_VerticalOffset(fname,detStr,val) 3946 String fname,detStr 3947 Variable val 3948 3949 // String path = "entry:instrument:detector_"+detStr+":vertical_offset" 3950 3951 if(cmpstr(detStr,"B") == 0) 3952 return(0) 3953 endif 3954 if(cmpstr(detStr,"FR") == 0 || cmpstr(detStr,"FL") == 0) 3955 return(0) 3956 endif 3957 if(cmpstr(detStr,"MR") == 0 || cmpstr(detStr,"ML") == 0) 3958 return(0) 3959 endif 3960 3961 Make/O/D/N=1 wTmpWrite 3962 // Make/O/R/N=1 wTmpWrite 3963 String groupName = "/entry/instrument/detector_"+detStr 3964 String varName = "vertical_offset" 3920 3965 wTmpWrite[0] = val 3921 3966 … … 3972 4017 3973 4018 3974 3975 3976 //Function V_writeDet_VerticalOffset(fname,detStr,val)3977 // String fname,detStr3978 // Variable val3979 //3980 //// String path = "entry:instrument:detector_"+detStr+":vertical_offset"3981 //3982 // Make/O/D/N=1 wTmpWrite3983 //// Make/O/R/N=1 wTmpWrite3984 // String groupName = "/entry/instrument/detector_"+detStr3985 // String varName = "vertical_offset"3986 // wTmpWrite[0] = val3987 //3988 // variable err3989 // err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite)3990 // if(err)3991 // Print "HDF write err = ",err3992 // endif3993 // // now be sure to kill the data folder to force a re-read of the data next time this file is read in3994 //// err = V_KillNamedDataFolder(fname)3995 //// if(err)3996 //// Print "DataFolder kill err = ",err3997 //// endif3998 // return(err)3999 //End4000 4019 4001 4020 //// only defined for the "B" detector, and only to satisfy NXsas … … 4110 4129 //End 4111 4130 4112 Function V_writeDetType(fname,detStr,str)4113 String fname,detStr,str4114 4115 // String path = "entry:instrument:detector_"+detStr+":type"4116 4117 Make/O/T/N=1 tmpTW4118 String groupName = "/entry/instrument/detector_"+detStr //4119 String varName = "type"4120 tmpTW[0] = str //4121 4122 variable err4123 err = V_WriteTextWaveToHDF(fname, groupName, varName, tmpTW)4124 if(err)4125 Print "HDF write err = ",err4126 endif4127 4128 // now be sure to kill the data folder to force a re-read of the data next time this file is read in4129 // err = V_KillNamedDataFolder(fname)4130 // if(err)4131 // Print "DataFolder kill err = ",err4132 // endif4133 4134 return(err)4135 End4131 //Function V_writeDetType(fname,detStr,str) 4132 // String fname,detStr,str 4133 // 4134 //// String path = "entry:instrument:detector_"+detStr+":type" 4135 // 4136 // Make/O/T/N=1 tmpTW 4137 // String groupName = "/entry/instrument/detector_"+detStr // 4138 // String varName = "type" 4139 // tmpTW[0] = str // 4140 // 4141 // variable err 4142 // err = V_WriteTextWaveToHDF(fname, groupName, varName, tmpTW) 4143 // if(err) 4144 // Print "HDF write err = ",err 4145 // endif 4146 // 4147 // // now be sure to kill the data folder to force a re-read of the data next time this file is read in 4148 //// err = V_KillNamedDataFolder(fname) 4149 //// if(err) 4150 //// Print "DataFolder kill err = ",err 4151 //// endif 4152 // 4153 // return(err) 4154 //End 4136 4155 4137 4156 Function V_writeDet_x_pixel_size(fname,detStr,val) … … 4217 4236 End 4218 4237 4219 // TODO -- be clear on how this is defined. Separation as defined from what point? Units? 4220 Function V_writeDetPanelSeparation(fname,detStr,val) 4221 String fname,detStr 4222 Variable val 4223 4224 // String path = "entry:instrument:detector_"+detStr+":separation" 4225 if(cmpstr(detStr,"B") == 0) 4226 return(0) 4227 else 4228 4229 Make/O/D/N=1 wTmpWrite 4230 // Make/O/R/N=1 wTmpWrite 4231 String groupName = "/entry/instrument/detector_"+detStr 4232 String varName = "separation" 4233 wTmpWrite[0] = val 4234 4235 variable err 4236 err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 4237 if(err) 4238 Print "HDF write err = ",err 4239 endif 4240 // now be sure to kill the data folder to force a re-read of the data next time this file is read in 4241 // err = V_KillNamedDataFolder(fname) 4238 // deleted from definition 4239 //Function V_writeDetPanelSeparation(fname,detStr,val) 4240 // String fname,detStr 4241 // Variable val 4242 // 4243 //// String path = "entry:instrument:detector_"+detStr+":separation" 4244 // if(cmpstr(detStr,"B") == 0) 4245 // return(0) 4246 // else 4247 // 4248 // Make/O/D/N=1 wTmpWrite 4249 // // Make/O/R/N=1 wTmpWrite 4250 // String groupName = "/entry/instrument/detector_"+detStr 4251 // String varName = "separation" 4252 // wTmpWrite[0] = val 4253 // 4254 // variable err 4255 // err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 4242 4256 // if(err) 4243 // Print " DataFolder killerr = ",err4257 // Print "HDF write err = ",err 4244 4258 // endif 4245 return(err) 4246 endif 4247 End 4259 // // now be sure to kill the data folder to force a re-read of the data next time this file is read in 4260 //// err = V_KillNamedDataFolder(fname) 4261 //// if(err) 4262 //// Print "DataFolder kill err = ",err 4263 //// endif 4264 // return(err) 4265 // endif 4266 //End 4248 4267 4249 4268 // TODO -- write this function to return a WAVE with the data -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MainPanel.ipf
r994 r1000 47 47 String ctrlName 48 48 49 DrawMask()49 Edit_a_Mask() 50 50 End 51 51 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MaskUtils.ipf
r999 r1000 56 56 PauseUpdate; Silent 1 // building window... 57 57 58 NewPanel /W=(662,418,1 586,960)/N=MaskEditPanel/K=158 NewPanel /W=(662,418,1300,960)/N=MaskEditPanel /K=1 59 59 // ShowTools/A 60 60 61 61 PopupMenu popup_0,pos={20,50},size={109,20},proc=SetMaskPanelPopMenuProc,title="Detector Panel" 62 PopupMenu popup_0,mode=1,popvalue="F L",value= #"\"FL;FR;FT;FB;MR;ML;MT;MB;B;\""62 PopupMenu popup_0,mode=1,popvalue="FT",value= #"\"FL;FR;FT;FB;MR;ML;MT;MB;B;\"" 63 63 PopupMenu popup_2,pos={20,20},size={109,20},title="Data Source"//,proc=SetFldrPopMenuProc 64 PopupMenu popup_2,mode=1,popvalue=" VCALC",value= #"\"RAW;SAM;VCALC;\""65 66 // Button button_0,pos={486,20},size={80,20},proc=DetFitGuessButtonProc,title="Guess"67 // Button button_1,pos={615,20},size={80,20},proc=DetFitButtonProc,title="Do Fit" 68 // Button button_2,pos={744,20},size={80,20},proc=DetFitHelpButtonProc,title="Help"69 // Button button_3,pos={615,400},size={110,20},proc=WriteCtrButtonProc,title="Write Centers"70 // Button button_4,pos={730,400},size={110,20},proc=CtrTableButtonProc,title="Ctr table"71 // Button button_5,pos={730,440},size={110,20},proc=WriteCtrTableButtonProc,title="Write table"64 PopupMenu popup_2,mode=1,popvalue="RAW",value= #"\"RAW;SAM;VCALC;\"" 65 66 SetVariable setvar0,pos={247.00,20.00},size={150.00,14.00},title="tube number" 67 SetVariable setvar0,limits={0,128,1},value= _NUM:0 68 Button button_0,pos={249.00,46.00},size={50.00,20.00},proc=AddToMaskButtonProc,title="Add" 69 Button button_1,pos={309.00,46.00},size={50.00,20.00},proc=RemoveFromMaskButtonProc,title="Del" 70 Button button_2,pos={389.00,46.00},size={90.00,20.00},proc=ToggleMaskButtonProc,title="Toggle" 71 Button button_3,pos={489.00,46.00},size={80.00,20.00},proc=SaveMaskButtonProc,title="Save" 72 72 73 73 // TODO -- need buttons for save? quit? … … 77 77 78 78 // TODO - get rid of the hard-wired panel choice 79 duplicate/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FL:det_FL curDispPanel 79 // duplicate/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FL:det_FL curDispPanel 80 Make/O/D/N=(48,128) curDispPanel //will this work? 80 81 SetScale/P x 0,1, curDispPanel 81 82 SetScale/P y 0,1, curDispPanel … … 83 84 // draw the correct images 84 85 //draw the detector panel 85 DrawPanelToMask("F L")86 DrawPanelToMask("FT") 86 87 87 88 // overlay the current mask 88 V_OverlayMask("F L",1)89 V_OverlayMask("FT",1) 89 90 // OverlayMaskPanel("FL") 90 91 91 92 EndMacro 93 94 95 Function ToggleMaskButtonProc(ba) : ButtonControl 96 STRUCT WMButtonAction &ba 97 98 switch( ba.eventCode ) 99 case 2: // mouse up 100 // click code here 101 102 ControlInfo popup_0 103 String str=S_Value 104 105 wave/Z overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") 106 107 CheckDisplayed/W=MaskEditPanel#DetData overlay 108 Variable state = !(V_flag) //if V_flag == 0, then set to 1 (and vice versa) 109 V_OverlayMask(str,state) 110 111 break 112 case -1: // control being killed 113 break 114 endswitch 115 116 return 0 117 End 118 119 120 Function AddToMaskButtonProc(ba) : ButtonControl 121 STRUCT WMButtonAction &ba 122 123 switch( ba.eventCode ) 124 case 2: // mouse up 125 // click code here 126 ControlInfo popup_0 127 String str=S_Value 128 129 wave/Z maskData = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") 130 131 Variable val 132 ControlInfo setvar0 133 val = V_Value 134 maskData[val][] = 1 135 136 V_OverlayMask(str,1) 137 138 // Print "add tube to mask" 139 break 140 case -1: // control being killed 141 break 142 endswitch 143 144 return 0 145 End 146 147 Function RemoveFromMaskButtonProc(ba) : ButtonControl 148 STRUCT WMButtonAction &ba 149 150 switch( ba.eventCode ) 151 case 2: // mouse up 152 // click code here 153 ControlInfo popup_0 154 String str=S_Value 155 156 wave/Z maskData = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") 157 158 Variable val 159 ControlInfo setvar0 160 val = V_Value 161 maskData[val][] = 0 162 163 V_OverlayMask(str,1) 164 // Print "remove tube from mask" 165 break 166 case -1: // control being killed 167 break 168 endswitch 169 170 return 0 171 End 92 172 93 173 // … … 200 280 201 281 202 Variable scale = 5282 Variable scale = 10 203 283 204 284 // common values (panel position, etc) … … 289 369 String maskPath = "root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data" 290 370 if(WaveExists($maskPath) == 1) 291 //duplicate the mask, which is named "data" 292 wave maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") 293 294 Duplicate/O maskW $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") 295 wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") 296 297 Redimension/D overlay 298 SetScale/P x 0,1, overlay 299 SetScale/P y 0,1, overlay 300 301 String tempStr = "root:Packages:NIST:MSK:overlay" 302 overlay = (maskW == 1) ? 1 : NaN 303 // ResetLoop(tempStr) //keeps 1's and sets 0's to NaN 304 305 AppendImage/W=MaskEditPanel#DetData overlay 306 ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0,*,BlueRedGreen,0} 307 308 // 309 // //check to see if mask overlay is currently displayed 310 // DoWindow SANS_Data 311 // if(V_flag==0) 312 // return(0) 313 // endif 314 // 315 // CheckDisplayed/W=SANS_Data root:Packages:NIST:MSK:overlay 316 // //Print "V_flag = ",V_flag 317 // 318 // If(V_Flag == 1) //overlay is present 319 // if(state==0) 320 // RemoveImage overlay 321 // endif //don't need to do anything if we want to keep the mask 322 // Else //overlay is not present 323 // if(state==1) 324 // //append the new overlay 325 // AppendImage/L=left/B=bottom root:Packages:NIST:MSK:overlay 326 // //set the color table to vary from 0 to * (=max data = 1), with blue maximum 327 // //Nan's will appear transparent (just a general feature of images) 328 // ModifyImage/W=SANS_Data overlay ctab={0,*,BlueRedGreen,0} 329 // endif //don't do anything if we don't want the overlay 330 // Endif 331 // 371 if(state == 1) 372 //duplicate the mask, which is named "data" 373 wave maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") 374 375 Duplicate/O maskW $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") 376 wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") 377 378 Redimension/D overlay 379 SetScale/P x 0,1, overlay 380 SetScale/P y 0,1, overlay 381 382 String tempStr = "root:Packages:NIST:MSK:overlay" 383 // overlay = (maskW == 1) ? 1 : NaN //no need to do this - simply adjust the coloring 384 385 CheckDisplayed/W=MaskEditPanel#DetData overlay 386 if(V_flag==0) //so the overlay doesn't get appended more than once 387 AppendImage/W=MaskEditPanel#DetData overlay 388 ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0.9,1,BlueRedGreen,0} ,minRGB=NaN,maxRGB=0 389 // ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0,*,BlueRedGreen,0} 390 endif 391 endif 392 393 if(state == 0) 394 wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") 395 CheckDisplayed/W=MaskEditPanel#DetData overlay 396 // Print "V_flag = ",V_flag 397 398 If(V_Flag == 1) //overlay is present 399 RemoveImage/W=MaskEditPanel#DetData overlay 400 endif 401 endif 332 402 Endif 333 403 334 404 return(0) 405 End 406 407 408 Function SaveMaskButtonProc(ba) : ButtonControl 409 STRUCT WMButtonAction &ba 410 411 switch( ba.eventCode ) 412 case 2: // mouse up 413 // click code here 414 415 Execute "H_Setup_VSANS_MASK_Structure()" 416 417 // fill with current "stuff" 418 SetDataFolder root:VSANS_MASK_file:entry 419 Wave/T title = title 420 title = "This is a custom MASK file for VSANS" 421 SetDataFolder root: 422 423 424 // copy over for all of the detector panels 425 426 Variable ii 427 String str 428 for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 429 str = StringFromList(ii, ksDetectorListAll, ";") 430 Wave det_str = $("root:VSANS_MASK_file:entry:instrument:detector_"+str+":data") 431 wave maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") 432 det_str = maskW 433 endfor 434 435 //save it 436 // String fileName = "ThisIsAMASK" 437 438 Execute "Save_VSANS_MASK_Nexus()" 439 440 break 441 case -1: // control being killed 442 break 443 endswitch 444 445 SetDataFolder root: 446 return 0 335 447 End 336 448
Note: See TracChangeset
for help on using the changeset viewer.