Changeset 984 for sans/Dev/trunk/NCNR_User_Procedures/Reduction
- Timestamp:
- Mar 11, 2016 3:36:43 PM (7 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MC_Script_Panels.ipf
r951 r984 16 16 // x- configurations, samples, and listBox waves. 17 17 // 18 // -- the proc=MyListboxProc has been commented out. It was present for Igor 6 and did not generate an error. 19 // I don't think I ever wrote this procedure at all. In Igor 7 it generates an error, so it's out for now. 18 20 // 19 21 // use Sim_ as a prefix for the functions rather than MC_ … … 100 102 // always visible 101 103 // clickEventModifiers=8 = ignore the shift key in the list box (I'm using that bit (3) of selWave to flag trans) 102 ListBox RLCtrlA,pos={17,290},size={660,250}, proc=MyListboxProc,frame=2,clickEventModifiers=8104 ListBox RLCtrlA,pos={17,290},size={660,250},frame=2,clickEventModifiers=8//,proc=MyListboxProc 103 105 ListBox RLCtrlA,listWave=root:Packages:NIST:RunSim:textW,selWave=root:Packages:NIST:RunSim:selW//,colorWave=root:Packages:NIST:RunSim:myColors 104 106 ListBox RLCtrlA,row= 0,mode= 2,editStyle= 2,widths= {40,70,120,120,50,120,30,30} -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_BeamCenter.ipf
r983 r984 408 408 409 409 // 410 // TODO -- currently hard-wired for the only fit function 411 // 410 // TODO -- currently hard-wired for coefficients from the only fit function 411 // 412 // -- will need to recalc mm center AND q-values 412 413 Function WriteCtrButtonProc(ba) : ButtonControl 413 414 STRUCT WMButtonAction &ba … … 427 428 V_putDet_beam_center_y(fname,detStr,coefW[10]) 428 429 430 DoAlert 0, "-- will need to recalc mm center AND q-values" 431 429 432 break 430 433 case -1: // control being killed … … 442 445 // 443 446 // 444 // function to call the fit fu cntion (2D)447 // function to call the fit function (2D) 445 448 // 446 449 Function DetFitButtonProc(ba) : ButtonControl … … 572 575 // -- will need to remove the hard-wired values and get the proper values from the data 573 576 // -- ?? will the "proper" values be in pixels or distance? All depends on how I display the data... 574 // -- may want to keep the nominal scaling values around in case the proper values aren' in the file 577 // -- may want to keep the nominal scaling values around in case the proper values aren't in the file 578 // 579 // 580 // 581 //â¢print xCtr_pix 582 // xCtr_pix[0]= {64,64,55,-8.1,64,64,55,-8.1,63.4} 583 //â¢print yCtr_pix 584 // yCtr_pix[0]= {-8.7,55,64,64,-8.7,55,64,64,62.7} 575 585 // 576 586 Function V_RestorePanels() … … 580 590 Variable ii,xCtr,yCtr 581 591 582 //// this works if the proper centers are in the file - otherwise, it's a mess 583 // fname = "RAW" 584 // for(ii=0;ii<ItemsInList(ksDetectorListNoB);ii+=1) 585 // detStr = StringFromList(ii, ksDetectorListNoB, ";") 586 // xCtr = V_getDet_beam_center_x(fname,detStr) 587 // yCtr = V_getDet_beam_center_y(fname,detStr) 588 // V_RescaleToBeamCenter("RAW",detStr,xCtr,yCtr) 589 // endfor 592 // this works if the proper centers are in the file - otherwise, it's a mess 593 // "B" is skipped here, as it should be... 594 fname = "RAW" 595 for(ii=0;ii<ItemsInList(ksDetectorListNoB);ii+=1) 596 detStr = StringFromList(ii, ksDetectorListNoB, ";") 597 xCtr = V_getDet_beam_center_x(fname,detStr) 598 yCtr = V_getDet_beam_center_y(fname,detStr) 599 V_RescaleToBeamCenter("RAW",detStr,xCtr,yCtr) 600 endfor 590 601 591 602 592 603 // nominal values... better to use what's in the file 593 // 594 V_RescaleToBeamCenter("RAW","MB",64,55) 595 V_RescaleToBeamCenter("RAW","MT",64,-8.7) 596 V_RescaleToBeamCenter("RAW","MR",-8.1,64) 597 V_RescaleToBeamCenter("RAW","ML",55,64) 598 V_RescaleToBeamCenter("RAW","FB",64,55) 599 V_RescaleToBeamCenter("RAW","FT",64,-8.7) 600 V_RescaleToBeamCenter("RAW","FR",-8.1,64) 601 V_RescaleToBeamCenter("RAW","FL",55,64) 604 //// 605 // V_RescaleToBeamCenter("RAW","MB",64,55) 606 // V_RescaleToBeamCenter("RAW","MT",64,-8.7) 607 // V_RescaleToBeamCenter("RAW","MR",-8.1,64) 608 // V_RescaleToBeamCenter("RAW","ML",55,64) 609 // V_RescaleToBeamCenter("RAW","FB",64,55) 610 // V_RescaleToBeamCenter("RAW","FT",64,-8.7) 611 // V_RescaleToBeamCenter("RAW","FR",-8.1,64) 612 // V_RescaleToBeamCenter("RAW","FL",55,64) 613 614 602 615 return(0) 603 616 end … … 657 670 // TODO 658 671 // and now the mm values 672 xCtr_mm[ii] = V_getDet_beam_center_x_mm(fname,detStr) 673 yCtr_mm[ii] = V_getDet_beam_center_y_mm(fname,detStr) 659 674 660 675 endfor -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_HDF5_VSANS_Utils.ipf
r981 r984 67 67 "Setup_VSANS_DIV_Struct" 68 68 "Save_VSANS_DIV_Nexus" 69 "-" 70 "Read_Nexus with attributes",Read_Nexus_Xref() //this will read with attributes 69 71 End 70 72 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VSANS_Includes.ipf
r982 r984 52 52 #include "V_Utilities_General" // 53 53 #include "V_DataPlotting" 54 55 // 1D binning, combining 56 #include "V_IQ_Utilities" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DataPlotting.ipf
r982 r984 17 17 if(V_flag==0) 18 18 Execute "V_DrawPlotPanel()" 19 else 20 SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType 21 22 V_QBinAllPanels(type) 23 24 // TODO: 25 // x- "B" detector is currently skipped - Q is not yet calculated 26 Execute ("V_Back_IQ_Graph(\""+type+"\")") 27 Execute ("V_Middle_IQ_Graph(\""+type+"\")") 28 Execute ("V_Front_IQ_Graph(\""+type+"\")") 19 29 endif 20 30 End … … 41 51 V_QBinAllPanels(type) 42 52 43 // TODO "B" detector is currently skipped - Q is not yet calculated 44 // V_Back_IQ_Graph() 53 // TODO 54 // x- "B" detector is currently skipped - Q is not yet calculated 55 V_Back_IQ_Graph(type) 45 56 V_Middle_IQ_Graph(type) 46 57 V_Front_IQ_Graph(type) … … 54 65 // 55 66 // TODO 56 // -- detector "B" is currently skipped since the calibration waves are not faked67 // x- detector "B" is currently skipped since the calibration waves are not faked 57 68 // when the raw data is loaded. Then the qxqyqz waves are not generated. 69 // 70 // -- REDO the logic here. It's a mess, and will get the calculation wrong 71 // 58 72 // -- figure out the binning type (where is it set?) 59 73 // -- binning type is HARD-WIRED … … 72 86 73 87 74 //// TODO -- currently the "B" detector is skipped - it was skipped in 88 //// TODO: 89 // x- currently the "B" detector is skipped - it was skipped in 75 90 // previous functions where q values are calculated 76 91 // 77 // delQ = SetDeltaQ("RAW","B")78 //79 //// dispatch based on binning type80 // if(binType == 4)81 // VC_fDoBinning_QxQy2D("RAW", "B") //normal binning, nothing to combine82 //endif83 // 84 // //TODO -- this is only a temporary fix for slit mode85 //if(binType == 4)86 ///// this is for a tall, narrow slit mode87 // VC_fBinDetector_byRows("VCALC","B")88 //endif92 delQ = SetDeltaQ(folderStr,"B") 93 94 // dispatch based on binning type 95 if(binType == 1) 96 VC_fDoBinning_QxQy2D(folderStr, "B") //normal binning, nothing to combine 97 endif 98 99 // TODO -- this is only a temporary fix for slit mode 100 if(binType == 4) 101 /// this is for a tall, narrow slit mode 102 VC_fBinDetector_byRows(folderStr,"B") 103 endif 89 104 90 105 // these are the binning types where detectors are not combined … … 384 399 385 400 386 401 // TODO 402 // -- need to set binType 403 // -- currently hard-wired == 1 404 // 405 ////////////to plot the back panel I(q) 406 Proc V_Back_IQ_Graph(type) 407 String type 408 409 SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:entry:instrument:detector_B 410 411 Variable binType 412 413 // ControlInfo/W=VCALC popup_b 414 // binType = V_Value // V_value counts menu items from 1, so 1=1, 2=2, 3=4 415 416 bintype = 1 417 418 SetDataFolder $("root:Packages:NIST:VSANS:"+type) 419 420 if(binType==1 || binType==2 || binType==3) 421 422 CheckDisplayed/W=V_1D_Data iBin_qxqy_B 423 424 if(V_flag==0) 425 AppendtoGraph/W=V_1D_Data iBin_qxqy_B vs qBin_qxqy_B 426 ModifyGraph/W=V_1D_Data mode=4 427 ModifyGraph/W=V_1D_Data marker=19 428 ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_B)=(1,52428,52428) 429 ModifyGraph/W=V_1D_Data msize=2 430 ModifyGraph/W=V_1D_Data grid=1 431 ModifyGraph/W=V_1D_Data log=1 432 ModifyGraph/W=V_1D_Data mirror=2 433 endif 434 endif 435 436 //nothing different here since there is ony a single detector to display, but for the future... 437 if(binType==4) 438 439 CheckDisplayed/W=V_1D_Data iBin_qxqy_B 440 441 if(V_flag==0) 442 AppendtoGraph/W=V_1D_Data iBin_qxqy_B vs qBin_qxqy_B 443 ModifyGraph/W=V_1D_Data mode=4 444 ModifyGraph/W=V_1D_Data marker=19 445 ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_B)=(1,52428,52428) 446 ModifyGraph/W=V_1D_Data msize=2 447 ModifyGraph/W=V_1D_Data grid=1 448 ModifyGraph/W=V_1D_Data log=1 449 ModifyGraph/W=V_1D_Data mirror=2 450 endif 451 endif 452 453 454 SetDataFolder root: 455 End 456 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf
r982 r984 86 86 // 87 87 // TODO 88 // -- UNITS!!!! currently this is mm, which certainly doesn't match anything else!!! 88 89 // -- verify the direction of the tubes and indexing 89 90 // -- be sure I'm working in the right data folder … … 94 95 // -- do I want to make the distance array 3D to keep the x and y dims together? Calculate them all right now? 95 96 // -- what else do I need to pass to the function? (fname=folder? detStr?) 96 // 97 // -- need a separate block or function to handle "B" detector which will be ? different 97 98 // 98 99 // … … 107 108 Variable dimX,dimY 108 109 dimX = DimSize(dataW,0) 109 dimY = DimSize(data w,1)110 dimY = DimSize(dataW,1) 110 111 if(dimX > dimY) 111 112 orientation = "horizontal" … … 126 127 if(cmpstr(orientation,"vertical")==0) 127 128 // this is data dimensioned as (Ntubes,Npix) 129 data_realDistX[][] = tube_width*p 128 130 data_realDistY[][] = coefW[0][p] + coefW[1][p]*q + coefW[2][p]*q*q 129 130 data_realDistX[][] = tube_width*p 131 131 132 132 elseif(cmpstr(orientation,"horizontal")==0) 133 133 // this is data (horizontal) dimensioned as (Npix,Ntubes) 134 134 data_realDistX[][] = coefW[0][q] + coefW[1][q]*p + coefW[2][q]*p*p 135 136 135 data_realDistY[][] = tube_width*q 137 136 … … 142 141 return(0) 143 142 end 143 144 // TODO: 145 // -- the cal_x and y coefficients are totally fake 146 // -- the wave assignment may not be correct.. so beware 147 // 148 // 149 Function NonLinearCorrection_B(folder,detStr,destPath) 150 String folder,detStr,destPath 151 152 if(cmpstr(detStr,"B") != 0) 153 return(0) 154 endif 155 156 // do I count on the orientation as an input, or do I just figure it out on my own? 157 Variable dimX,dimY 158 159 Wave dataW = V_getDetectorDataW(folder,detStr) 160 161 dimX = DimSize(dataW,0) 162 dimY = DimSize(dataW,1) 163 164 // make a wave of the same dimensions, in the same data folder for the distance 165 // ?? or a 3D wave? 166 Make/O/D/N=(dimX,dimY) $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistX") 167 Make/O/D/N=(dimX,dimY) $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistY") 168 Wave data_realDistX = $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistX") 169 Wave data_realDistY = $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistY") 170 171 172 Wave cal_x = V_getDet_cal_x(folder,detStr) 173 Wave cal_y = V_getDet_cal_y(folder,detStr) 174 175 data_realDistX[][] = cal_x[0]*p 176 data_realDistY[][] = cal_y[0]*q 177 178 return(0) 179 end 180 181 182 // 183 // 184 // TODO 185 // -- VERIFY the calculations 186 // -- verify where this needs to be done (if the beam center is changed) 187 // -- then the q-calculation needs to be re-done 188 // -- the position along the tube length is referenced to tube[0], for no particular reason 189 // It may be better to take an average? but [0] is an ASSUMPTION 190 // -- distance along tube is simple interpolation, or do I use the coefficients to 191 // calculate the actual value 192 // 193 // -- distance in the lateral direction is based on tube width, which is well known 194 // 195 // 196 Function ConvertBeamCtr_to_mm(folder,detStr,destPath) 197 String folder,detStr,destPath 198 199 Wave data_realDistX = $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistX") 200 Wave data_realDistY = $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistY") 201 202 String orientation 203 Variable dimX,dimY,xCtr,yCtr 204 dimX = DimSize(data_realDistX,0) 205 dimY = DimSize(data_realDistX,1) 206 if(dimX > dimY) 207 orientation = "horizontal" 208 else 209 orientation = "vertical" 210 endif 211 212 xCtr = V_getDet_beam_center_x(folder,detStr) 213 yCtr = V_getDet_beam_center_y(folder,detStr) 214 215 Make/O/D/N=1 $(destPath + ":entry:entry:instrument:detector_"+detStr+":beam_center_x_mm") 216 Make/O/D/N=1 $(destPath + ":entry:entry:instrument:detector_"+detStr+":beam_center_y_mm") 217 WAVE x_mm = $(destPath + ":entry:entry:instrument:detector_"+detStr+":beam_center_x_mm") 218 WAVE y_mm = $(destPath + ":entry:entry:instrument:detector_"+detStr+":beam_center_y_mm") 219 220 Variable tube_width = V_getDet_tubeWidth(folder,detStr) 221 222 // 223 if(cmpstr(orientation,"vertical")==0) 224 // this is data dimensioned as (Ntubes,Npix) 225 // data_realDistX[][] = tube_width*p 226 // data_realDistY[][] = coefW[0][p] + coefW[1][p]*q + coefW[2][p]*q*q 227 x_mm[0] = tube_width*xCtr 228 y_mm[0] = data_realDistY[0][yCtr] 229 else 230 // this is data (horizontal) dimensioned as (Npix,Ntubes) 231 // data_realDistX[][] = coefW[0][q] + coefW[1][q]*p + coefW[2][q]*p*p 232 // data_realDistY[][] = tube_width*q 233 x_mm[0] = data_realDistX[xCtr][0] 234 y_mm[0] = tube_width*yCtr 235 endif 236 237 return(0) 238 end 239 240 241 // 242 // 243 // TODO 244 // -- VERIFY the calculations 245 // -- verify where this needs to be done (if the beam center is changed) 246 // -- then the q-calculation needs to be re-done 247 // -- the position along the tube length is referenced to tube[0], for no particular reason 248 // It may be better to take an average? but [0] is an ASSUMPTION 249 // -- distance along tube is simple interpolation 250 // 251 // -- distance in the lateral direction is based on tube width, which is well known 252 // 253 // 254 Function ConvertBeamCtr_to_mmB(folder,detStr,destPath) 255 String folder,detStr,destPath 256 257 Wave data_realDistX = $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistX") 258 Wave data_realDistY = $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistY") 259 260 Variable xCtr,yCtr 261 xCtr = V_getDet_beam_center_x(folder,detStr) 262 yCtr = V_getDet_beam_center_y(folder,detStr) 263 264 Make/O/D/N=1 $(destPath + ":entry:entry:instrument:detector_"+detStr+":beam_center_x_mm") 265 Make/O/D/N=1 $(destPath + ":entry:entry:instrument:detector_"+detStr+":beam_center_y_mm") 266 WAVE x_mm = $(destPath + ":entry:entry:instrument:detector_"+detStr+":beam_center_x_mm") 267 WAVE y_mm = $(destPath + ":entry:entry:instrument:detector_"+detStr+":beam_center_y_mm") 268 269 x_mm[0] = data_realDistX[xCtr][0] 270 y_mm[0] = data_realDistY[0][yCtr] 271 272 return(0) 273 end 274 275 276 277 144 278 145 279 … … 226 360 endfor 227 361 362 // now fake calibration for "B" 363 Wave cal_x = V_getDet_cal_x("RAW","B") 364 Wave cal_y = V_getDet_cal_y("RAW","B") 365 366 cal_x = 1 // mm, ignore the other 2 values 367 cal_y = 1 // mm 228 368 return(0) 229 369 End 230 370 231 232 371 // 372 // data_realDistX, Y must be previously generated from running NonLinearCorrection() 373 // 374 // call with: 375 // fname as the WORK folder, "RAW" 376 // detStr = detector String, "FL" 377 // destPath = path to destination WORK folder ("root:Packages:NIST:VSANS:"+folder) 378 // 233 379 Function V_Detector_CalcQVals(fname,detStr,destPath) 234 380 String fname,detStr,destPath … … 240 386 orientation = V_getDet_tubeOrientation(fname,detStr) 241 387 sdd = V_getDet_distance(fname,detStr) 242 xCtr = V_getDet_beam_center_x(fname,detStr) 243 yCtr = V_getDet_beam_center_y(fname,detStr) 388 sdd/=100 // sdd reported in cm, pass in m 389 // this is the ctr in pixels 390 // xCtr = V_getDet_beam_center_x(fname,detStr) 391 // yCtr = V_getDet_beam_center_y(fname,detStr) 392 // this is ctr in mm 393 xCtr = V_getDet_beam_center_x_mm(fname,detStr) 394 yCtr = V_getDet_beam_center_y_mm(fname,detStr) 244 395 lambda = V_getWavelength(fname) 245 396 Wave data_realDistX = $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistX") … … 271 422 // TODO: 272 423 // -- verify the calculation (accuracy - in all input conditions) 273 // -- verify the units of everything here, it's currently all jumbled an wrong...424 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated 274 425 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 275 426 // to each pixel … … 287 438 288 439 sdd *=100 //convert to cm 289 dx = (distX[xaxval][yaxval] - xctr) //delta x in cm290 dy = (distY[xaxval][yaxval] - yctr) //delta y in cm440 dx = (distX[xaxval][yaxval] - xctr) //delta x in mm 441 dy = (distY[xaxval][yaxval] - yctr) //delta y in mm 291 442 dist = sqrt(dx^2 + dy^2) 292 443 444 dist /= 10 // convert mm to cm 445 293 446 two_theta = atan(dist/sdd) 294 447 … … 301 454 // TODO: 302 455 // -- verify the calculation (accuracy - in all input conditions) 303 // -- verify the units of everything here, it's currently all jumbled an wrong...456 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated 304 457 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 305 458 // to each pixel … … 317 470 318 471 sdd *=100 //convert to cm 319 dx = (distX[xaxval][yaxval] - xctr) //delta x in cm320 dy = (distY[xaxval][yaxval] - yctr) //delta y in cm472 dx = (distX[xaxval][yaxval] - xctr) //delta x in mm 473 dy = (distY[xaxval][yaxval] - yctr) //delta y in mm 321 474 phi = V_FindPhi(dx,dy) 322 475 323 476 //get scattering angle to project onto flat detector => Qr = qval*cos(theta) 324 477 dist = sqrt(dx^2 + dy^2) 478 dist /= 10 // convert mm to cm 479 325 480 two_theta = atan(dist/sdd) 326 481 … … 333 488 // TODO: 334 489 // -- verify the calculation (accuracy - in all input conditions) 335 // -- verify the units of everything here, it's currently all jumbled an wrong...490 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated 336 491 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 337 492 // to each pixel … … 349 504 350 505 sdd *=100 //convert to cm 351 dx = (distX[xaxval][yaxval] - xctr) //delta x in cm352 dy = (distY[xaxval][yaxval] - yctr) //delta y in cm506 dx = (distX[xaxval][yaxval] - xctr) //delta x in mm 507 dy = (distY[xaxval][yaxval] - yctr) //delta y in mm 353 508 phi = V_FindPhi(dx,dy) 354 509 355 510 //get scattering angle to project onto flat detector => Qr = qval*cos(theta) 356 511 dist = sqrt(dx^2 + dy^2) 512 dist /= 10 // convert mm to cm 513 357 514 two_theta = atan(dist/sdd) 358 515 … … 365 522 // TODO: 366 523 // -- verify the calculation (accuracy - in all input conditions) 367 // -- verify the units of everything here, it's currently all jumbled an wrong...524 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated 368 525 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 369 526 // to each pixel … … 382 539 383 540 sdd *=100 //convert to cm 384 dx = (distX[xaxval][yaxval] - xctr) //delta x in cm385 dy = (distY[xaxval][yaxval] - yctr) //delta y in cm541 dx = (distX[xaxval][yaxval] - xctr) //delta x in mm 542 dy = (distY[xaxval][yaxval] - yctr) //delta y in mm 386 543 387 544 //get scattering angle to project onto flat detector => Qr = qval*cos(theta) 388 545 dist = sqrt(dx^2 + dy^2) 546 dist /= 10 // convert mm to cm 547 389 548 two_theta = atan(dist/sdd) 390 549 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_RW_Utils.ipf
r983 r984 40 40 // 41 41 // TODO: -- is there an extra "entry" heading? Am I adding this by mistake by setting base_name="entry" for RAW data? 42 // -- as dumb as it is -- do I just leave it now, or break everything. ont the plus side, removing the extra entry42 // -- as dumb as it is -- do I just leave it now, or break everything. On the plus side, removing the extra "entry" 43 43 // layer may catch a lot of the hard-wired junk that is present... 44 44 Function V_LoadHDF5Data(file,folder) … … 109 109 NonLinearCorrection(w,w_calib,tube_width,detStr,destPath) 110 110 111 112 //(2.4) Convert the beam center values from pixels to mm 113 // TODO -- there needs to be a permanent location for these values?? 114 // 115 ConvertBeamCtr_to_mm(folder,detStr,destPath) 116 111 117 // (2.5) Calculate the q-values 112 118 // calculating q-values can't be done unless the non-linear corrections are calculated … … 122 128 123 129 endfor 130 131 //"B" is separate 132 NonLinearCorrection_B(folder,"B",destPath) 133 ConvertBeamCtr_to_mmB(folder,"B",destPath) 134 V_Detector_CalcQVals(folder,"B",destPath) 135 124 136 else 125 137 Print "Non-linear correction not done" … … 157 169 det_B=tmpw 158 170 det_B += 2 171 Wave distance=distance 172 distance = 2200 173 159 174 160 175 Variable ctr=20,npix=128 … … 170 185 det_MT=tmpw 171 186 det_MT += 2 187 Wave distance=distance 188 distance = 1030 189 172 190 173 191 SetDataFolder root:Packages:NIST:VSANS:RAW:entry:entry:instrument:detector_MB … … 182 200 det_MB=tmpw 183 201 det_MB += 2 202 Wave distance=distance 203 distance = 1030 204 184 205 185 206 ctr=30 … … 195 216 det_ML=tmpw 196 217 det_ML += 2 218 Wave distance=distance 219 distance = 1000 220 197 221 198 222 SetDataFolder root:Packages:NIST:VSANS:RAW:entry:entry:instrument:detector_MR … … 206 230 det_MR=tmpw 207 231 det_MR += 2 232 Wave distance=distance 233 distance = 1000 234 208 235 209 236 ctr=30 … … 216 243 wave tmpw=$"root:Packages:NIST:VSANS:VCALC:entry:entry:instrument:detector_FT:det_FT" 217 244 det_FT=tmpw 245 Wave distance=distance 246 distance = 180 247 218 248 219 249 SetDataFolder root:Packages:NIST:VSANS:RAW:entry:entry:instrument:detector_FB … … 225 255 wave tmpw=$"root:Packages:NIST:VSANS:VCALC:entry:entry:instrument:detector_FB:det_FB" 226 256 det_FB=tmpw 257 Wave distance=distance 258 distance = 180 259 227 260 228 261 SetDataFolder root:Packages:NIST:VSANS:RAW:entry:entry:instrument:detector_FL … … 234 267 wave tmpw=$"root:Packages:NIST:VSANS:VCALC:entry:entry:instrument:detector_FL:det_FL" 235 268 det_FL=tmpw 269 Wave distance=distance 270 distance = 150 271 236 272 237 273 SetDataFolder root:Packages:NIST:VSANS:RAW:entry:entry:instrument:detector_FR … … 243 279 wave tmpw=$"root:Packages:NIST:VSANS:VCALC:entry:entry:instrument:detector_FR:det_FR" 244 280 det_FR=tmpw 281 Wave distance=distance 282 distance = 150 283 245 284 246 285 // get rid of zeros … … 250 289 det_FB += 2 251 290 252 V_RescaleToBeamCenter("RAW","MB",64,55) 253 V_RescaleToBeamCenter("RAW","MT",64,-8.7) 254 V_RescaleToBeamCenter("RAW","MR",-8.1,64) 255 V_RescaleToBeamCenter("RAW","ML",55,64) 256 V_RescaleToBeamCenter("RAW","FL",55,64) 257 V_RescaleToBeamCenter("RAW","FR",-8.1,64) 258 V_RescaleToBeamCenter("RAW","FT",64,-8.7) 259 V_RescaleToBeamCenter("RAW","FB",64,55) 291 292 // fake beam center values 293 V_putDet_beam_center_x("RAW","B",160) 294 V_putDet_beam_center_y("RAW","B",160) 295 296 297 V_putDet_beam_center_x("RAW","MB",64) 298 V_putDet_beam_center_y("RAW","MB",55) 299 V_putDet_beam_center_x("RAW","MT",64) 300 V_putDet_beam_center_y("RAW","MT",-8.7) 301 V_putDet_beam_center_x("RAW","MR",-8.1) 302 V_putDet_beam_center_y("RAW","MR",64) 303 V_putDet_beam_center_x("RAW","ML",55) 304 V_putDet_beam_center_y("RAW","ML",64) 305 306 V_putDet_beam_center_x("RAW","FB",64) 307 V_putDet_beam_center_y("RAW","FB",55) 308 V_putDet_beam_center_x("RAW","FT",64) 309 V_putDet_beam_center_y("RAW","FT",-8.7) 310 V_putDet_beam_center_x("RAW","FR",-8.1) 311 V_putDet_beam_center_y("RAW","FR",64) 312 V_putDet_beam_center_x("RAW","FL",55) 313 V_putDet_beam_center_y("RAW","FL",64) 314 315 316 317 318 319 320 V_RescaleToBeamCenter("RAW","MB",64,55) 321 V_RescaleToBeamCenter("RAW","MT",64,-8.7) 322 V_RescaleToBeamCenter("RAW","MR",-8.1,64) 323 V_RescaleToBeamCenter("RAW","ML",55,64) 324 V_RescaleToBeamCenter("RAW","FL",55,64) 325 V_RescaleToBeamCenter("RAW","FR",-8.1,64) 326 V_RescaleToBeamCenter("RAW","FT",64,-8.7) 327 V_RescaleToBeamCenter("RAW","FB",64,55) 260 328 261 329 … … 269 337 // this will load in the whole HDF file all at once. 270 338 // Attributes are NOT loaded at all. 339 // 340 // -- the Gateway function H5GW_ReadHDF5(parentFolder, fileName, [hdf5Path]) 341 // reads in the attributes too, but is very slow 342 // -- the H5GW function is called by: H_HDF5Gate_Read_Raw(file) 271 343 // 272 344 // TODO: … … 275 347 // -- be sure I'm using all of the correct flags in the HDF5LoadGroup operation 276 348 // -- settle on how the base_name is to be used. "entry" for the RAW, fileName for the "rawVSANS"? 349 // x- error check for path existence 277 350 // 278 351 // passing in "" for base_name will take the name from the file name as selected … … 284 357 // hdf5Path = "/" 285 358 // endif 359 360 PathInfo/S catPathName 361 if(V_flag == 0) 362 V_PickPath() 363 endif 286 364 287 365 String hdf5path = "/" //always read from the top -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf
r981 r984 1070 1070 // only defined for the "B" detector, and may not be necessary? 1071 1071 // TODO -- write to return an ARRAY 1072 Function V_getDet_cal_x(fname,detStr,outW) 1073 String fname,detStr 1074 Wave outW 1072 Function/WAVE V_getDet_cal_x(fname,detStr) 1073 String fname,detStr 1075 1074 1076 1075 if(cmpstr(detStr,"B") == 0) … … 1078 1077 WAVE w = V_getRealWaveFromHDF5(fname,path) 1079 1078 1080 outW = w 1081 return(0) 1079 return w 1082 1080 else 1083 return (0)1081 return $"" 1084 1082 endif 1085 1083 End … … 1087 1085 // only defined for the "B" detector, and may not be necessary? 1088 1086 // TODO -- write to return an ARRAY 1089 Function V_getDet_cal_y(fname,detStr,outW) 1090 String fname,detStr 1091 Wave outW 1087 Function/WAVE V_getDet_cal_y(fname,detStr) 1088 String fname,detStr 1092 1089 1093 1090 if(cmpstr(detStr,"B") == 0) … … 1095 1092 WAVE w = V_getRealWaveFromHDF5(fname,path) 1096 1093 1097 outW = w 1098 return(0) 1094 return w 1099 1095 else 1100 return (0)1096 return $"" 1101 1097 endif 1102 1098 End … … 1173 1169 return(V_getRealValueFromHDF5(fname,path)) 1174 1170 End 1171 1172 1173 //TODO 1174 // 1175 // x and y center in mm is currently not part of the NExus definition 1176 // does it need to be? 1177 // these lookups will fail if they have not been generated locally! 1178 1179 Function V_getDet_beam_center_x_mm(fname,detStr) 1180 String fname,detStr 1181 1182 String path = "entry:instrument:detector_"+detStr+":beam_center_x_mm" 1183 return(V_getRealValueFromHDF5(fname,path)) 1184 End 1185 1186 //TODO 1187 // 1188 // x and y center in mm is currently not part of the NExus definition 1189 // does it need to be? 1190 // these lookups will fail if they have not been generated locally! 1191 1192 Function V_getDet_beam_center_y_mm(fname,detStr) 1193 String fname,detStr 1194 1195 String path = "entry:instrument:detector_"+detStr+":beam_center_y_mm" 1196 return(V_getRealValueFromHDF5(fname,path)) 1197 End 1198 1199 1175 1200 1176 1201 // TODO -- write this function to return a WAVE with the data -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MainPanel.ipf
r982 r984 122 122 End 123 123 124 Proc FitRPA_MainButtonProc(ctrlName) : ButtonControl125 String ctrlName126 127 OpenFITRPAPanel()128 End124 //Proc FitRPA_MainButtonProc(ctrlName) : ButtonControl 125 // String ctrlName 126 // 127 // OpenFITRPAPanel() 128 //End 129 129 130 130 Proc Subtract1D_MainButtonProc(ctrlName) : ButtonControl … … 352 352 Button MainButton_2c,pos={15,150},size={60,20},proc=Fit1D_MainButtonProc,title="FIT" 353 353 Button MainButton_2c,help={"Shows panel for performing a variety of linearized fits to 1-D data files. Use \"Plot\" button to import 1-D data files"} 354 Button MainButton_2d,pos={15,180},size={60,20},proc=FITRPA_MainButtonProc,title="FIT/RPA"355 Button MainButton_2d,help={"Shows panel for performing a fit to a polymer standard."}354 // Button MainButton_2d,pos={15,180},size={60,20},proc=FITRPA_MainButtonProc,title="FIT/RPA" 355 // Button MainButton_2d,help={"Shows panel for performing a fit to a polymer standard."} 356 356 // Button MainButton_2e,pos={120,90},size={90,20},proc=Subtract1D_MainButtonProc,title="Subtract 1D" 357 357 // Button MainButton_2e,help={"Shows panel for subtracting two 1-D data sets"} … … 363 363 Button MainButton_2b,disable=1 364 364 Button MainButton_2c,disable=1 365 Button MainButton_2d,disable=1365 // Button MainButton_2d,disable=1 366 366 Button MainButton_2e,disable=1 367 367 Button MainButton_2f,disable=1 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Menu.ipf
r982 r984 24 24 End 25 25 End 26 27 26 28 27 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Test_RAW_Panel.ipf
r983 r984 336 336 // TODO: beam center XY are pixels in the file, expected in the function, but are better suited for mm or cm 337 337 // TODO: units of xy pixel size are likely wrong 338 xctr = V_getDet_beam_center_x(gCurDispType,detStr) //written in pixels 339 yctr = V_getDet_beam_center_y(gCurDispType,detStr) 338 // xctr = V_getDet_beam_center_x(gCurDispType,detStr) //written in pixels 339 // yctr = V_getDet_beam_center_y(gCurDispType,detStr) 340 xctr = V_getDet_beam_center_x_mm(gCurDispType,detStr) //written in mm 341 yctr = V_getDet_beam_center_y_mm(gCurDispType,detStr) 342 340 343 sdd = V_getDet_distance(gCurDispType,detStr) / 100 //written in cm, pass in meters 341 344 lam = V_getVSWavelength(gCurDispType) //A 342 pixSizeX = V_getDet_x_pixel_size(gCurDispType,detStr)/10 // written mm? need cm343 pixSizeY = V_getDet_y_pixel_size(gCurDispType,detStr)/10 // written mm? need cm345 // pixSizeX = V_getDet_x_pixel_size(gCurDispType,detStr) // written mm? need mm 346 // pixSizeY = V_getDet_y_pixel_size(gCurDispType,detStr) // written mm? need mm 344 347 // 345 348 // TODO: these q-values ignore the non-linear corrections!!! 346 // -- What can I do about this? 349 // -- What can I do about this? 350 String destPath = "root:Packages:NIST:VSANS:"+gCurDispType 351 Wave data_realDistX = $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistX") 352 Wave data_realDistY = $(destPath + ":entry:entry:instrument:detector_"+detStr+":data_realDistY") 353 347 354 // TODO: figure out what coordinates I need to pass -- xloc, yloc, textX, testY, (+1 on any?) 348 gQQ = VC_CalcQval(testX,testY,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 349 gQX = VC_CalcQX(testX,testY,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 350 gQY = VC_CalcQY(testX,testY,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 355 //gQQ = VC_CalcQval(testX,testY,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 356 //gQX = VC_CalcQX(testX,testY,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 357 //gQY = VC_CalcQY(testX,testY,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 358 gQQ = V_CalcQval(testX,testY,xctr,yctr,sdd,lam,data_realDistX,data_realDistY) 359 gQX = V_CalcQX(testX,testY,xctr,yctr,sdd,lam,data_realDistX,data_realDistY) 360 gQY = V_CalcQY(testX,testY,xctr,yctr,sdd,lam,data_realDistX,data_realDistY) 351 361 352 362 ii = -1 //look no further, set ii to bad value to exit the for loop -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WorkFolderUtils.ipf
r982 r984 432 432 Variable tube_width = V_getDet_tubeWidth(fname,detStr) 433 433 NonLinearCorrection(w,w_calib,tube_width,detStr,destPath) 434 434 435 //(2.4) Convert the beam center values from pixels to mm 436 // TODO -- there needs to be a permanent location for these values?? 437 // 438 ConvertBeamCtr_to_mm(fname,detStr,destPath) 439 435 440 // (2.5) Calculate the q-values 436 441 // calculating q-values can't be done unless the non-linear corrections are calculated … … 446 451 447 452 endfor 453 454 //"B" is separate 455 NonLinearCorrection_B(fname,"B",destPath) 456 ConvertBeamCtr_to_mmB(fname,"B",destPath) 457 V_Detector_CalcQVals(fname,"B",destPath) 458 448 459 else 449 460 Print "Non-linear correction not done"
Note: See TracChangeset
for help on using the changeset viewer.