Changeset 210
- Timestamp:
- Nov 28, 2007 12:37:24 PM (15 years ago)
- Location:
- sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/CircSectAve.ipf
r143 r210 277 277 lambda = reals[26] 278 278 trans = reals[4] 279 280 ////this section is the trans_correct() VAX routine 281 if(trans<0.1) 282 Print "***transmission is less than 0.1*** and is a significant correction" 283 endif 284 if(trans==0) 285 Print "***transmission is ZERO*** and has been reset to 1.0 for the averaging calculation" 286 trans = 1 287 endif 288 //optical thickness 289 uval = -ln(trans) //use natural logarithm 290 //apply correction to aveint[] 291 //index from zero here, since only working with IGOR waves 292 ii=0 293 do 294 theta = 2*asin(lambda*qval[ii]/(4*pi)) 295 cos_th = cos(theta) 296 arg = (1-cos_th)/cos_th 297 if((uval<0.01) || (cos_th>0.99)) //OR 298 //small arg, approx correction 299 aveint[ii] /= 1-0.5*uval*arg 300 else 301 //large arg, exact correction 302 aveint[ii] /= (1-exp(-uval*arg))/(uval*arg) 303 endif 304 ii+=1 305 while(ii<nq) 306 //end of transmission/pathlength correction 279 280 // 281 // The transmission correction is now done at the ADD step, in DetCorr() 282 // 283 // ////this section is the trans_correct() VAX routine 284 // if(trans<0.1) 285 // Print "***transmission is less than 0.1*** and is a significant correction" 286 // endif 287 // if(trans==0) 288 // Print "***transmission is ZERO*** and has been reset to 1.0 for the averaging calculation" 289 // trans = 1 290 // endif 291 // //optical thickness 292 // uval = -ln(trans) //use natural logarithm 293 // //apply correction to aveint[] 294 // //index from zero here, since only working with IGOR waves 295 // ii=0 296 // do 297 // theta = 2*asin(lambda*qval[ii]/(4*pi)) 298 // cos_th = cos(theta) 299 // arg = (1-cos_th)/cos_th 300 // if((uval<0.01) || (cos_th>0.99)) //OR 301 // //small arg, approx correction 302 // aveint[ii] /= 1-0.5*uval*arg 303 // else 304 // //large arg, exact correction 305 // aveint[ii] /= (1-exp(-uval*arg))/(uval*arg) 306 // endif 307 // ii+=1 308 // while(ii<nq) 309 // //end of transmission/pathlength correction 307 310 308 311 // *************************************************************** -
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/Initialize.ipf
r116 r210 97 97 Variable/G root:myGlobals:gBinWidth=1 98 98 Variable/G root:myGlobals:gNPhiSteps=72 99 100 // flags to turn detector corrections on/off for testing (you should leave these ON) 101 Variable/G root:myGlobals:gDoDetectorEffCorr = 1 102 Variable/G root:myGlobals:gDoTransmissionCorr = 1 99 103 100 104 //set flag if Demo Version is detected -
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/RectAnnulAvg.ipf
r143 r210 277 277 lambda = reals[26] 278 278 trans = reals[4] 279 280 ////this section is the trans_correct() VAX routine 281 if(trans<0.1) 282 Print "***transmission is less than 0.1*** and is a significant correction" 283 endif 284 if(trans==0) 285 Print "***transmission is ZERO*** and has been reset to 1.0 for the averaging calculation" 286 trans = 1 287 endif 288 //optical thickness 289 uval = -ln(trans) 290 //apply correction to aveint[] 291 //index from zero here, since only working with IGOR waves 292 ii=0 293 do 294 theta = 2*asin(lambda*qval[ii]/(4*pi)) 295 cos_th = cos(theta) 296 arg = (1-cos_th)/cos_th 297 if((uval<0.01) || (cos_th>0.99)) //OR 298 //small arg, approx correction 299 aveint[ii] /= 1-0.5*uval*arg 300 else 301 //large arg, exact correction 302 aveint[ii] /= (1-exp(-uval*arg))/(uval*arg) 303 endif 304 ii+=1 305 while(ii<nq) 306 //end of transmission/pathlength correction 307 279 // 280 // The transmission correction is now done at the ADD step, in DetCorr() 281 // 282 // ////this section is the trans_correct() VAX routine 283 // if(trans<0.1) 284 // Print "***transmission is less than 0.1*** and is a significant correction" 285 // endif 286 // if(trans==0) 287 // Print "***transmission is ZERO*** and has been reset to 1.0 for the averaging calculation" 288 // trans = 1 289 // endif 290 // //optical thickness 291 // uval = -ln(trans) 292 // //apply correction to aveint[] 293 // //index from zero here, since only working with IGOR waves 294 // ii=0 295 // do 296 // theta = 2*asin(lambda*qval[ii]/(4*pi)) 297 // cos_th = cos(theta) 298 // arg = (1-cos_th)/cos_th 299 // if((uval<0.01) || (cos_th>0.99)) //OR 300 // //small arg, approx correction 301 // aveint[ii] /= 1-0.5*uval*arg 302 // else 303 // //large arg, exact correction 304 // aveint[ii] /= (1-exp(-uval*arg))/(uval*arg) 305 // endif 306 // ii+=1 307 // while(ii<nq) 308 // //end of transmission/pathlength correction 309 // 308 310 // *************************************************************** 309 311 // -
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/Tile_2D.ipf
r201 r210 587 587 endif 588 588 if(GraspASCII) 589 fullPath=pathStr+newFileName+" _G.ASC"589 fullPath=pathStr+newFileName+".GSP" 590 590 Fast2dExport_OldStyle("RAW",fullpath,0) 591 591 endif -
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/WorkFileUtils.ipf
r206 r210 117 117 ConvertFolderToLinearScale("RAW") 118 118 119 DetCorr(raw_data,raw_reals) //applies correction to raw_data, and overwrites it 119 // switches to control what is done, don't do the transmission correction for the BGD measurement 120 NVAR doEfficiency = root:myGlobals:gDoDetectorEffCorr 121 NVAR gDoTrans = root:myGlobals:gDoTransmissionCorr 122 Variable doTrans = gDoTrans 123 if(cmpstr("BGD",newtype) == 0) 124 doTrans = 0 //skip the trans correction for the BGD file but don't change the value of the global 125 endif 126 127 DetCorr(raw_data,raw_reals,doEfficiency,doTrans) //applies correction to raw_data, and overwrites it 120 128 121 129 //if RAW data is ILL type detector, correct raw_data for same counts being written to 4 pixels … … 257 265 258 266 //apply nonlinear, Jacobian corrections --- 259 DetCorr(data,realsread) //the parameters are waves, and will be changed by the function 267 // switches to control what is done, don't do the transmission correction for the BGD measurement 268 NVAR doEfficiency = root:myGlobals:gDoDetectorEffCorr 269 NVAR gDoTrans = root:myGlobals:gDoTransmissionCorr 270 Variable doTrans = gDoTrans 271 if(cmpstr("BGD",newtype) == 0) 272 doTrans = 0 //skip the trans correction for the BGD file but don't change the value of the global 273 endif 274 275 DetCorr(data,realsread,doEfficiency,doTrans) //the parameters are waves, and will be changed by the function 260 276 261 277 //if ILL type detector, correct for same counts being written to 4 pixels … … 361 377 //works on the actual data array, assumes that is is already on LINEAR scale 362 378 // 363 Function DetCorr(data,realsread )379 Function DetCorr(data,realsread,doEfficiency,doTrans) 364 380 Wave data,realsread 381 Variable doEfficiency,doTrans 365 382 366 383 Variable xcenter,ycenter,x0,y0,sx,sx3,sy,sy3,xx0,yy0 367 384 Variable ii,jj,dtdist,dtdis2 368 385 Variable xi,xd,yd,rad,ratio,domega,xy 369 Variable lambda 386 Variable lambda,trans 370 387 371 388 // Print "...doing jacobian and non-linear corrections" 389 372 390 NVAR pixelsX = root:myGlobals:gNPixelsX 373 391 NVAR pixelsY = root:myGlobals:gNPixelsY … … 388 406 389 407 lambda = realsRead[26] 408 trans = RealsRead[4] 390 409 391 410 xx0 = dc_fx(x0,sx,sx3,xcenter) … … 404 423 while(ii<pixelsX) 405 424 406 // Make/O/N=(pixelsX,pixelsX) SolidAngle // testing only425 Make/O/N=(pixelsX,pixelsY) SolidAngle // testing only 407 426 408 427 ii=0 … … 424 443 // multiplicative correction for detector efficiency JBG memo det_eff_cor2.doc 3/20/07 425 444 // correction inserted 11/2007 SRK 445 // large angle detector efficiency correction is >= 1 and will "bump up" the highest angles 446 if(doEfficiency) 447 data[ii][jj] *= DetEffCorr(lambda,dtdist,xd,yd) 448 // solidAngle[ii][jj] = DetEffCorr(lambda,dtdist,xd,yd) //testing only 449 endif 426 450 427 data[ii][jj] *= DetEffCorr(lambda,dtdist,xd,yd) 428 429 // solidAngle[ii][jj] = DetEffCorr(lambda,dtdist,xd,yd) //testing only 451 // large angle transmission correction is <= 1 and will "bump up" the highest angles 452 if(doTrans) 453 data[ii][jj] /= LargeAngleTransmissionCorr(trans,dtdist,xd,yd) //moved from 1D avg SRK 11/2007 454 solidAngle[ii][jj] = LargeAngleTransmissionCorr(trans,dtdist,xd,yd) //testing only 455 endif 430 456 431 457 jj+=1 … … 499 525 return(ff) 500 526 End 527 528 // DIVIDE the intensity by this correction to get the right answer 529 Function LargeAngleTransmissionCorr(trans,dtdist,xd,yd) 530 Variable trans,dtdist,xd,yd 531 532 //angle dependent transmission correction 533 Variable uval,arg,cos_th,correction,theta 534 535 ////this section is the trans_correct() VAX routine 536 if(trans<0.1) 537 Print "***transmission is less than 0.1*** and is a significant correction" 538 endif 539 if(trans==0) 540 Print "***transmission is ZERO*** and has been reset to 1.0 for the averaging calculation" 541 trans = 1 542 endif 543 544 theta = atan( (sqrt(xd^2 + yd^2))/dtdist ) //theta at the input pixel 545 546 //optical thickness 547 uval = -ln(trans) //use natural logarithm 548 549 // theta = 2*asin(lambda*qval/(4*pi)) 550 551 cos_th = cos(theta) 552 arg = (1-cos_th)/cos_th 553 if((uval<0.01) || (cos_th>0.99)) //OR 554 //small arg, approx correction 555 correction= 1-0.5*uval*arg 556 else 557 //large arg, exact correction 558 correction = (1-exp(-uval*arg))/(uval*arg) 559 endif 560 561 //end of transmission/pathlength correction 562 563 return(correction) 564 end 565 501 566 //****************** 502 567 //direct port of the FORTRAN code for calculating the weighted
Note: See TracChangeset
for help on using the changeset viewer.