Changeset 1064
- Timestamp:
- Sep 18, 2017 12:08:50 PM (5 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Utils.ipf
r1062 r1064 1360 1360 1361 1361 // TODO: 1362 // -- is this where I do the resolution calculation? This is where I calculate the resolution in SANS (see CircSectAve) 1363 // -- or do I do it as a separate call? 1362 // -- This is where I calculate the resolution in SANS (see CircSectAve) 1364 1363 // -- use the isVCALC flag to exclude VCALC from the resolution calculation if necessary 1364 // -- from the top of the function, folderStr = work folder, type = "FLRTB" or other type of averaging 1365 1365 // 1366 nq = numpnts(qBin_qxqy) 1367 Make/O/D/N=(nq) $(folderPath+":"+"sigmaQ_qxqy"+"_"+type) 1368 Make/O/D/N=(nq) $(folderPath+":"+"qBar_qxqy"+"_"+type) 1369 Make/O/D/N=(nq) $(folderPath+":"+"fSubS_qxqy"+"_"+type) 1370 Wave sigmaq = $(folderPath+":"+"sigmaQ_qxqy_"+type) 1371 Wave qbar = $(folderPath+":"+"qBar_qxqy_"+type) 1372 Wave fsubs = $(folderPath+":"+"fSubS_qxqy_"+type) 1373 1374 1375 Variable ret1,ret2,ret3 1376 Variable lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses 1377 1378 // TODO: check the units of all of the inputs 1379 1380 // lambda = wavelength [A] 1381 lambda = V_getWavelength(folderStr) 1382 1383 // lambdaWidth = [dimensionless] 1384 lambdaWidth = V_getWavelength_spread(folderStr) 1385 1386 // DDet = detector pixel resolution [cm] **assumes square pixel 1387 DDet = 0.8 // TODO -- this is hard-wired 1388 1389 // apOff = sample aperture to sample distance [cm] 1390 apOff = 10 // TODO -- this is hard-wired 1391 1392 // S1 = source aperture diameter [mm] 1393 S1 = str2num(V_getSourceAp_size(folderStr)) 1394 1395 // S2 = sample aperture diameter [mm] 1396 S2 = V_getSampleAp2_size(folderStr)*10 // sample ap 1 or 2? the "external" may not exist? 1397 1398 // L1 = source to sample distance [m] 1399 L1 = V_getSourceAp_distance(folderStr)/100 1400 1401 // L2 = sample to detector distance [m] 1402 L2 = V_getDet_ActualDistance(folderStr,type[0]+"L")/100 //TODO "L" panel is hard wired and is WRONG 1403 1404 // BS = beam stop diameter [mm] 1405 //BS = V_getBeamStopC2_size(folderStr) // TODO: what are the units? which BS is in? carr2, carr3, back, none? 1406 BS = 25.4 //TODO hard-wired value 1407 1408 // del_r = step size [mm] = binWidth*(mm/pixel) 1409 del_r = 1*8 // TODO: 8mm/pixel hard-wired 1410 1411 // usingLenses = flag for lenses = 0 if no lenses, non-zero if lenses are in-beam 1412 usingLenses = 0 1413 1414 1415 Print "Resolution lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses" 1416 Print lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses 1417 1418 ii=0 1419 do 1420 V_getResolution(qBin_qxqy[ii],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,ret1,ret2,ret3) 1421 sigmaq[ii] = ret1 1422 qbar[ii] = ret2 1423 fsubs[ii] = ret3 1424 ii+=1 1425 while(ii<nq) 1366 1426 1367 1427 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VSANS_Includes.ipf
r1060 r1064 102 102 #include "V_Instrument_Resolution" 103 103 #include "V_IQ_Annular" 104 #include "V_Write_VSANS_QIS" 104 105 105 106 106 107 108 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_BeamCenter.ipf
r1055 r1064 561 561 // the calculation of q-values. 562 562 // 563 // 563 564 // TODO 564 565 // -- some of this is hard-wired in … … 606 607 end 607 608 609 // This sets the scale of the data panels to an approximate detector coordinate system with 610 // zero at the center, only for display purposes. It is not exact, and has nothing to do with 611 // the calculation of q-values. 612 // 613 // ****For the panel display, the scaling MUST be in PIXELS for the readout and calculations to be correct. 614 // the read out needs pixels, and the calculations use the pixels as the indexes for the real-space (mm) values 615 // 616 // Since I'll only know the beam center in mm, and I'll need the relative panel positions to convert to pixels, 617 // can I display the panels in their pixel locations relative to each other, based on a zero center and 618 // the panel offset values? 619 // 620 // 621 // TODO 622 // -- some of this is hard-wired in 623 // -- this is still all in terms of pixels, which still may not be what I want 624 // -- the x-scale of the T/B panels is artificially compressed to "fake" 4mm per pixel in x-direction 625 // 626 // Nominal center is 0,0 627 // 628 Function V_RescaleToNominalCenter(folderStr,detStr,xCtr,yCtr) 629 String folderStr,detStr 630 Variable xCtr,yCtr 631 632 // xCtr = 0 633 // yCtr = 0 634 635 Wave w = $("root:Packages:NIST:VSANS:"+folderStr+":entry:instrument:detector_"+detStr+":data") 636 637 Variable nPix = 128 638 Variable nTubes = 48 639 Variable offset = 0 640 Variable pixSizeX,pixSizeY 641 642 strswitch(detStr) // string switch 643 case "MT": // top panels 644 case "FT": 645 // SetScale/I x -xCtr,npix-xCtr,"",w 646 offset = V_getDet_VerticalOffset(folderStr,detStr) //in cm 647 pixSizeY = 0.84 648 yCtr = -(offset/pixSizeY) 649 650 SetScale/I x -xCtr/2,(npix-xCtr)/2,"",w // fake 4mm by compressing the scale 651 SetScale/I y -yCtr,nTubes-yCtr,"",w 652 break // exit from switch 653 case "MB": // bottom panels 654 case "FB": 655 // SetScale/I x -xCtr,npix-xCtr,"",w 656 657 offset = V_getDet_VerticalOffset(folderStr,detStr) //in cm 658 pixSizeY = 0.84 659 yCtr = nTubes-(offset/pixSizeY) 660 661 SetScale/I x -xCtr/2,(npix-xCtr)/2,"",w 662 SetScale/I y -yCtr,nTubes-yCtr,"",w 663 break // exit from switch 664 665 case "ML": // left panels 666 case "FL": 667 offset = V_getDet_LateralOffset(folderStr,detStr) //in cm 668 pixSizeX = 0.84 669 xCtr = nTubes-(offset/pixSizeX) 670 671 SetScale/I x -xCtr,nTubes-xCtr,"",w 672 SetScale/I y -yCtr,npix-yCtr,"",w 673 break // exit from switch 674 case "MR": // Right panels 675 case "FR": 676 offset = V_getDet_LateralOffset(folderStr,detStr) //in cm 677 pixSizeX = 0.84 678 xCtr = -(offset/pixSizeX) 679 680 SetScale/I x -xCtr,nTubes-xCtr,"",w 681 SetScale/I y -yCtr,npix-yCtr,"",w 682 break // exit from switch 683 684 default: // optional default expression executed 685 Print "Error in V_RescaleToBeamCenter()" 686 endswitch 687 688 return(0) 689 end 690 691 608 692 // TODO 609 693 // these are "nominal" beam center values in pixels for the default VCALC configuration … … 641 725 xCtr = V_getDet_beam_center_x_pix(fname,detStr) 642 726 yCtr = V_getDet_beam_center_y_pix(fname,detStr) 643 V_RescaleToBeamCenter(type,detStr,xCtr,yCtr) 727 // V_RescaleToBeamCenter(type,detStr,xCtr,yCtr) 728 V_RescaleToNominalCenter(type,detStr,xCtr,yCtr) // xCtr or yCtr value in direction of offset are dummy values here 644 729 endfor 645 730 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_FileCatalog.ipf
r1063 r1064 236 236 V_SortWaves() 237 237 //Append the files that are not raw files to the list 238 238 239 V_AppendNotRAWFiles(notRAWlist) 239 240 KillWaves/Z notRAWlist 240 241 // 241 242 Print "Total time (s) = ",(ticks - t1)/60.15 242 Print "Time per raw data file (without cleanup time) (s) = ",( (ticks - t1)/60.15 - cleanupTime)/(num Items-numpnts(labels))243 Print "Time per raw data file (without cleanup time) (s) = ",( (ticks - t1)/60.15 - cleanupTime)/(numpnts(labels)) 243 244 // (don't use numpnts(notRawList) to normalize, these aren't all raw data files) 244 245 // … … 324 325 //for display in the table. Note that the filenames column will now be longer than all other 325 326 //waves in the table 327 // 328 // skip this step if there are no files to tack on 326 329 Function V_AppendNotRAWFiles(w) 327 330 Wave/T w 328 Wave/T Filenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames" 329 Variable lastPoint 330 lastPoint = numpnts(Filenames) 331 InsertPoints lastPoint,numpnts(w),Filenames 332 Filenames[lastPoint,numpnts(Filenames)-1] = w[p-lastPoint] 331 if(numpnts(w) != 0) 332 Wave/T Filenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames" 333 Variable lastPoint 334 lastPoint = numpnts(Filenames) 335 InsertPoints lastPoint,numpnts(w),Filenames 336 Filenames[lastPoint,numpnts(Filenames)-1] = w[p-lastPoint] 337 endif 333 338 return(0) 334 339 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Utilities.ipf
r1057 r1064 167 167 // SetDataFolder $("root:Packages:NIST:VSANS:"+type) 168 168 SetDataFolder $(pathStr+type) 169 Killwaves/Z tmp_q,tmp_i,tmp_s 169 Killwaves/Z tmp_q,tmp_i,tmp_s,tmp_sq,tmp_qb,tmp_fs 170 170 setDataFolder root: 171 171 V_1DConcatenate(pathStr,type,tagStr,binType) … … 222 222 WAVE/Z iBin2 = iBin2_qxqy_B 223 223 224 // resolution waves 225 Wave/Z sigQ = sigmaQ_qxqy_B 226 Wave/Z qBar = qBar_qxqy_B 227 Wave/Z fSubS = fSubS_qxqy_B 228 224 229 if(qBin[0] == 0) 225 DeletePoints 0, 1, qBin,iBin,eBin,nBin,iBin2 230 DeletePoints 0, 1, qBin,iBin,eBin,nBin,iBin2,sigQ,qBar,fSubS 226 231 endif 227 232 … … 273 278 274 279 //kill these waves before starting, or the new concatenation will be added to the old 275 KillWaves/Z tmp_q,tmp_i,tmp_s 280 KillWaves/Z tmp_q,tmp_i,tmp_s,tmp_qb,tmp_sq,tmp_fs 276 281 277 282 NVAR gIgnoreDetB = root:Packages:NIST:VSANS:Globals:gIgnoreDetB … … 330 335 331 336 Concatenate/NP/O waveListStr, tmp_s 337 338 //sigma Q 339 waveListStr="" 340 if(!gIgnoreDetB) 341 waveListStr = "sigmaQ_qxqy_B" + tagStr + ";" 342 endif 343 waveListStr += "sigmaQ_qxqy_MB" + tagStr + ";" 344 waveListStr += "sigmaQ_qxqy_MT" + tagStr + ";" 345 waveListStr += "sigmaQ_qxqy_ML" + tagStr + ";" 346 waveListStr += "sigmaQ_qxqy_MR" + tagStr + ";" 347 waveListStr += "sigmaQ_qxqy_FB" + tagStr + ";" 348 waveListStr += "sigmaQ_qxqy_FT" + tagStr + ";" 349 waveListStr += "sigmaQ_qxqy_FL" + tagStr + ";" 350 waveListStr += "sigmaQ_qxqy_FR" + tagStr + ";" 351 // waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MB;sigmaQ_qxqy_MT;sigmaQ_qxqy_ML;sigmaQ_qxqy_MR;" 352 // waveListStr += "sigmaQ_qxqy_FB;sigmaQ_qxqy_FT;sigmaQ_qxqy_FL;sigmaQ_qxqy_FR;" 353 354 Concatenate/NP/O waveListStr, tmp_sq 355 356 //Q bar 357 waveListStr="" 358 if(!gIgnoreDetB) 359 waveListStr = "qBar_qxqy_B" + tagStr + ";" 360 endif 361 waveListStr += "qBar_qxqy_MB" + tagStr + ";" 362 waveListStr += "qBar_qxqy_MT" + tagStr + ";" 363 waveListStr += "qBar_qxqy_ML" + tagStr + ";" 364 waveListStr += "qBar_qxqy_MR" + tagStr + ";" 365 waveListStr += "qBar_qxqy_FB" + tagStr + ";" 366 waveListStr += "qBar_qxqy_FT" + tagStr + ";" 367 waveListStr += "qBar_qxqy_FL" + tagStr + ";" 368 waveListStr += "qBar_qxqy_FR" + tagStr + ";" 369 // waveListStr = "qBar_qxqy_B;qBar_qxqy_MB;qBar_qxqy_MT;qBar_qxqy_ML;qBar_qxqy_MR;" 370 // waveListStr += "qBar_qxqy_FB;qBar_qxqy_FT;qBar_qxqy_FL;qBar_qxqy_FR;" 371 372 Concatenate/NP/O waveListStr, tmp_qb 373 374 //shadow fs 375 waveListStr="" 376 if(!gIgnoreDetB) 377 waveListStr = "fSubS_qxqy_B" + tagStr + ";" 378 endif 379 waveListStr += "fSubS_qxqy_MB" + tagStr + ";" 380 waveListStr += "fSubS_qxqy_MT" + tagStr + ";" 381 waveListStr += "fSubS_qxqy_ML" + tagStr + ";" 382 waveListStr += "fSubS_qxqy_MR" + tagStr + ";" 383 waveListStr += "fSubS_qxqy_FB" + tagStr + ";" 384 waveListStr += "fSubS_qxqy_FT" + tagStr + ";" 385 waveListStr += "fSubS_qxqy_FL" + tagStr + ";" 386 waveListStr += "fSubS_qxqy_FR" + tagStr + ";" 387 // waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MB;fSubS_qxqy_MT;fSubS_qxqy_ML;fSubS_qxqy_MR;" 388 // waveListStr += "fSubS_qxqy_FB;fSubS_qxqy_FT;fSubS_qxqy_FL;fSubS_qxqy_FR;" 389 390 Concatenate/NP/O waveListStr, tmp_fs 391 332 392 endif 333 393 … … 377 437 378 438 Concatenate/NP/O waveListStr, tmp_s 439 440 // sigma Q 441 waveListStr="" 442 if(!gIgnoreDetB) 443 waveListStr = "sigmaQ_qxqy_B" + tagStr + ";" 444 endif 445 waveListStr += "sigmaQ_qxqy_MTB" + tagStr + ";" 446 waveListStr += "sigmaQ_qxqy_MLR" + tagStr + ";" 447 waveListStr += "sigmaQ_qxqy_FTB" + tagStr + ";" 448 waveListStr += "sigmaQ_qxqy_FLR" + tagStr + ";" 449 450 // waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MTB;sigmaQ_qxqy_MLR;" 451 // waveListStr += "sigmaQ_qxqy_FTB;sigmaQ_qxqy_FLR;" 452 453 Concatenate/NP/O waveListStr, tmp_sq 454 455 // Q bar 456 waveListStr="" 457 if(!gIgnoreDetB) 458 waveListStr = "qBar_qxqy_B" + tagStr + ";" 459 endif 460 waveListStr += "qBar_qxqy_MTB" + tagStr + ";" 461 waveListStr += "qBar_qxqy_MLR" + tagStr + ";" 462 waveListStr += "qBar_qxqy_FTB" + tagStr + ";" 463 waveListStr += "qBar_qxqy_FLR" + tagStr + ";" 464 465 // waveListStr = "qBar_qxqy_B;qBar_qxqy_MTB;qBar_qxqy_MLR;" 466 // waveListStr += "qBar_qxqy_FTB;qBar_qxqy_FLR;" 467 468 Concatenate/NP/O waveListStr, tmp_qb 469 470 // shadow fs 471 waveListStr="" 472 if(!gIgnoreDetB) 473 waveListStr = "fSubS_qxqy_B" + tagStr + ";" 474 endif 475 waveListStr += "fSubS_qxqy_MTB" + tagStr + ";" 476 waveListStr += "fSubS_qxqy_MLR" + tagStr + ";" 477 waveListStr += "fSubS_qxqy_FTB" + tagStr + ";" 478 waveListStr += "fSubS_qxqy_FLR" + tagStr + ";" 479 480 // waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MTB;fSubS_qxqy_MLR;" 481 // waveListStr += "fSubS_qxqy_FTB;fSubS_qxqy_FLR;" 482 483 Concatenate/NP/O waveListStr, tmp_fs 484 379 485 endif 380 486 … … 415 521 416 522 Concatenate/NP/O waveListStr, tmp_s 523 524 // sigma Q 525 waveListStr="" 526 if(!gIgnoreDetB) 527 waveListStr = "sigmaQ_qxqy_B" + tagStr + ";" 528 endif 529 waveListStr += "sigmaQ_qxqy_MLRTB" + tagStr + ";" 530 waveListStr += "sigmaQ_qxqy_FLRTB" + tagStr + ";" 531 532 // waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MLRTB;sigmaQ_qxqy_FLRTB;" 533 534 Concatenate/NP/O waveListStr, tmp_sq 535 536 // Q bar 537 waveListStr="" 538 if(!gIgnoreDetB) 539 waveListStr = "qBar_qxqy_B" + tagStr + ";" 540 endif 541 waveListStr += "qBar_qxqy_MLRTB" + tagStr + ";" 542 waveListStr += "qBar_qxqy_FLRTB" + tagStr + ";" 543 544 // waveListStr = "qBar_qxqy_B;qBar_qxqy_MLRTB;qBar_qxqy_FLRTB;" 545 546 Concatenate/NP/O waveListStr, tmp_qb 547 548 // shadow fs 549 waveListStr="" 550 if(!gIgnoreDetB) 551 waveListStr = "fSubS_qxqy_B" + tagStr + ";" 552 endif 553 waveListStr += "fSubS_qxqy_MLRTB" + tagStr + ";" 554 waveListStr += "fSubS_qxqy_FLRTB" + tagStr + ";" 555 556 // waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MLRTB;fSubS_qxqy_FLRTB;" 557 558 Concatenate/NP/O waveListStr, tmp_fs 417 559 endif 418 560 … … 475 617 476 618 Concatenate/NP/O waveListStr, tmp_s 619 620 //sigma Q 621 waveListStr="" 622 if(!gIgnoreDetB) 623 waveListStr = "sigmaQ_qxqy_B" + tagStr + ";" 624 endif 625 // waveListStr += "sigmaQ_qxqy_MB" + tagStr + ";" 626 // waveListStr += "sigmaQ_qxqy_MT" + tagStr + ";" 627 waveListStr += "sigmaQ_qxqy_ML" + tagStr + ";" 628 waveListStr += "sigmaQ_qxqy_MR" + tagStr + ";" 629 // waveListStr += "sigmaQ_qxqy_FB" + tagStr + ";" 630 // waveListStr += "sigmaQ_qxqy_FT" + tagStr + ";" 631 waveListStr += "sigmaQ_qxqy_FL" + tagStr + ";" 632 waveListStr += "sigmaQ_qxqy_FR" + tagStr + ";" 633 // waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MB;sigmaQ_qxqy_MT;sigmaQ_qxqy_ML;sigmaQ_qxqy_MR;" 634 // waveListStr += "sigmaQ_qxqy_FB;sigmaQ_qxqy_FT;sigmaQ_qxqy_FL;sigmaQ_qxqy_FR;" 635 636 Concatenate/NP/O waveListStr, tmp_sq 637 638 //Q bar 639 waveListStr="" 640 if(!gIgnoreDetB) 641 waveListStr = "qBar_qxqy_B" + tagStr + ";" 642 endif 643 // waveListStr += "qBar_qxqy_MB" + tagStr + ";" 644 // waveListStr += "qBar_qxqy_MT" + tagStr + ";" 645 waveListStr += "qBar_qxqy_ML" + tagStr + ";" 646 waveListStr += "qBar_qxqy_MR" + tagStr + ";" 647 // waveListStr += "qBar_qxqy_FB" + tagStr + ";" 648 // waveListStr += "qBar_qxqy_FT" + tagStr + ";" 649 waveListStr += "qBar_qxqy_FL" + tagStr + ";" 650 waveListStr += "qBar_qxqy_FR" + tagStr + ";" 651 // waveListStr = "qBar_qxqy_B;qBar_qxqy_MB;qBar_qxqy_MT;qBar_qxqy_ML;qBar_qxqy_MR;" 652 // waveListStr += "qBar_qxqy_FB;qBar_qxqy_FT;qBar_qxqy_FL;qBar_qxqy_FR;" 653 654 Concatenate/NP/O waveListStr, tmp_qb 655 656 //shadow fs 657 waveListStr="" 658 if(!gIgnoreDetB) 659 waveListStr = "fSubS_qxqy_B" + tagStr + ";" 660 endif 661 // waveListStr += "fSubS_qxqy_MB" + tagStr + ";" 662 // waveListStr += "fSubS_qxqy_MT" + tagStr + ";" 663 waveListStr += "fSubS_qxqy_ML" + tagStr + ";" 664 waveListStr += "fSubS_qxqy_MR" + tagStr + ";" 665 // waveListStr += "fSubS_qxqy_FB" + tagStr + ";" 666 // waveListStr += "fSubS_qxqy_FT" + tagStr + ";" 667 waveListStr += "fSubS_qxqy_FL" + tagStr + ";" 668 waveListStr += "fSubS_qxqy_FR" + tagStr + ";" 669 // waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MB;fSubS_qxqy_MT;fSubS_qxqy_ML;fSubS_qxqy_MR;" 670 // waveListStr += "fSubS_qxqy_FB;fSubS_qxqy_FT;fSubS_qxqy_FL;fSubS_qxqy_FR;" 671 672 Concatenate/NP/O waveListStr, tmp_fs 673 477 674 endif 478 675 … … 501 698 Wave iw = tmp_i 502 699 Wave sw = tmp_s 503 504 // Sort qw, qw,iw,sw,res0,res1,res2,res3 505 506 Sort qw, qw,iw,sw 700 Wave sq = tmp_sq 701 Wave qb = tmp_qb 702 Wave fs = tmp_fs 703 704 705 Sort qw, qw,iw,sw,sq,qb,fs 507 706 508 707 … … 753 952 754 953 755 // TODO: 756 // -- this is a temporary solution before a real writer is created 757 // -- resolution is not generated here (and it shouldn't be) since resolution is not known yet. 758 // -- but a real writer will need to be aware of resolution, and there may be different forms 759 // 760 // this will bypass save dialogs 761 // -- AND WILL OVERWITE DATA WITH THE SAME NAME 762 // 763 Function V_Write1DData(pathStr,folderStr,saveName) 764 String pathStr,folderStr,saveName 765 766 String formatStr="",fullpath="" 767 Variable refnum,dialog=1 768 769 SetDataFolder $(pathStr+folderStr) 770 771 Wave qw = tmp_q 772 Wave iw = tmp_i 773 Wave sw = tmp_s 774 775 String dataSetFolderParent,basestr 776 777 // ParseFilePath to get path without folder name 778 // dataSetFolderParent = ParseFilePath(1,folderStr,":",1,0) 779 // ParseFilePath to get basestr 780 // basestr = ParseFilePath(0,folderStr,":",1,0) 781 782 //make sure the waves exist 783 784 if(WaveExists(qw) == 0) 785 Abort "q is missing" 786 endif 787 if(WaveExists(iw) == 0) 788 Abort "i is missing" 789 endif 790 if(WaveExists(sw) == 0) 791 Abort "s is missing" 792 endif 793 // if(WaveExists(resw) == 0) 794 // Abort "Resolution information is missing." 795 // endif 796 797 // Duplicate/O qw qbar,sigQ,fs 798 // if(dimsize(resW,1) > 4) 799 // //it's USANS put -dQv back in the last 3 columns 800 // NVAR/Z dQv = USANS_dQv 801 // if(NVAR_Exists(dQv) == 0) 802 // SetDataFolder root: 803 // Abort "It's USANS data, and I don't know what the slit height is." 804 // endif 805 // sigQ = -dQv 806 // qbar = -dQv 807 // fs = -dQv 808 // else 809 // //it's SANS 810 // sigQ = resw[p][0] 811 // qbar = resw[p][1] 812 // fs = resw[p][2] 813 // endif 814 // 815 816 PathInfo catPathName 817 fullPath = S_Path + saveName 818 819 Open refnum as fullpath 820 821 fprintf refnum,"Combined data written from folder %s on %s\r\n",folderStr,(date()+" "+time()) 822 823 // TODO -- make this work for 6-columns (or??) 824 // formatStr = "%15.4g %15.4g %15.4g %15.4g %15.4g %15.4g\r\n" 825 // fprintf refnum, "The 6 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm) | sigmaQ | meanQ | ShadowFactor|\r\n" 826 // wfprintf refnum,formatStr,qw,iw,sw,sigQ,qbar,fs 827 828 //currently, only three columns 829 formatStr = "%15.4g %15.4g %15.4g\r\n" 830 fprintf refnum, "The 3 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm)\r\n" 831 832 wfprintf refnum,formatStr,qw,iw,sw 833 Close refnum 834 835 // KillWaves/Z sigQ,qbar,fs 836 Print "Data written to: ",fullpath 837 838 SetDataFolder root: 839 return(0) 840 End 841 842 843 844 // TODO: 845 // -- this is a temporary solution before a real writer is created 846 // -- resolution is not generated here (and it shouldn't be) since resolution is not known yet. 847 // -- but a real writer will need to be aware of resolution, and there may be different forms 848 // 849 // This saves the data in Igor Text format, an ASCII format, but NOT standard SANS columns 850 // No concatenation is done. This is meant to be used for input to TRIM, or for general troubleshooting 851 // 852 // 853 // this will bypass save dialogs 854 // -- AND WILL OVERWRITE DATA WITH THE SAME NAME 855 // 856 Function V_Write1DData_ITX(pathStr,folderStr,saveName,binType) 857 String pathStr,folderStr,saveName 858 Variable binType 859 860 String formatStr="",fullpath="" 861 Variable refnum,dialog=1 862 863 SetDataFolder $(pathStr+folderStr) 864 865 866 //TODO 867 //-- make sure the waves exist 868 869 // if(WaveExists(qw) == 0) 870 // Abort "q is missing" 871 // endif 872 // if(WaveExists(iw) == 0) 873 // Abort "i is missing" 874 // endif 875 // if(WaveExists(sw) == 0) 876 // Abort "s is missing" 877 // endif 878 // if(WaveExists(resw) == 0) 879 // Abort "Resolution information is missing." 880 // endif 881 882 // Duplicate/O qw qbar,sigQ,fs 883 // if(dimsize(resW,1) > 4) 884 // //it's USANS put -dQv back in the last 3 columns 885 // NVAR/Z dQv = USANS_dQv 886 // if(NVAR_Exists(dQv) == 0) 887 // SetDataFolder root: 888 // Abort "It's USANS data, and I don't know what the slit height is." 889 // endif 890 // sigQ = -dQv 891 // qbar = -dQv 892 // fs = -dQv 893 // else 894 // //it's SANS 895 // sigQ = resw[p][0] 896 // qbar = resw[p][1] 897 // fs = resw[p][2] 898 // endif 899 // 900 901 902 903 // TODO: 904 // -- currently I'm using the Save comand and the /B flag 905 // to save the data as Igor Text format, since otherwise the command string would be 906 // too long. Need to come up with an Igor-demo friendly save here 907 // 908 // -- see V_ExportProtocol() for a quick example of how to generate the .ITX format 909 // 910 // -- need a reader/plotter capable of handling this data. The regular data loader won't handle 911 // all the different number of columns present, or the ITX format. See V_DataPlotting and duplicate these routines 912 // Most of these routines take "winNameStr" as an argument, so I may be able to use them 913 // 914 // -- do I want to add the /O flag to force an overwrite if there is a name conflict? 915 916 PathInfo catPathName 917 fullPath = S_Path + saveName + ".itx" 918 919 // Open refnum as fullpath 920 // fprintf refnum,"Individual data sets written from folder %s on %s\r\n",folderStr,(date()+" "+time()) 921 922 String waveStr="" 923 // can be a multiple number of columns 924 925 switch(binType) 926 case 1: // 9 sets = 27 waves! 927 waveStr = "qBin_qxqy_B;iBin_qxqy_B;eBin_qxqy_B;" 928 waveStr += "qBin_qxqy_ML;iBin_qxqy_ML;eBin_qxqy_ML;" 929 waveStr += "qBin_qxqy_MR;iBin_qxqy_MR;eBin_qxqy_MR;" 930 waveStr += "qBin_qxqy_MT;iBin_qxqy_MT;eBin_qxqy_MT;" 931 waveStr += "qBin_qxqy_MB;iBin_qxqy_MB;eBin_qxqy_MB;" 932 waveStr += "qBin_qxqy_FL;iBin_qxqy_FL;eBin_qxqy_FL;" 933 waveStr += "qBin_qxqy_FR;iBin_qxqy_FR;eBin_qxqy_FR;" 934 waveStr += "qBin_qxqy_FT;iBin_qxqy_FT;eBin_qxqy_FT;" 935 waveStr += "qBin_qxqy_FB;iBin_qxqy_FB;eBin_qxqy_FB;" 936 937 938 Save/T/M="\r\n"/B waveStr as fullPath 939 940 941 // formatStr = "%15.4g %15.4g %15.4g\r\n" 942 // 943 // fprintf refnum, "The 3 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm)\r\n" 944 // 945 // wfprintf refnum,formatStr,qw,iw,sw 946 break 947 case 2: // 5 sets 948 949 waveStr = "qBin_qxqy_B;iBin_qxqy_B;eBin_qxqy_B;" 950 waveStr += "qBin_qxqy_MLR;iBin_qxqy_MLR;eBin_qxqy_MLR;qBin_qxqy_MTB;iBin_qxqy_MTB;eBin_qxqy_MTB;" 951 waveStr += "qBin_qxqy_FLR;iBin_qxqy_FLR;eBin_qxqy_FLR;qBin_qxqy_FTB;iBin_qxqy_FTB;eBin_qxqy_FTB;" 952 953 Save/T/M="\r\n"/B waveStr as fullPath 954 955 // formatStr = "%15.4g %15.4g %15.4g\r\n" 956 // 957 // fprintf refnum, "The 3 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm)\r\n" 958 // 959 // wfprintf refnum,formatStr,qw,iw,sw 960 break 961 case 3: // 3 sets 962 // WAVE q1 = qBin_qxqy_B 963 // WAVE i1 = iBin_qxqy_B 964 // WAVE s1 = eBin_qxqy_B 965 // WAVE q2 = qBin_qxqy_MLRTB 966 // WAVE i2 = iBin_qxqy_MLRTB 967 // WAVE s2 = eBin_qxqy_MLRTB 968 // WAVE q3 = qBin_qxqy_FLRTB 969 // WAVE i3 = iBin_qxqy_FLRTB 970 // WAVE s3 = eBin_qxqy_FLRTB 971 // 972 // 973 // Save/T/M="\r\n" q1,i1,s1,q2,i2,s2,q3,i3,s3 as fullPath 974 975 waveStr = "qBin_qxqy_B;iBin_qxqy_B;eBin_qxqy_B;" 976 waveStr += "qBin_qxqy_MLRTB;iBin_qxqy_MLRTB;eBin_qxqy_MLRTB;qBin_qxqy_FLRTB;iBin_qxqy_FLRTB;eBin_qxqy_FLRTB;" 977 978 Save/T/M="\r\n"/B waveStr as fullPath 979 980 981 // formatStr = "%15.4g %15.4g %15.4g\r\n" 982 // 983 // fprintf refnum, "The 3 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm)\r\n" 984 // 985 // wfprintf refnum,formatStr,qw,iw,sw 986 break 987 case 4: // 9 sets 988 waveStr = "qBin_qxqy_B;iBin_qxqy_B;eBin_qxqy_B;" 989 waveStr += "qBin_qxqy_ML;iBin_qxqy_ML;eBin_qxqy_ML;" 990 waveStr += "qBin_qxqy_MR;iBin_qxqy_MR;eBin_qxqy_MR;" 991 waveStr += "qBin_qxqy_MT;iBin_qxqy_MT;eBin_qxqy_MT;" 992 waveStr += "qBin_qxqy_MB;iBin_qxqy_MB;eBin_qxqy_MB;" 993 waveStr += "qBin_qxqy_FL;iBin_qxqy_FL;eBin_qxqy_FL;" 994 waveStr += "qBin_qxqy_FR;iBin_qxqy_FR;eBin_qxqy_FR;" 995 waveStr += "qBin_qxqy_FT;iBin_qxqy_FT;eBin_qxqy_FT;" 996 waveStr += "qBin_qxqy_FB;iBin_qxqy_FB;eBin_qxqy_FB;" 997 998 999 Save/T/M="\r\n"/B waveStr as fullPath 1000 1001 // formatStr = "%15.4g %15.4g %15.4g\r\n" 1002 // 1003 // fprintf refnum, "The 3 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm)\r\n" 1004 // 1005 // wfprintf refnum,formatStr,qw,iw,sw 1006 break 1007 1008 default: 1009 // do nothing, just close 1010 1011 endswitch 1012 1013 // Close refnum 1014 1015 // TODO 1016 // -- clean up any waves on exit? Only if I generate extra waves 1017 // KillWaves/Z sigQ,qbar,fs 1018 1019 SetDataFolder root: 1020 return(0) 1021 End 1022 1023 954 / 1024 955 Proc V_Load_Data_ITX() 1025 956 V_Load_itx("","",0,0) … … 1183 1114 1184 1115 // TODO 1185 // -- make this resolution-aware1116 // x- make this resolution-aware 1186 1117 // 1187 1118 Function V_TrimOneSet(folderStr,detStr,nBeg,nEnd) … … 1207 1138 Wave/Z iw = $("iBin_qxqy_"+detStr) 1208 1139 Wave/Z ew = $("eBin_qxqy_"+detStr) 1209 1210 1211 DeletePoints 0,nBeg, qw,iw,ew 1140 // resolution waves 1141 Wave/Z sigQ = $("sigmaQ_qxqy_"+detStr) 1142 Wave/Z qBar = $("qBar_qxqy_"+detStr) 1143 Wave/Z fSubS = $("fSubS_qxqy_"+detStr) 1144 1145 DeletePoints 0,nBeg, qw,iw,ew,sigQ,qBar,fSubS 1212 1146 1213 1147 Variable npt 1214 1148 npt = numpnts(qw) 1215 DeletePoints npt-nEnd,nEnd, qw,iw,ew 1149 DeletePoints npt-nEnd,nEnd, qw,iw,ew,sigQ,qBar,fSubS 1216 1150 1217 1151 return(0) 1218 1152 End 1153 1154 1155 // 1156 // returns 1 if the val is non-negative, other value 1157 // indicates that the resoution data is USANS data. 1158 // 1159 // TODO: 1160 // -- this DUPLICATES a same-named SANS procedure, so there could be a clash at some point 1161 // -- bigger issue - I'll need a better way to identify and load the different resolution 1162 // conditions with VSANS 1163 // 1164 // 1165 Function isSANSResolution(val) 1166 Variable val 1167 1168 if(val >= 0) 1169 return(1) 1170 else 1171 return(0) 1172 endif 1173 End 1174 1175 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Initialize.ipf
r1055 r1064 31 31 // this need never change from 1 32 32 Constant kBCTR_CM = 1 //set to 1 to use beam center in cm. O to use pixels 33 Constant kPanelTouchingGap = 4// TODO -- measure this gap when panels "touch", UNITS OF mm, not cm33 Constant kPanelTouchingGap = 10 // TODO -- measure this gap when panels "touch", UNITS OF mm, not cm 34 34 35 35 … … 64 64 // for trimming of the I(q) data sets, and part of the protocol 65 65 Strconstant ksPanelBinTypeList = "B;FT;FB;FL;FR;MT;MB;ML;MR;FTB;FLR;MTB;MLR;FLRTB;MLRTB;" 66 Strconstant ksBinTrimBegDefault = "B=5;FT= 6;FB=6;FL=6;FR=6;MT=6;MB=6;ML=6;MR=6;FTB=7;FLR=7;MTB=7;MLR=7;FLRTB=8;MLRTB=8;"67 Strconstant ksBinTrimEndDefault = "B=10;FT= 9;FB=9;FL=9;FR=9;MT=9;MB=9;ML=9;MR=9;FTB=8;FLR=8;MTB=8;MLR=8;FLRTB=7;MLRTB=7;"66 Strconstant ksBinTrimBegDefault = "B=5;FT=3;FB=3;FL=3;FR=3;MT=3;MB=3;ML=3;MR=3;FTB=2;FLR=2;MTB=2;MLR=2;FLRTB=1;MLRTB=1;" 67 Strconstant ksBinTrimEndDefault = "B=10;FT=5;FB=5;FL=5;FR=5;MT=5;MB=5;ML=5;MR=5;FTB=4;FLR=4;MTB=4;MLR=4;FLRTB=3;MLRTB=3;" 68 68 69 69 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Instrument_Resolution.ipf
r1053 r1064 63 63 // 64 64 // 65 Function getResolution(inQ,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,SigmaQ,QBar,fSubS) 65 // INPUT: 66 // inQ = q-value [1/A] 67 // lambda = wavelength [A] 68 // lambdaWidth = [dimensionless] 69 // DDet = detector pixel resolution [cm] **assumes square pixel 70 // apOff = sample aperture to sample distance [cm] 71 // S1 = source aperture diameter [mm] 72 // S2 = sample aperture diameter [mm] 73 // L1 = source to sample distance [m] 74 // L2 = sample to detector distance [m] 75 // BS = beam stop diameter [mm] 76 // del_r = step size [mm] = binWidth*(mm/pixel) 77 // usingLenses = flag for lenses = 0 if no lenses, non-zero if lenses are in-beam 78 // 79 // OUPUT: 80 // SigmaQ 81 // QBar 82 // fSubS 83 // 84 // 85 Function V_getResolution(inQ,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,SigmaQ,QBar,fSubS) 66 86 Variable inQ, lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r,usingLenses 67 87 Variable &fSubS, &QBar, &SigmaQ //these are the output quantities at the input Q value -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Marquee_Operations.ipf
r1056 r1064 301 301 Print "Y-center (in array coordinates 0->n-1 ) = ",yctr 302 302 303 Print "X-center ( mm) = ",x_mm304 Print "Y-center ( mm) = ",y_mm303 Print "X-center (cm) = ",x_mm/10 304 Print "Y-center (cm) = ",y_mm/10 305 305 endif 306 306 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MaskUtils.ipf
r1050 r1064 573 573 SetScale/P y 0,1, curDispPanel 574 574 575 Wave LookupWave = root:Packages:NIST:VSANS:Globals:logLookupWave 576 575 577 //draw the detector panel 576 578 Display/W=(left,top,right,bottom)/HOST=# 577 579 AppendImage curDispPanel 578 580 ModifyImage curDispPanel ctab= {*,*,ColdWarm,0} 581 // ModifyImage curDispPanel log=1 // this fails, since there are data values that are zero 582 ModifyImage curDispPanel ctabAutoscale=0,lookup= LookupWave 579 583 Label left "Y pixels" 580 584 Label bottom "X pixels" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_PatchFiles.ipf
r1063 r1064 36 36 // -- averaging options -- these will have new options versus SANS (binning panels, slit mode, etc.) 37 37 // 38 38 // 39 // TODO: 40 // V_fPatch_GroupID_catTable() 41 // V_fPatch_Purpose_catTable() 42 // V_fPatch_Intent_catTable() 43 /// -- these three functions are part of a growing list for faster patching. edit the file catalog, and 44 // write out the contents of the column (vs. filename) 45 // -- make a simple panel w/buttons (like the sort panel) to call these functions 46 // 39 47 40 48 //************************** … … 281 289 282 290 283 listWave[0][1] = "count_time "291 listWave[0][1] = "count_time (s)" 284 292 listWave[0][2] = num2str(V_getCount_time(fname)) 285 293 … … 404 412 listWave[0][2] = V_getSampleDescription(fname) 405 413 406 listWave[1][1] = "thickness "414 listWave[1][1] = "thickness (cm)" 407 415 listWave[1][2] = num2str(V_getSampleThickness(fname)) 408 416 … … 457 465 listWave[2][2] = V_getMonochromatorType(fname) 458 466 459 listWave[3][1] = "wavelength "467 listWave[3][1] = "wavelength (A)" 460 468 listWave[3][2] = num2str(V_getWavelength(fname)) 461 469 … … 463 471 listWave[4][2] = num2str(V_getWavelength_spread(fname)) 464 472 465 listWave[5][1] = "distance (source aperture) "473 listWave[5][1] = "distance (source aperture) (cm)" 466 474 listWave[5][2] = num2str(V_getSourceAp_distance(fname)) 467 475 … … 504 512 String detStr = S_value 505 513 506 listWave[0][1] = "beam_center_x "514 listWave[0][1] = "beam_center_x (cm)" 507 515 listWave[0][2] = num2str(V_getDet_Beam_center_x(fname,detStr)) 508 516 509 listWave[1][1] = "beam_center_y "517 listWave[1][1] = "beam_center_y (cm)" 510 518 listWave[1][2] = num2str(V_getDet_Beam_center_y(fname,detStr)) 511 519 512 listWave[2][1] = "distance (nominal) "520 listWave[2][1] = "distance (nominal) (cm)" 513 521 listWave[2][2] = num2str(V_getDet_NominalDistance(fname,detStr)) 514 522 … … 516 524 listWave[3][2] = num2str(V_getDet_IntegratedCount(fname,detStr)) 517 525 518 listWave[4][1] = "pixel_fwhm_x "526 listWave[4][1] = "pixel_fwhm_x (cm)" 519 527 listWave[4][2] = num2str(V_getDet_pixel_fwhm_x(fname,detStr)) 520 528 521 listWave[5][1] = "pixel_fwhm_y "529 listWave[5][1] = "pixel_fwhm_y (cm)" 522 530 listWave[5][2] = num2str(V_getDet_pixel_fwhm_y(fname,detStr)) 523 531 … … 528 536 listWave[7][2] = num2str(V_getDet_pixel_num_y(fname,detStr)) 529 537 530 listWave[8][1] = "setback "538 listWave[8][1] = "setback (cm)" 531 539 listWave[8][2] = num2str(V_getDet_TBSetback(fname,detStr)) 532 540 533 541 if(cmpstr(detStr,"B") == 0 ||cmpstr(detStr,"FR") == 0 || cmpstr(detStr,"FL") == 0 || cmpstr(detStr,"MR") == 0 || cmpstr(detStr,"ML") == 0) 534 listWave[9][1] = "lateral_offset " // "B" detector drops here542 listWave[9][1] = "lateral_offset (cm)" // "B" detector drops here 535 543 listWave[9][2] = num2str(V_getDet_LateralOffset(fname,detStr)) 536 544 else 537 listWave[9][1] = "vertical_offset "545 listWave[9][1] = "vertical_offset (cm)" 538 546 listWave[9][2] = num2str(V_getDet_VerticalOffset(fname,detStr)) 539 547 endif 540 548 541 listWave[10][1] = "x_pixel_size "549 listWave[10][1] = "x_pixel_size (mm)" 542 550 listWave[10][2] = num2str(V_getDet_x_pixel_size(fname,detStr)) 543 551 544 listWave[11][1] = "y_pixel_size "552 listWave[11][1] = "y_pixel_size (mm)" 545 553 listWave[11][2] = num2str(V_getDet_y_pixel_size(fname,detStr)) 546 554 … … 582 590 583 591 584 listWave[0][1] = "count_time "592 listWave[0][1] = "count_time (s)" 585 593 listWave[0][2] = num2str(V_getCount_time(fname)) 586 594 … … 2168 2176 2169 2177 else 2170 printf "run number %d not found\r", ii2178 printf "run number %d not found\r",jj 2171 2179 endif 2172 2180 endfor … … 2324 2332 ////////////////////////////////////////////////////////////////////////////////////////////////// 2325 2333 ////////////////////////////////////////////////////////////////////////////////////////////////// 2334 2335 2336 // simple utility to patch the offset values in the file headers 2337 // 2338 // Swaps only the L/R detector values 2339 // lo is the first file number 2340 // hi is the last file number (inclusive) 2341 // 2342 Function V_fPatchDet_Offset(lo,hi) 2343 Variable lo,hi 2344 2345 2346 Variable ii,jj 2347 String fname,detStr 2348 2349 Variable offset_ML,offset_MR,offset_FL,offset_FR 2350 2351 2352 //loop over all files 2353 for(jj=lo;jj<=hi;jj+=1) 2354 fname = V_FindFileFromRunNumber(jj) 2355 if(strlen(fname) != 0) 2356 2357 offset_FL = V_getDet_LateralOffset(fname,"FL") 2358 offset_FR = V_getDet_LateralOffset(fname,"FR") 2359 2360 offset_ML = V_getDet_LateralOffset(fname,"ML") 2361 offset_MR = V_getDet_LateralOffset(fname,"MR") 2362 2363 // swap L/R offset values 2364 V_WriteDet_LateralOffset(fname,"FL",-offset_FR) 2365 V_WriteDet_LateralOffset(fname,"FR",-offset_FL) 2366 2367 V_WriteDet_LateralOffset(fname,"ML",-offset_MR) 2368 V_WriteDet_LateralOffset(fname,"MR",-offset_ML) 2369 2370 Print fname 2371 Print "swapped FL, FR = ",-offset_FR,-offset_FL 2372 Print "swapped ML, MR = ",-offset_MR,-offset_ML 2373 2374 else 2375 printf "run number %d not found\r",jj 2376 endif 2377 endfor 2378 2379 return(0) 2380 End 2381 2382 // simple utility to read the detector offset stored in the file header 2383 Function V_fReadDet_Offset(lo,hi) 2384 Variable lo,hi 2385 2386 String fname,detStr 2387 Variable jj 2388 Variable offset_ML,offset_MR,offset_FL,offset_FR 2389 2390 for(jj=lo;jj<=hi;jj+=1) 2391 fname = V_FindFileFromRunNumber(jj) 2392 if(strlen(fname) != 0) 2393 2394 offset_FL = V_getDet_LateralOffset(fname,"FL") 2395 offset_FR = V_getDet_LateralOffset(fname,"FR") 2396 2397 offset_ML = V_getDet_LateralOffset(fname,"ML") 2398 offset_MR = V_getDet_LateralOffset(fname,"MR") 2399 2400 Print fname 2401 Print "FL, FR = ",offset_FL,offset_FR 2402 Print "ML, MR = ",offset_ML,offset_MR 2403 2404 2405 else 2406 printf "run number %d not found\r",jj 2407 endif 2408 2409 endfor 2410 2411 2412 return(0) 2413 End 2414 2415 2416 // patches the group_ID, based on whatever is in the catTable 2417 // 2418 Function V_fPatch_GroupID_catTable() 2419 Variable lo,hi 2420 2421 2422 Variable ii,jj,num 2423 2424 Wave id = root:Packages:NIST:VSANS:CatVSHeaderInfo:Group_ID 2425 Wave/T fileNameW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames 2426 2427 num = numpnts(id) 2428 //loop over all files 2429 for(jj=0;jj<num;jj+=1) 2430 Print "update file ",jj,fileNameW[jj] 2431 V_writeSample_GroupID(fileNameW[jj],id[jj]) 2432 endfor 2433 2434 return(0) 2435 End 2436 2437 V_fPatch_GroupID_catTable() 2438 V_fPatch_Purpose_catTable() 2439 V_fPatch_Intent_catTable() 2440 2441 // patches the Purpose, based on whatever is in the catTable 2442 // 2443 Function V_fPatch_Purpose_catTable() 2444 Variable lo,hi 2445 2446 2447 Variable ii,jj,num 2448 2449 Wave/T purpose = root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose 2450 Wave/T fileNameW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames 2451 2452 num = numpnts(purpose) 2453 //loop over all files 2454 for(jj=0;jj<num;jj+=1) 2455 Print "update file ",jj,fileNameW[jj] 2456 V_writeReduction_Purpose(fileNameW[jj],purpose[jj]) 2457 endfor 2458 2459 return(0) 2460 End 2461 2462 // patches the Intent, based on whatever is in the catTable 2463 // 2464 Function V_fPatch_Intent_catTable() 2465 Variable lo,hi 2466 2467 2468 Variable ii,jj,num 2469 2470 Wave/T intent = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent 2471 Wave/T fileNameW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames 2472 2473 num = numpnts(intent) 2474 //loop over all files 2475 for(jj=0;jj<num;jj+=1) 2476 Print "update file ",jj,fileNameW[jj] 2477 V_writeReductionIntent(fileNameW[jj],intent[jj]) 2478 endfor 2479 2480 return(0) 2481 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf
r1057 r1064 69 69 //the questionnare form of the protcol (see protocol.ipf) 70 70 // 71 //0901, uses 8 points in protocol wave72 71 Proc V_InitProtocolPanel() 73 72 … … 569 568 Function/S V_GetSAMList() 570 569 571 String match="SAMPLE" 572 String list = V_getFileIntentList(match,0) 570 // String match="SAMPLE" 571 // String list = V_getFileIntentList(match,0) 572 573 String intent = "SAMPLE" 574 String purpose = "SCATTERING" 575 String list = V_getFileIntentPurposeList(intent,purpose,0) 573 576 574 577 // Printf "SAM files = %s\r",list … … 596 599 end 597 600 598 599 // testStr is the "intent" string, or grep string600 // method is the method to use to find the file601 // 0 = (default) is to use the file catalog (= fastest)602 // 1 = Grep (not terribly slow)603 // 2 = read every file (bad choice)604 //605 Function/S V_getFileIntentList(testStr,method)606 String testStr607 Variable method608 609 Variable ii,num610 String list="",item="",fname,newList,intent611 612 // read every file...613 if(method == 2)614 PathInfo catPathName615 String path = S_path616 newList = V_GetRawDataFileList()617 num=ItemsInList(newList)618 619 for(ii=0;ii<num;ii+=1)620 item=StringFromList(ii, newList , ";")621 fname = path + item622 intent = V_getReduction_intent(fname)623 if(cmpstr(intent,testStr) == 0)624 list += item + ";"625 endif626 endfor627 endif628 629 // use Grep630 if(method == 1)631 newList = V_GetRawDataFileList()632 num=ItemsInList(newList)633 for(ii=0;ii<num;ii+=1)634 item=StringFromList(ii, newList , ";")635 Grep/P=catPathName/Q/E=("(?i)"+testStr) item636 if( V_value ) // at least one instance was found637 // Print "found ", item,ii638 list += item + ";"639 endif640 endfor641 642 else643 // get the list from the file catalog644 645 WAVE/T fileNameW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames646 WAVE/T intentW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent647 648 Variable np = numpnts(intentW) //fileNameW is LONGER - so don't use numpnts(fileWave)649 for(ii=0;ii<np;ii+=1)650 if(cmpstr(intentW[ii],testStr)==0) //this is case-INSENSITIVE (necessary, since the case is unknown)651 list += fileNameW[ii] + ";"652 endif653 endfor654 655 List = SortList(List,";",0)656 endif657 658 return(list)659 end660 601 661 602 // -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_RAW_Data_Panel.ipf
r1062 r1064 918 918 endif 919 919 if(curTab == 1) 920 str += "SDD ML = "+num2str(V_getDet_ActualDistance(type,"ML")) + " cm \r" 921 str += "SDD MR = "+num2str(V_getDet_ActualDistance(type,"MR")) + " cm \r" 922 str += "SDD MT = "+num2str(V_getDet_ActualDistance(type,"MT")) + " cm \r" 923 str += "SDD MB = "+num2str(V_getDet_ActualDistance(type,"MB")) + " cm \r" 920 str += "SDD ML = "+num2str(V_getDet_ActualDistance(type,"ML")) + " cm " 921 str += "offset = "+num2str(V_getDet_LateralOffset(type,"ML")) + " cm \r" 922 str += "SDD MR = "+num2str(V_getDet_ActualDistance(type,"MR")) + " cm " 923 str += "offset = "+num2str(V_getDet_LateralOffset(type,"MR")) + " cm \r" 924 str += "SDD MT = "+num2str(V_getDet_ActualDistance(type,"MT")) + " cm " 925 str += "offset = "+num2str(V_getDet_VerticalOffset(type,"MT")) + " cm \r" 926 str += "SDD MB = "+num2str(V_getDet_ActualDistance(type,"MB")) + " cm " 927 str += "offset = "+num2str(V_getDet_VerticalOffset(type,"MB")) + " cm \r" 924 928 endif 925 929 if(curTab == 0) 926 str += "SDD FL = "+num2str(V_getDet_ActualDistance(type,"FL")) + " cm \r" 927 str += "SDD FR = "+num2str(V_getDet_ActualDistance(type,"FR")) + " cm \r" 928 str += "SDD FT = "+num2str(V_getDet_ActualDistance(type,"FT")) + " cm \r" 929 str += "SDD FB = "+num2str(V_getDet_ActualDistance(type,"FB")) + " cm \r" 930 str += "SDD FL = "+num2str(V_getDet_ActualDistance(type,"FL")) + " cm " 931 str += "offset = "+num2str(V_getDet_LateralOffset(type,"FL")) + " cm \r" 932 str += "SDD FR = "+num2str(V_getDet_ActualDistance(type,"FR")) + " cm " 933 str += "offset = "+num2str(V_getDet_LateralOffset(type,"FR")) + " cm \r" 934 str += "SDD FT = "+num2str(V_getDet_ActualDistance(type,"FT")) + " cm " 935 str += "offset = "+num2str(V_getDet_VerticalOffset(type,"FT")) + " cm \r" 936 str += "SDD FB = "+num2str(V_getDet_ActualDistance(type,"FB")) + " cm " 937 str += "offset = "+num2str(V_getDet_VerticalOffset(type,"FB")) + " cm \r" 930 938 endif 931 939 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Transmission.ipf
r1051 r1064 15 15 // -- currently, the initialization does nothing. 16 16 Function V_InitTransmissionPanel() 17 18 Execute "V_TransmissionPanel()"19 17 18 DoWindow/F V_TransmissionPanel 19 if(V_Flag == 0) 20 Execute "V_TransmissionPanel()" 21 endif 20 22 End 21 23 … … 29 31 // ShowTools/A 30 32 PopupMenu popup_0,pos={19.00,55.00},size={86.00,23.00},proc=V_TSamFilePopMenuProc,title="Sample" 31 PopupMenu popup_0,mode=1,value= V_getFile IntentList("SAMPLE",0)+V_getFileIntentList("EMPTY CELL",0)33 PopupMenu popup_0,mode=1,value= V_getFilePurposeList("SCATTERING",0)//+V_getFileIntentList("EMPTY CELL",0) 32 34 PopupMenu popup_1,pos={102,248},size={72.00,23.00},proc=V_TTransmFilePopMenuProc,title="Transmission" 33 PopupMenu popup_1,mode=1,value= V_getFile IntentList("TRANSMISSION",0)35 PopupMenu popup_1,mode=1,value= V_getFilePurposeList("TRANSMISSION",0) 34 36 PopupMenu popup_2,pos={164,353},size={72.00,23.00},proc=V_TEmpBeamPopMenuProc,title="Empty Beam" 35 37 PopupMenu popup_2,mode=1,value= V_getFileIntentList("EMPTY BEAM",0) … … 103 105 // TODO x- set the popup string to the matching name on exit 104 106 Variable targetID = groupIDW[ii] 105 String list = V_getFile IntentList("TRANSMISSION",0)106 WAVE/T intentW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent107 String list = V_getFilePurposeList("TRANSMISSION",0) 108 WAVE/T purposeW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose 107 109 for(ii=0;ii<np;ii+=1) 108 if(cmpstr( intentW[ii],"TRANSMISSION")==0 && groupIDW[ii] == targetID)110 if(cmpstr(purposeW[ii],"TRANSMISSION")==0 && groupIDW[ii] == targetID) 109 111 Print "transmission file match at ",filenameW[ii] 110 112 SetVariable setvar_2,value=labelW[ii] … … 129 131 PopupMenu popup_2,mode=WhichListItem(fileNameW[ii], list )+1 130 132 131 SetVariable setvar_6,value =_STR:"ML"133 // SetVariable setvar_6,value =_STR:"ML" 132 134 133 135 WAVE boxCoord = V_getBoxCoordinates(filenameW[ii]) … … 182 184 Variable popNum = pa.popNum 183 185 String popStr = pa.popStr 186 187 Print "empty beam match at ",popStr 188 SetVariable setvar_4,value=_STR:V_getSampleDescription(popStr) 189 190 // SetVariable setvar_6,value =_STR:"ML" 191 192 WAVE boxCoord = V_getBoxCoordinates(popStr) 193 Print boxCoord 194 SetVariable setvar_5,value=_STR:V_NumWave2List(boxCoord,";") 195 196 184 197 break 185 198 case -1: // control being killed -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Utilities_General.ipf
r1056 r1064 1221 1221 1222 1222 1223 1224 ////// methods for filtering out different lists of files. 1225 1226 // testStr is the "intent" string, or grep string 1227 // method is the method to use to find the file 1228 // 0 = (default) is to use the file catalog (= fastest) 1229 // 1 = Grep (not terribly slow) 1230 // 2 = read every file (bad choice) 1231 // 1232 Function/S V_getFileIntentList(testStr,method) 1233 String testStr 1234 Variable method 1235 1236 Variable ii,num 1237 String list="",item="",fname,newList,intent 1238 1239 // read every file... 1240 if(method == 2) 1241 PathInfo catPathName 1242 String path = S_path 1243 newList = V_GetRawDataFileList() 1244 num=ItemsInList(newList) 1245 1246 for(ii=0;ii<num;ii+=1) 1247 item=StringFromList(ii, newList , ";") 1248 fname = path + item 1249 intent = V_getReduction_intent(fname) 1250 if(cmpstr(intent,testStr) == 0) 1251 list += item + ";" 1252 endif 1253 endfor 1254 endif 1255 1256 // use Grep 1257 if(method == 1) 1258 newList = V_GetRawDataFileList() 1259 num=ItemsInList(newList) 1260 for(ii=0;ii<num;ii+=1) 1261 item=StringFromList(ii, newList , ";") 1262 Grep/P=catPathName/Q/E=("(?i)"+testStr) item 1263 if( V_value ) // at least one instance was found 1264 // Print "found ", item,ii 1265 list += item + ";" 1266 endif 1267 endfor 1268 1269 else 1270 // get the list from the file catalog 1271 1272 WAVE/T fileNameW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames 1273 WAVE/T intentW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent 1274 1275 Variable np = numpnts(intentW) //fileNameW is LONGER - so don't use numpnts(fileWave) 1276 for(ii=0;ii<np;ii+=1) 1277 if(cmpstr(intentW[ii],testStr)==0) //this is case-INSENSITIVE (necessary, since the case is unknown) 1278 list += fileNameW[ii] + ";" 1279 endif 1280 endfor 1281 1282 List = SortList(List,";",0) 1283 endif 1284 1285 return(list) 1286 end 1287 1288 1289 // testStr is the "purpose" string, or grep string 1290 // method is the method to use to find the file 1291 // 0 = (default) is to use the file catalog (= fastest) 1292 // 1 = Grep (not terribly slow) 1293 // 2 = read every file (bad choice) 1294 // 1295 Function/S V_getFilePurposeList(testStr,method) 1296 String testStr 1297 Variable method 1298 1299 Variable ii,num 1300 String list="",item="",fname,newList,purpose 1301 1302 // read every file... 1303 if(method == 2) 1304 PathInfo catPathName 1305 String path = S_path 1306 newList = V_GetRawDataFileList() 1307 num=ItemsInList(newList) 1308 1309 for(ii=0;ii<num;ii+=1) 1310 item=StringFromList(ii, newList , ";") 1311 fname = path + item 1312 purpose = V_getReduction_purpose(fname) 1313 if(cmpstr(purpose,testStr) == 0) 1314 list += item + ";" 1315 endif 1316 endfor 1317 endif 1318 1319 // use Grep 1320 if(method == 1) 1321 newList = V_GetRawDataFileList() 1322 num=ItemsInList(newList) 1323 for(ii=0;ii<num;ii+=1) 1324 item=StringFromList(ii, newList , ";") 1325 Grep/P=catPathName/Q/E=("(?i)"+testStr) item 1326 if( V_value ) // at least one instance was found 1327 // Print "found ", item,ii 1328 list += item + ";" 1329 endif 1330 endfor 1331 1332 else 1333 // get the list from the file catalog 1334 1335 WAVE/T fileNameW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames 1336 WAVE/T purposeW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose 1337 1338 Variable np = numpnts(purposeW) //fileNameW is LONGER - so don't use numpnts(fileWave) 1339 for(ii=0;ii<np;ii+=1) 1340 if(cmpstr(purposeW[ii],testStr)==0) //this is case-INSENSITIVE (necessary, since the case is unknown) 1341 list += fileNameW[ii] + ";" 1342 endif 1343 endfor 1344 1345 List = SortList(List,";",0) 1346 endif 1347 1348 return(list) 1349 end 1350 1351 1352 // match BOTH the intent and purpose 1353 // -- needed to identify the SAMPLE + SCATTERING data files. 1354 // 1355 // 1356 // method is the method to use to find the file (currently ignored, CAT is always used) 1357 // 0 = (default) is to use the file catalog (= fastest) 1358 // 1 = Grep (not terribly slow) 1359 // 2 = read every file (bad choice) 1360 // 1361 Function/S V_getFileIntentPurposeList(intent,purpose,method) 1362 String intent,purpose 1363 Variable method 1364 1365 Variable ii,num 1366 String list="",item="",fname,newList 1367 1368 // // read every file... 1369 // if(method == 2) 1370 // PathInfo catPathName 1371 // String path = S_path 1372 // newList = V_GetRawDataFileList() 1373 // num=ItemsInList(newList) 1374 // 1375 // for(ii=0;ii<num;ii+=1) 1376 // item=StringFromList(ii, newList , ";") 1377 // fname = path + item 1378 // purpose = V_getReduction_purpose(fname) 1379 // if(cmpstr(purpose,testStr) == 0) 1380 // list += item + ";" 1381 // endif 1382 // endfor 1383 // endif 1384 // 1385 // // use Grep 1386 // if(method == 1) 1387 // newList = V_GetRawDataFileList() 1388 // num=ItemsInList(newList) 1389 // for(ii=0;ii<num;ii+=1) 1390 // item=StringFromList(ii, newList , ";") 1391 // Grep/P=catPathName/Q/E=("(?i)"+testStr) item 1392 // if( V_value ) // at least one instance was found 1393 // // Print "found ", item,ii 1394 // list += item + ";" 1395 // endif 1396 // endfor 1397 // 1398 // else 1399 // get the list from the file catalog 1400 1401 WAVE/T fileNameW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames 1402 WAVE/T purposeW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose 1403 WAVE/T intentW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent 1404 1405 Variable np = numpnts(purposeW) //fileNameW is LONGER - so don't use numpnts(fileWave) 1406 for(ii=0;ii<np;ii+=1) 1407 if(cmpstr(purposeW[ii],purpose)==0 && cmpstr(intentW[ii],intent)==0) //this is case-INSENSITIVE (necessary, since the case is unknown) 1408 list += fileNameW[ii] + ";" 1409 endif 1410 endfor 1411 1412 List = SortList(List,";",0) 1413 1414 return(list) 1415 end 1416 1417 1418
Note: See TracChangeset
for help on using the changeset viewer.