- Timestamp:
- May 15, 2015 11:35:18 AM (8 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction
- Files:
-
- 3 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/HDF5gateway_NCNR.ipf
r946 r955 2 2 3 3 #include <HDF5 Browser> 4 5 // 6 // !!! search for "SRK" to see what I have modified to work with NCNR files 7 // -- these changes may only be for testing, and may need to be removed in the final version!!! 8 // 9 // 10 // 11 4 12 5 13 // requires the Wavemetrics "HDF5.xop" to be installed for IgorPro … … 939 947 940 948 Variable fileID = 0 941 //HDF5OpenFile/R/P=home/Z fileID as fileName942 HDF5OpenFile/R/P=catPathName/Z fileID as fileName949 HDF5OpenFile/R/P=home/Z fileID as fileName 950 // HDF5OpenFile/R/P=catPathName/Z fileID as fileName 943 951 if (V_Flag != 0) 944 952 return 0 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Q.ipf
r954 r955 2 2 3 3 4 ///// Procedures for: 5 // Generating the detector panels 6 // Filling the panels with Qtot, QxQyQz 7 // Filling the "data" with a model function 8 // Averaging the panels (independently) into I(Q) 9 // 10 // 11 //There are some things in the current circular averaging that don't make any sense 12 //and don't seem to really do anything at all, so trim them out. 13 //1) subdividing pixels near the beam stop into 9 sub-pixels 14 //2) non-linear correction (maybe keep this as a dummy). I may need to put some sort 15 //of correction here for the offset, or it may already be done as I receive it. 16 // 17 // 18 // 19 //Do I separate out the circular, sector, rectangular, annular averaging into 20 //separate routines? 21 // 22 // 23 // 4 ////////////////// 5 // 6 // Procedures for: 7 // 8 // Gathering information to calculate QxQyQz 9 // Filling the panels with Qtot, QxQyQz 10 // Filling the "data" with a model function 11 // Averaging the panels (independently) into I(Q) 12 // Plotting the 9 detector panels in 2D 13 // Plotting the 1D I(q) data depending on the panel combinations 14 // 15 // 16 // There are some things in the current circular averaging that don't make any sense 17 // and don't seem to really do anything at all, so i have decided to trim them out. 18 // 1) subdividing pixels near the beam stop into 9 sub-pixels 19 // 2) non-linear correction (only applies to Ordela) 20 // 21 // 22 // Do I separate out the circular, sector, rectangular, annular averaging into 23 // separate routines? 24 // 25 // 26 // 27 /////////////////// 24 28 25 29 … … 28 32 End 29 33 30 // to plot I(q) for the 4 front panels 34 // 35 // Plot the front panels in 2D and 1D 36 // calcualate Q 37 // fill w/model data 38 // "shadow" the T/B detectors 39 // bin the data to I(q) 40 // draw I(q) graph 41 // draw 2D panel graph 31 42 // 32 43 // *** Call this function when front panels are adjusted, or wavelength, etc. changed … … 56 67 FillPanel_wModelData(det_FT,qTot_FT,"FT") 57 68 FillPanel_wModelData(det_FB,qTot_FB,"FB") 58 // det_FL = V_SphereForm(1,60,1e-6,1,qTot_FL[p][q])59 // det_FR = V_SphereForm(1,60,1e-6,1,qTot_FR[p][q])60 // det_FT = V_SphereForm(1,60,1e-6,1,qTot_FT[p][q])61 // det_FB = V_SphereForm(1,60,1e-6,1,qTot_FB[p][q])62 69 63 70 SetDataFolder root: … … 76 83 Execute "Front_IQ_Graph()" 77 84 Execute "FrontPanels_AsQ()" 85 86 return(0) 78 87 End 79 88 … … 218 227 219 228 220 // TODO "- this doesn't quite mask things out as they should be (too much is masked L/R of center)229 // TODO - this doesn't quite mask things out as they should be (too much is masked L/R of center) 221 230 // and the outer edges of the detector are masked even if the TB panels extend past the TB of the LR panels. 222 231 // ? skip the masking? but then I bin the detector data directly to get I(q), skipping the masked NaN values... … … 245 254 // TODO - these are to be set from globals, not hard-wired 246 255 // pixel sizes are in cm for T/B detector 247 // TODO :the "FT" check is hard wired for FRONT -- get rid of this...256 // TODO - the "FT" check is hard wired for FRONT -- get rid of this... 248 257 249 258 pixSizeX = VCALC_getPixSizeX(type) … … 266 275 267 276 277 // After the panels have been calculated and rescaled in terms of Q, and filled with simulated data 278 // they can be appended to the subwindow. If they are already there, the axes and coloring 279 // are rescaled as needed 280 // 268 281 Window FrontPanels_AsQ() : Graph 269 // DoWindow/F FrontPanels_AsQ270 // if(V_flag == 0)271 // PauseUpdate; Silent 1 // building window...272 // Display /W=(1477,44,1978,517)273 282 274 283 SetDataFolder root:Packages:NIST:VSANS:VCALC:Front … … 303 312 SetDataFolder root: 304 313 305 // ModifyGraph width={Aspect,1},height={Aspect,1},gbRGB=(56797,56797,56797)306 // ModifyGraph grid=2307 // ModifyGraph mirror=2308 // SetAxis left -0.2,0.2309 // SetAxis bottom -0.2,0.2310 // endif311 314 EndMacro 312 315 … … 419 422 Execute "Middle_IQ_Graph()" 420 423 Execute "MiddlePanels_AsQ()" 424 425 return(0) 421 426 End 422 427 … … 805 810 Execute "Back_IQ_Graph()" 806 811 Execute "BackPanels_AsQ()" 812 813 return(0) 814 807 815 End 808 816 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Slit.ipf
r954 r955 2 2 3 3 4 ////////////////// 5 // 6 // Procedures to average data taken in "slit" apertuere geometry. The fake data on the detector panels 7 // is as would be collected in PINHOLE geometry - I do not currently have a simulation for slit 8 // apertures (this would need to be MonteCarlo) - the I(q) averaging here gives the I(q) that you 9 // would measure in 1D using slit geometry. It is done by simply summing the columns of data on each detector. 10 // 11 ////////////////// 4 12 // 5 13 // … … 10 18 // - best answer so far is to skip the T/B panels, and simply not use them 11 19 // 20 // TODO -- be sure that the absolute scaling of this is correct. I have no guarantee that 21 // it'll be correct. 22 // 23 ///////////////// 24 12 25 13 26 // 27 // seems backwards to call this "byRows", but this is the way that Igor indexes 28 // LR banks are defined as (48,256) (n,m), sumRows gives sum w/ dimension (n x 1) 14 29 // 15 30 Function V_fBinDetector_byRows(folderStr,type) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Utils.ipf
r954 r955 1 1 #pragma rtGlobals=3 // Use modern global access method and strict wave access. 2 3 ///////////////////////// 4 // 5 // Utility functions to: 6 // calculate Q, Qx, Qy, Qz 7 // fill the detector panels with simulated data (the model functions are here) 8 // bin the 2D detector to 1D I(Q) based on Q and deltaQ (bin width) 9 // 10 ///////////////////////// 11 12 2 13 3 14 … … 31 42 //?? pick the function from a popup on the panel? (bypass the analysis panel, or maybe it's better to 32 43 // keep the panel to keep people used to using it.) 44 // peak @ 0.1 ~ AgBeh 45 // Make/O/D coef_BroadPeak = {1e-9, 3, 20, 100.0, 0.1,3,0.1} 46 // 47 // peak @ 0.015 in middle of middle detector, maybe not "real" vycor, but that is to be resolved 48 // Make/O/D coef_BroadPeak = {1e-9, 3, 20, 500.0, 0.015,3,0.1} 33 49 String funcStr = VCALC_getModelFunctionStr() 34 50 strswitch(funcStr) … … 45 61 tmpInten = V_SphereForm(1,60,1e-6,0.001,qTot[p][q]) 46 62 break 63 case "AgBeh": 64 tmpInten = V_BroadPeak(1e-9,3,20,100.0,0.1,3,0.1,qTot[p][q]) 65 break 66 case "Vycor": 67 tmpInten = V_BroadPeak(1e-9,3,20,500.0,0.015,3,0.1,qTot[p][q]) 68 break 69 case "Empty Cell": 70 tmpInten = V_EC_Empirical(2.2e-8,3.346,0.0065,9.0,0.016,qTot[p][q]) 71 break 72 case "Blocked Beam": 73 tmpInten = V_BlockedBeam(1,qTot[p][q]) 74 break 47 75 default: 48 76 tmpInten = V_Debye(10,300,0.1,qTot[p][q]) … … 148 176 149 177 //function to calculate the overall q-value, given all of the necesary trig inputs 150 //NOTE: detector locations passed in are pixels = 0.5cm real space on the detector151 178 //and are in detector coordinates (1,128) rather than axis values 152 179 //the pixel locations need not be integers, reals are ok inputs … … 177 204 //ALL inputs are in detector coordinates 178 205 // 179 //NOTE: detector locations passed in are pixel = 0.5cm real space on the Ordela detector180 206 //sdd is in meters 181 207 //wavelength is in Angstroms … … 208 234 //input/output is the same as CalcQval() 209 235 //ALL inputs are in detector coordinates 210 //NOTE: detector locations passed in are pixel = 0.5cm real space on the Ordela detector211 236 //sdd is in meters 212 237 //wavelength is in Angstroms … … 239 264 //input/output is the same as CalcQval() 240 265 //ALL inputs are in detector coordinates 241 //NOTE: detector locations passed in are pixel = 0.5cm real space on the Ordela detector242 266 //sdd is in meters 243 267 //wavelength is in Angstroms … … 366 390 End 367 391 392 // a sum of a power law and debye to approximate the scattering from a real empty cell 393 // 394 // make/O/D coef_ECEmp = {2.2e-8,3.346,0.0065,9.0,0.016} 395 // 396 Function V_EC_Empirical(aa,mm,scale,rg,bkg,x) 397 Variable aa,mm,scale,rg,bkg 398 Variable x 399 400 // variables are: 401 //[0] = A 402 //[1] = power m 403 //[2] scale factor 404 //[3] radius of gyration [A] 405 //[4] background [cm-1] 406 407 Variable Iq 408 409 // calculates (scale*debye)+bkg 410 Variable Pq,qr2 411 412 // if(x*Rg < 1e-3) //added Oct 2008 to avoid numerical errors at low arg values 413 // return(scale+bkg) 414 // endif 415 416 Iq = aa*x^-mm 417 418 qr2=(x*rg)^2 419 Pq = 2*(exp(-(qr2))-1+qr2)/qr2^2 420 421 //scale 422 Pq *= scale 423 // then add the terms up 424 return (Iq + Pq + bkg) 425 End 426 427 // blocked beam 428 // 429 Function V_BlockedBeam(bkg,x) 430 Variable bkg 431 Variable x 432 433 return (bkg) 434 End 435 436 437 // 438 // a broad peak to simulate silver behenate or vycor 439 // 440 // peak @ 0.1 ~ AgBeh 441 // Make/O/D coef_BroadPeak = {1e-9, 3, 20, 100.0, 0.1,3,0.1} 442 // 443 // 444 // peak @ 0.015 in middle of middle detector, maybe not "real" vycor, but that is to be resolved 445 // Make/O/D coef_BroadPeak = {1e-9, 3, 20, 500.0, 0.015,3,0.1} 446 // 447 // 448 Function V_BroadPeak(aa,nn,cc,LL,Qzero,mm,bgd,x) 449 Variable aa,nn,cc,LL,Qzero,mm,bgd 450 Variable x 451 452 // variables are: 453 //[0] Porod term scaling 454 //[1] Porod exponent 455 //[2] Lorentzian term scaling 456 //[3] Lorentzian screening length [A] 457 //[4] peak location [1/A] 458 //[5] Lorentzian exponent 459 //[6] background 460 461 // local variables 462 Variable inten, qval 463 // x is the q-value for the calculation 464 qval = x 465 // do the calculation and return the function value 466 467 inten = aa/(qval)^nn + cc/(1 + (abs(qval-Qzero)*LL)^mm) + bgd 468 469 Return (inten) 470 471 End 368 472 369 473 … … 429 533 430 534 535 536 ////////// 537 // 538 // Function that bins a 2D detctor panel into I(q) based on the q-value of the pixel 539 // - each pixel QxQyQz has been calculated beforehand 540 // - if multiple panels are selected to be combined, it is done here during the binning 541 // - the setting of deltaQ step is still a little suspect (TODO) 542 // 543 // 431 544 // see the equivalent function in PlotUtils2D_v40.ipf 432 545 // … … 436 549 // -- type = FL or FR or...other panel identifiers 437 550 // 438 // TODO "iErr" is all messed up since it doesn't really apply here for data that is not 2D simulation 439 // 551 // TODO "iErr" is not always defined correctly since it doesn't really apply here for data that is not 2D simulation 440 552 // 441 553 Function V_fDoBinning_QxQy2D(folderStr,type) … … 592 704 593 705 //TODO: properly define the errors here - I'll have this if I do the simulation 594 if(WaveExists(iErr)==0 )706 if(WaveExists(iErr)==0 && WaveExists(inten) != 0) 595 707 Duplicate/O inten,iErr 596 708 Wave iErr=iErr 597 709 // iErr = 1+sqrt(inten+0.75) // can't use this -- it applies to counts, not intensity (already a count rate...) 598 710 iErr = sqrt(inten+0.75) // TODO -- here I'm just using some fictional value 711 endif 712 if(WaveExists(iErr2)==0 && WaveExists(inten2) != 0) 713 Duplicate/O inten2,iErr2 714 Wave iErr2=iErr2 715 // iErr2 = 1+sqrt(inten2+0.75) // can't use this -- it applies to counts, not intensity (already a count rate...) 716 iErr2 = sqrt(inten2+0.75) // TODO -- here I'm just using some fictional value 717 endif 718 if(WaveExists(iErr3)==0 && WaveExists(inten3) != 0) 719 Duplicate/O inten3,iErr3 720 Wave iErr3=iErr3 721 // iErr3 = 1+sqrt(inten3+0.75) // can't use this -- it applies to counts, not intensity (already a count rate...) 722 iErr3 = sqrt(inten3+0.75) // TODO -- here I'm just using some fictional value 723 endif 724 if(WaveExists(iErr4)==0 && WaveExists(inten4) != 0) 725 Duplicate/O inten4,iErr4 726 Wave iErr4=iErr4 727 // iErr4 = 1+sqrt(inten4+0.75) // can't use this -- it applies to counts, not intensity (already a count rate...) 728 iErr4 = sqrt(inten4+0.75) // TODO -- here I'm just using some fictional value 599 729 endif 600 730 … … 622 752 623 753 // delQ = abs(sqrt(qx[2]^2+qy[2]^2+qz[2]^2) - sqrt(qx[1]^2+qy[1]^2+qz[1]^2)) //use bins of 1 pixel width 624 // TODO: not sure if I want to s odQ in x or y direction...754 // TODO: not sure if I want to set dQ in x or y direction... 625 755 // the short dimension is the 8mm tubes, use this direction as dQ? 626 756 // but don't use the corner of the detector, since dQ will be very different on T/B or L/R due to the location of [0,0] … … 680 810 iBin_qxqy[binIndex] += val 681 811 iBin2_qxqy[binIndex] += val*val 682 eBin2D_qxqy[binIndex] += iErr [ii][jj]*iErr[ii][jj]812 eBin2D_qxqy[binIndex] += iErr2[ii][jj]*iErr2[ii][jj] 683 813 nBin_qxqy[binIndex] += 1 684 814 endif … … 702 832 iBin_qxqy[binIndex] += val 703 833 iBin2_qxqy[binIndex] += val*val 704 eBin2D_qxqy[binIndex] += iErr [ii][jj]*iErr[ii][jj]834 eBin2D_qxqy[binIndex] += iErr3[ii][jj]*iErr3[ii][jj] 705 835 nBin_qxqy[binIndex] += 1 706 836 endif … … 721 851 iBin_qxqy[binIndex] += val 722 852 iBin2_qxqy[binIndex] += val*val 723 eBin2D_qxqy[binIndex] += iErr [ii][jj]*iErr[ii][jj]853 eBin2D_qxqy[binIndex] += iErr4[ii][jj]*iErr4[ii][jj] 724 854 nBin_qxqy[binIndex] += 1 725 855 endif -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_FrontView_Deg.ipf
r954 r955 1 1 #pragma rtGlobals=3 // Use modern global access method and strict wave access. 2 2 3 4 ///////////////////////// 3 5 // 4 // draw boxes for the detector coverage based on the geometry of the instrument setup 6 // Function to draw schematic boxes for the detector coverage based on the geometry 7 // of the instrument setup 5 8 // 6 // this will draw all of the panels. Zooming is then simply rescaling the axes9 // -- all of the dimensions are based on the angles and ranges in degrees 7 10 // 8 // Now it is part of the main panel and is updated when any detector settings are changed11 // -- this draws all 9 of the panels. Zooming is then simply rescaling the axes 9 12 // 13 // -- Now it is part of the main panel. This function is then called again 14 // to update the drawing when any detector settings are changed 15 // 16 ////////////////////////// 17 10 18 Function FrontView_1x() 11 19 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_UtilityProcedures.ipf
r954 r955 1 1 #pragma rtGlobals=3 // Use modern global access method and strict wave access. 2 2 3 4 // a bunch of utility procedures to get information from the VCALC panel and to access 3 //////////////////////// 4 // 5 // 6 // a bunch of utility procedures to access information from the VCALC panel and to access 5 7 // constants based in which of the detectors I'm trying to work with. Saves a lot of repetitive switches 6 8 // 7 9 // start the function names with VCALC_ to avoid the eventual conflicts with the file loading utilities 8 10 // for reduction of real VSANS data 9 10 11 /// Values from the VCALC panel 11 // 12 // 13 // -- add more of these procedures as more items are added to the panel 14 // 15 //////////////////////// 16 17 18 // Values from the VCALC panel 12 19 13 20 … … 308 315 /////////// procedure to concatenate I(q) files into a single file 309 316 // 310 // currently, no rescaling is done, just simple concatentate and sort311 // 317 // currently, no rescaling is done, just crude concatentate and sort 318 // -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_VCALCPanel_MockUp.ipf
r954 r955 686 686 687 687 // tab 5 688 String/G gModelFunctionType = "Debye;Sphere;Big Debye;Big Sphere; "688 String/G gModelFunctionType = "Debye;Sphere;Big Debye;Big Sphere;AgBeh;Vycor;Empty Cell;Blocked Beam;" 689 689 690 690 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VSANS_Includes.ipf
r954 r955 5 5 #include "VC_DetectorBinning_Utils" 6 6 #include "VC_FrontView_Deg" 7 #include "VC_HDF5_VSANS_ Write"7 #include "VC_HDF5_VSANS_Utils" 8 8 #include "VC_SideView" 9 9 #include "VC_UtilityProcedures" 10 10 #include "VC_VCALCPanel_MockUp" 11 12 #include "HDF5gateway_NCNR" 13 #include "Nexus_SANS_Write" 14 #include "Nexus_VSANS_Write"
Note: See TracChangeset
for help on using the changeset viewer.