Changeset 206
- Timestamp:
- Nov 18, 2007 4:15:52 PM (15 years ago)
- Location:
- sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/NCNR_Utils.ipf
r143 r206 41 41 42 42 //new 11APR07 43 Variable/G root:myGlobals:BeamstopXTol = - 5// (cm) is BS Xpos is -5 cm or less, it's a trans measurement43 Variable/G root:myGlobals:BeamstopXTol = -8 // (cm) is BS Xpos is -5 cm or less, it's a trans measurement 44 44 // sample aperture offset is NOT stored in the VAX header, but it should be 45 45 // - when it is, remove the global and write an accessor AND make a place for -
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/WorkFileUtils.ipf
r116 r206 367 367 Variable ii,jj,dtdist,dtdis2 368 368 Variable xi,xd,yd,rad,ratio,domega,xy 369 Variable lambda 369 370 370 371 // Print "...doing jacobian and non-linear corrections" 372 NVAR pixelsX = root:myGlobals:gNPixelsX 373 NVAR pixelsY = root:myGlobals:gNPixelsY 371 374 372 375 //set up values to send to auxiliary trig functions 373 xcenter = 64.5 374 ycenter = 64.5 376 xcenter = pixelsX/2 + 0.5 // == 64.5 for 128x128 Ordela 377 ycenter = pixelsY/2 + 0.5 // == 64.5 for 128x128 Ordela 378 375 379 x0 = realsread[16] 376 380 y0 = realsread[17] … … 383 387 dtdis2 = dtdist^2 384 388 389 lambda = realsRead[26] 390 385 391 xx0 = dc_fx(x0,sx,sx3,xcenter) 386 392 yy0 = dc_fy(y0,sy,sy3,ycenter) 387 393 388 NVAR pixelsX = root:myGlobals:gNPixelsX 389 // NVAR pixelsY = root:myGlobals:gNPixelsY 394 390 395 //waves to contain repeated function calls 391 Make/O/N=(pixelsX) fyy,xx,yy //Assumes square detector 396 Make/O/N=(pixelsX) fyy,xx,yy //Assumes square detector !!! 392 397 ii=0 393 398 do … … 399 404 while(ii<pixelsX) 400 405 401 // Make/O/N=(pixelsX,pixelsX) SolidAngle 406 // Make/O/N=(pixelsX,pixelsX) SolidAngle // testing only 402 407 403 408 ii=0 … … 413 418 domega = rad/dtdist 414 419 ratio = domega^3 415 // solidAngle[ii][jj] = ratio 420 // solidAngle[ii][jj] = ratio //testing only 416 421 xy = xx[ii]*yy[jj] 417 422 data[ii][jj] *= xy*ratio 423 424 // multiplicative correction for detector efficiency JBG memo det_eff_cor2.doc 3/20/07 425 // correction inserted 11/2007 SRK 426 427 data[ii][jj] *= DetEffCorr(lambda,dtdist,xd,yd) 428 429 // solidAngle[ii][jj] = DetEffCorr(lambda,dtdist,xd,yd) //testing only 430 418 431 jj+=1 419 432 while(jj<pixelsX) … … 422 435 423 436 //clean up waves 424 Killwaves/Z fyy,xx,yy437 // Killwaves/Z fyy,xx,yy 425 438 426 439 Return(0) … … 467 480 End 468 481 482 //distances passed in are in mm 483 // dtdist is SDD 484 // xd and yd are distances from the beam center to the current pixel 485 // 486 Function DetEffCorr(lambda,dtdist,xd,yd) 487 Variable lambda,dtdist,xd,yd 488 489 Variable theta,cosT,ff,stAl,stHe 490 491 theta = atan( (sqrt(xd^2 + yd^2))/dtdist ) 492 cosT = cos(theta) 493 494 stAl = 0.00967*lambda*0.8 //dimensionless, constants from JGB memo 495 stHe = 0.146*lambda*2.5 496 497 ff = exp(-stAl/cosT)*(1-exp(-stHe/cosT)) / ( exp(-stAl)*(1-exp(-stHe)) ) 498 499 return(ff) 500 End 469 501 //****************** 470 502 //direct port of the FORTRAN code for calculating the weighted -
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/WriteQIS.ipf
r201 r206 335 335 String type,fullpath 336 336 Variable dialog //=1 will present dialog for name 337 338 Variable enter=StopMSTimer(-2) 339 337 340 338 String destStr="",ave="C",typeStr="" 341 339 Variable step=1,refnum … … 396 394 Endif 397 395 398 Print "Before fill = ",(StopMSTimer(-2) - enter)/1e6399 396 ///////// 400 397 Variable numTextLines=18 … … 434 431 // termStr = "\r\n" 435 432 // Endif 436 437 Print "After fill = ",(StopMSTimer(-2) - enter)/1e6438 433 439 434 Duplicate/O data,spWave 440 435 Redimension/S/N=(pixelsX*pixelsY) spWave //single precision (/S) 441 436 442 Print "Before save = ",(StopMSTimer(-2) - enter)/1e6443 437 //not demo- compatible, but approx 100x faster!! 444 438 … … 457 451 Print "2D ASCII File written: ", GetFileNameFromPathNoSemi(fullPath) 458 452 459 Print "Before exit = ",(StopMSTimer(-2) - enter)/1e6460 453 return(0) 461 454 End 462 455 463 456 464 //// ASCII EXPORT in detector coordinates - mimicking the VAX ASCII/128command457 //// ASCII EXPORT in detector coordinates - mimicking the VAX CONVERT command 465 458 // this is done simply to be able to produce converted raw data files that can be 466 459 // read in with Grasp. A rather awkward structure, definitely not the preferred export format … … 471 464 String type,fullpath 472 465 Variable dialog //=1 will present dialog for name 473 474 Variable enter=StopMSTimer(-2) 475 466 476 467 String destStr="" 477 468 String typeStr="" … … 522 513 Endif 523 514 524 Print "Before fill = ",(StopMSTimer(-2) - enter)/1e6525 515 ///////// 526 516 String tmpStr="" … … 531 521 labelWave[0] = tmpStr 532 522 labelWave[1] = textw[6] //label 533 sprintf tmpStr," %d %g %g %g",intw[2],rw[0],rw[39],rw[2] 523 524 sprintf tmpStr," %d %g %g %g",intw[2],rw[0],rw[39],rw[2] 534 525 labelWave[2] = tmpStr 535 526 labelWave[3] = " Cnt.Time(sec.) Mon. Cnt. Trans. Det. Cnt. Tot. Det. Cnt." 536 sprintf tmpStr," %g %g %g %g %d %d %g",rw[4],rw[5],rw[8],rw[9],intw[4],intw[5],rw[6] 527 528 sprintf tmpStr," %g %g %g '%s' %g '%s' %d %d %g",rw[4],rw[5],rw[8],textw[7],rw[9],textw[8],intw[4],intw[5],rw[6] 537 529 labelWave[4] = tmpStr 538 530 labelWave[5] = " Trans. Thckns Temp. H Field Table Holder Pos" 539 sprintf tmpStr," %g %g %d '%s' %g",rw[26],rw[27],intw[9],textw[9],rw[7] 531 532 sprintf tmpStr," %g %g %d '%s' %g",rw[26],rw[27],intw[9],textw[9],rw[7] 540 533 labelWave[6] = tmpStr 541 534 labelWave[7] = " Wavelength & Spread(FWHM) Det.# Type Sample Rotation Angle" 542 sprintf tmpStr," %g %g %g %g %g %g",rw[18],rw[19],rw[16],rw[17],rw[21],rw[3] 535 536 sprintf tmpStr," %g %g %g %g %g %g",rw[18],rw[19],rw[16],rw[17],rw[21],rw[3] 543 537 labelWave[8] = tmpStr 544 538 labelWave[9] = " Sam-Det Dis.(m) Det.Ang.(cm.) Beam Center(x,y) Beam Stop(mm) Atten.No." 545 sprintf tmpStr," %g %g %g %g %g %g",rw[10],rw[11],rw[12],rw[13],rw[14],rw[15] 539 540 sprintf tmpStr," %g %g %g %g %g %g",rw[10],rw[11],rw[12],rw[13],rw[14],rw[15] 546 541 labelWave[10] = tmpStr 547 542 labelWave[11] = " Det. Calib Consts. (x) Det. Calib Consts. (y)" 548 sprintf tmpStr," %g %g %g '%s' %g %g",rw[23],rw[24],rw[25]," F",rw[32],rw[32] 543 544 sprintf tmpStr," %g %g %g '%s' %g %g",rw[23],rw[24],rw[25]," F",rw[45],rw[46] 549 545 labelWave[12] = tmpStr 550 546 labelWave[13] = " Aperture (A1,A2) Sizes(mm) Sep.(m) Flip ON Horiz. and Vert. Cur.(amps)" 547 551 548 sprintf tmpStr," %d %d %d %d %g %g %g",intw[19],intw[20],intw[21],intw[22],rw[47],rw[48],rw[49] 552 549 labelWave[14] = tmpStr 553 550 labelWave[15] = " Rows Cols Factor Qmin Qmax" 551 554 552 labelWave[16] = " Packed Counts by Rows (L -> R) and Top -> Bot" 555 553 … … 559 557 labelWave[ii] = (labelWave[ii])[0,240] 560 558 endfor 561 562 Print "After fill = ",(StopMSTimer(-2) - enter)/1e6563 559 564 560 Duplicate/O data,spWave … … 581 577 sPt=ePt 582 578 while(ePt<len-1) 583 584 Print "Before save = ",(StopMSTimer(-2) - enter)/1e6 585 579 586 580 Open refNum as fullpath 587 581 wfprintf refNum,"%s\r",labelWave //VAX uses just \r … … 593 587 Print "2D ASCII File written for Grasp: ", GetFileNameFromPathNoSemi(fullPath) 594 588 595 Print "Before exit = ",(StopMSTimer(-2) - enter)/1e6596 589 return(0) 597 590 End
Note: See TracChangeset
for help on using the changeset viewer.