Ignore:
Timestamp:
May 23, 2013 9:43:12 AM (10 years ago)
Author:
srkline
Message:

Updated the NGB attenuator tables with Katie's new measurements from May 2013.

Made some changes to Auto-Fit to make it more useable. Will turn it "on" when documentation is finished.

Changed how the random deviate function is calculated to improve the estimates of multiple scattering. Now the q-range of integration is shifted to lower q for the USANS calculation (using very large objects). Also, the number of points used in the integration is chosen adaptively until a constant value of scattering cross section is obtained. There are still some functions where the integration fails (power laws). These will always fail. My best solution currently is to flag the times when the XS>100. Then the estimates are invalid. The 1D simulation is fine, the 2D is reasonably fine, but anything to do with multile scattering is incorrect.

Location:
sans/Dev/trunk/NCNR_User_Procedures
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Auto_Fit.ipf

    r902 r911  
    22 
    33 
    4 // This was originally written 2001-2003 ish. This works very differently than SANSview, and I havne't 
     4// This was originally written 2001-2003 ish. This works very differently than SANSview, and I haven't 
    55// mentioned that this exists, so that their ideas will be new. Still, some of this may be  
    66// serviceable for use within the Igor package, with some cleanup of the interface and functionality. 
     
    1111// 
    1212// X- smeared models don't work at all (now they work) 
    13 // -- the report is good, but the parsing is not great - the format 
     13// x- the report is good, but the parsing is not great - the format 
    1414//      could be more convenient to read back in to a table (text col, num cols (matrix that can be plotted?) 
    15 //      -- Maybe the report could be compiled as waves. Then they would be numeric. Nothing to plot them against 
     15//      x- Maybe the report could be compiled as waves. Then they would be numeric. Nothing to plot them against 
    1616//                      other than file names, but with a table of values and names, one could manually enter a meaningful 
    1717//                      column of values to plot against. 
    18 // -- Make_HoldConstraintEps_Waves() is  currently disabled, both on the macros menu and the checkbox on the panel 
    19 //                      Constraints and holds are part of the matrix already, soo this would only be for epsilon 
    20 // -- Many of the items on the Macros menu are just junk. 
    21 // 
     18// x- Make_HoldConstraintEps_Waves() is  currently disabled, both on the macros menu and the checkbox on the panel 
     19//                      Constraints and holds are part of the matrix already, so this would only be for epsilon 
     20// x- Many of the items on the Macros menu are just junk. Remove them. 
     21// 
     22// x- savePath is obsolete. Remove the button. Report saving is sent to the procedure defined in Wrapper.ipf, and uses the home path 
     23// x- add a checkbox for "all" to select all data files (function is already set -- CheckAllFiles()) 
     24// 
     25// x- make it easy for the user to save the results in a whole table. 
     26// x- remind to rename the results (or move to a folder?) before another batch is run 
     27// x- what to plot against? 
     28// 
     29// x- add a little text box of explanation on each of the tabs at the bottom - to give simple 
     30//    instructions of what to do on each tab. This will need to change with each tab. 
     31// 
     32// x- need a help button to link to the help file 
    2233// -- Comprehensive instructions (after features are finalized) 
    23 // 
    24 // -- savePath seems to be obsolete. Report saving is sent to the procedure defined in Wrapper.ipf, and uses the home path 
    25 // 
     34 
    2635 
    2736 
    2837Menu "Macros" 
    29         SubMenu "Auto-Fit" 
    30                 "InitializeAutoFitPanel" 
     38        SubMenu "Auto Fit" 
     39                "Initialize AutoFit Panel" 
    3140                "-" 
    32                 "Generate_Data_Checklist" 
     41//              "Generate_Data_Checklist" 
    3342//              "Make_HoldConstraintEps_Waves"          //this is currently disabled 
     43//              "-" 
     44//              "CompileAndLoadReports" 
     45                "Compile_Reports" 
     46                "Load Compiled Reports" 
     47//              "Compile_GlobalFit_Reports" 
    3448                "-" 
    35                 "CompileAndLoadReports" 
    36                 "LoadCompiledReports" 
    37                 "Compile_GlobalFit_Reports" 
     49                "Close Open Notebooks" 
     50                "Print Open Notebooks" 
    3851                "-" 
    39                 "PrintOpenNotebooks" 
    40                 "Close Open Notebooks" 
    41                 "-" 
    42                 "Generate_PICTS_list" 
    43                 "Layout_PICTS" 
     52                "Generate_PNG_list" 
     53                "Layout_PNGs" 
    4454                 
    4555        End 
     
    106116        return(0) 
    107117End 
     118 
     119 
     120//currently set up to toggle state, based on the first row 
     121// 
     122Function CheckAllFiles(ctrlName,checked) : CheckBoxControl 
     123        String ctrlName 
     124        Variable checked 
     125 
     126        WAVE sel = root:AutoFit:fileSelWave 
     127        if( (sel[0][1] & 0x10) == 16 ) //first box is checked 
     128                sel[][1] = 2^5                  // uncheck them all 
     129        else 
     130                sel[][1] = 2^5 + 2^4            //bit 5== checkbox, bit 4== checked 
     131        endif 
     132        return(0) 
     133End 
     134 
    108135 
    109136//  
     
    264291        Make/O/T/N=(1,1) constrMatrix                                   //constraint matrix is text 
    265292        Make/O/B/N=1 guessSel,holdSel,ConstrSel,rangeSel                                                //SelWave is byte data 
    266         Variable/G numPar=5,ptLow=0,ptHigh=0,fitTol=1e-3,curProgress=0,endProgress=10 
     293        Variable/G numPar=0,ptLow=0,ptHigh=0,fitTol=1e-3,curProgress=0,endProgress=10 
    267294        Variable/G startTicks=0 
    268295         
     
    270297        String/G gStatus=gStatFormat+"the fit engine is currently idle" 
    271298        string/g gExt="ABC" 
     299         
     300        String/G guessStr = "Guess is based on\rthe unsmeared\rcoefficients on the\rCurve Fit Setup\rpanel" 
     301        String/G holdStr = "Enter 0 to fit\rEnter 1 to hold" 
     302        String/G constStr = "Enter low and\rhigh range as:\rlow;high\rfor each parameter\rLeave blank if\rno constraints" 
     303        String/G rangeStr = "Enter the point\rrange as:\rfirst pt in 1st row\rlast pt in 2nd row\rLeave blank to\r fit all data" 
     304         
    272305         
    273306        fileListWave = "" 
     
    297330//      Button DelButton,pos={245,61},size={40,20},proc=DelButtonProc,title="Del",disable=2 
    298331        Button PathButton,pos={6,61},size={50,20},proc=PDPButton,title="Path..." 
    299         Button FileListButton,pos={182,61},size={50,20},proc=FileListButtonProc,title="List" 
    300         ListBox guessBox,pos={24,398},size={139,208},disable=1,proc=UpdateGuessMatrixProc 
     332        Button FileListButton,pos={82,61},size={50,20},proc=FileListButtonProc,title="List" 
     333        CheckBox AllFilesCheck,pos={182,64},size={32,14},proc=CheckAllFiles,title="Select All Files" 
     334        CheckBox AllFilesCheck,value= 0 
     335        ListBox guessBox,pos={24,398},size={145,208},disable=1,proc=UpdateGuessMatrixProc 
    301336        ListBox guessBox,frame=2,listWave=root:AutoFit:guessList 
    302337        ListBox guessBox,selWave=root:AutoFit:guessSel,mode= 2,selRow= 0 
     
    305340        Button FillAllConstrButton,pos={196,406},size={50,20},proc=FillAllConstrButtonProc,title="Fill All" 
    306341        Button FillAllRangeB,pos={196,406},size={50,20},disable=1,proc=FillAllRangeButtonProc,title="Fill All" 
    307         SetVariable NumParams,pos={7,31},size={161,15},proc=SetNumParamProc,title="Number of Parameters" 
     342        SetVariable NumParams,pos={7,34},size={150,15},proc=SetNumParamProc,title="Number of Parameters" 
    308343        SetVariable NumParams,limits={2,Inf,0},value= root:AutoFit:numPar 
    309344//      CheckBox typeCheck,pos={207,31},size={32,14},title="NSE Data?",value=0 
     
    316351//      CheckBox rangeCheck,pos={92,404},size={32,14},proc=RangeCheckProc,title="All" 
    317352//      CheckBox rangeCheck,value= 1,disable=2 
     353 
    318354        SetVariable lowPt,pos={136,404},size={60,15},title="low" 
    319355        SetVariable lowPt,limits={0,Inf,0},value= root:AutoFit:ptLow,noedit=1,disable=1 
    320356        SetVariable highPt,pos={201,404},size={60,15},title=" to " 
    321357        SetVariable highPt,limits={0,Inf,0},value= root:AutoFit:ptHigh,noedit=1,disable=1 
    322         ListBox holdBox,pos={24,398},size={139,208},disable=1,proc=UpdateHoldMatrixProc 
     358        ListBox holdBox,pos={24,398},size={145,208},disable=1,proc=UpdateHoldMatrixProc 
    323359        ListBox holdBox,frame=2,listWave=root:AutoFit:holdList 
    324360        ListBox holdBox,selWave=root:AutoFit:holdSel,mode= 2,selRow= 2 
    325         ListBox ConstrBox,pos={24,398},size={170,208},proc=UpdateConstrMatrixProc 
     361        ListBox ConstrBox,pos={24,398},size={145,208},proc=UpdateConstrMatrixProc 
    326362        ListBox ConstrBox,frame=2,listWave=root:AutoFit:ConstrList 
    327363        ListBox ConstrBox,selWave=root:AutoFit:ConstrSel,mode= 2,selRow= 2 
    328         ListBox RangeBox,pos={24,398},size={139,208},proc=UpdateRangeMatrixProc 
     364        ListBox RangeBox,pos={24,398},size={145,208},proc=UpdateRangeMatrixProc 
    329365        ListBox RangeBox,frame=2,listWave=root:AutoFit:rangeList 
    330366        ListBox RangeBox,selWave=root:AutoFit:RangeSel,mode= 2,selRow= 2 
    331367//      Button MatrixButton,pos={12,205},size={60,20},proc=ToMatrixButtonProc,title="Matrix",disable=2 
    332368        Button DoItButton,pos={21,632},size={80,20},proc=DoTheFitsButtonProc,title="Do the fits" 
    333         Button savePathButton,pos={82,61},size={80,20},proc=SavePathButtonProc,title="Save Path..." 
     369//      Button savePathButton,pos={82,61},size={80,20},proc=SavePathButtonProc,title="Save Path..." 
    334370        TitleBox tb1,pos={139,634},size={128,12},anchor=MC,variable=root:AutoFit:gStatus,frame=0 
    335371        Button button0,pos={14,331},size={40,20},title="Plot",proc=LoadForGuessProc 
     
    340376        Button GuessConstrB,pos={198,440},size={50,20},title="Guess",disable=1,proc=UseConstraintsAsGuess 
    341377         
     378        TitleBox infoTitleBox pos={180,470},fixedSize=1,size={96,130},variable=root:AutoFit:guessStr 
     379         
    342380        ValDisplay progressValdisp,pos={113,663},size={161,7},title="00:00" 
    343381        ValDisplay progressValdisp,limits={0,root:AutoFit:endProgress,0},barmisc={0,0},value= root:AutoFit:curProgress 
     382         
     383        Button AF_DoneButton,pos={174,30},size={70,20},proc=AF_DoneButtonProc,title="Done" 
     384        Button AF_HelpButton,pos={260,30},size={30,20},proc=AF_HelpButtonProc,title="?" 
     385 
    344386EndMacro 
     387 
     388// close the panel 
     389// + other windows? 
     390// 
     391Proc AF_DoneButtonProc(ctrlName): ButtonControl 
     392        String ctrlName 
     393        DoWindow/K AutoFitPanel 
     394end 
     395 
     396//open the Help file for the AutoFit Panel 
     397Function AF_HelpButtonProc(ba) : ButtonControl 
     398        STRUCT WMButtonAction &ba 
     399 
     400        switch( ba.eventCode ) 
     401                case 2: // mouse up 
     402                        // click code here 
     403                        DisplayHelpTopic/Z/K=1 "Auto Fit" 
     404                        if(V_flag !=0) 
     405                                DoAlert 0,"The Auto Fit Help file could not be found" 
     406                        endif 
     407                        break 
     408        endswitch 
     409 
     410        return 0 
     411End 
    345412 
    346413 
     
    395462        Variable tab 
    396463         
     464        String infoStr="",guessStr,holdStr,constStr,rangeStr 
     465        SVAR str0 = root:AutoFit:guessStr 
     466        SVAR str1 = root:AutoFit:holdStr 
     467        SVAR str2 = root:AutoFit:constStr 
     468        SVAR str3 = root:AutoFit:rangeStr 
     469         
     470         
     471         
    397472        Button FillAllGuessButton disable= (tab!=0) 
    398473        Button GuessCoefB disable=(tab!=0) 
    399474        ListBox guessBox disable= (tab!=0) 
    400475         
     476         
    401477        Button FillAllHoldButton disable= (tab!=1) 
    402478        Button GuessHoldB disable=(tab!=1) 
     
    410486        ListBox RangeBox disable=(tab!=3) 
    411487        Button FillAllRangeB disable= (tab!=3) 
     488         
     489        if(tab==0) 
     490                TitleBox infoTitleBox variable=str0 
     491        endif 
     492        if(tab==1) 
     493                TitleBox infoTitleBox variable=str1 
     494        endif 
     495        if(tab==2) 
     496                TitleBox infoTitleBox variable=str2 
     497        endif 
     498        if(tab==3) 
     499                TitleBox infoTitleBox variable=str3 
     500        endif 
     501         
    412502         
    413503        return(0) 
     
    13861476                namestr = namestr[0,30]         //if shorter than 31, this will NOT pad to 31 characters 
    13871477                Print "file saved as ",nameStr 
    1388                 SaveNotebook /O/P=savePath/S=2 Report as nameStr 
     1478//              SaveNotebook /O/P=savePath/S=2 Report as nameStr 
     1479                SaveNotebook /O/P=home/S=2 Report as nameStr 
    13891480        Endif 
    13901481 
    13911482        //save a pict file, just of the graph 
    1392         namestr = "PICT_" + namestr 
     1483        namestr = "PNG_" + namestr 
    13931484        namestr = namestr[0,28]         //PICT names in IGOR must be shorter, to allow auto-naming? 
    13941485        DoWindow/F AutoGraph_NSE 
    1395         SavePICT /E=2/O/I/P=savePath /W=(0,0,3,3) as nameStr 
     1486//      SavePICT /E=2/O/I/P=savePath /W=(0,0,3,3) as nameStr 
     1487        SavePICT /E=2/O/I/P=home /W=(0,0,3,3) as nameStr 
    13961488End 
    13971489 
     
    14941586End 
    14951587 
    1496 Proc Generate_PICTS_list() 
    1497         fGenerate_PICTS_list() 
    1498 End 
    1499  
    1500 //spits up a list of PICTS 
    1501 Function fGenerate_PICTS_list() 
    1502  
    1503         String List=IndexedFile(savePath, -1, "PICT") 
    1504         List2TextWave(List,";","PICT_files") 
    1505         WAVE/T picts=$"PICT_files" 
    1506         Edit/K=1 picts 
    1507 End 
    1508  
    1509 Proc Layout_PICTS(pStr) 
     1588Proc Generate_PNG_list() 
     1589        fGenerate_PNG_list() 
     1590End 
     1591 
     1592//spits up a list of PNGS 
     1593Function fGenerate_PNG_list() 
     1594 
     1595//      String List=IndexedFile(savePath, -1, ".png") 
     1596        String List=IndexedFile(home, -1, ".png") 
     1597        List2TextWave(List,";","PNG_files") 
     1598        WAVE/T PNGs=$"PNG_files" 
     1599        Edit/K=1 PNGs 
     1600End 
     1601 
     1602Proc Layout_PNGS(pStr) 
    15101603        String pStr="" 
    1511         Prompt pStr,"wave of PICTs to use",popup,WaveList("PICT_f*", ";", "") 
     1604        Prompt pStr,"wave of PNGs to use",popup,WaveList("PNG_f*", ";", "") 
    15121605                 
    15131606        String List=TextWave2List($pStr,";") 
    15141607        String item = "" 
    1515         //kill old picts 
     1608        //kill old picts from memory 
    15161609        KillPicts/A/Z 
    15171610        //make a new layout 
    1518         Layout/C=1 as "PICT_Layout" 
    1519         DoWindow/C PICTLayout 
     1611        Layout/C=1 as "PNG_Layout" 
     1612        DoWindow/C PNGLayout 
    15201613        do 
    15211614                item=StringFromList(0,List,";") 
    1522                 //load each PICT, and append it to the layout 
     1615                //load each PNG, and append it to the layout 
    15231616                Print "load item = ",item 
    1524                 LoadPICT /O/Q/P=savePath item 
    1525                 DoWindow/F PICTLayout           //be sure layout is on top 
    1526                 AppendLayoutObject /F=1/W=PICTLayout picture  $item 
     1617//              LoadPICT /O/Q/P=savePath item 
     1618                LoadPICT /O/Q/P=home item 
     1619                DoWindow/F PNGLayout            //be sure layout is on top 
     1620                AppendLayoutObject /F=1/W=PNGLayout picture  $CleanupName(item,0) 
    15271621                //AppendToLayout $item 
    15281622                //Print item 
    15291623                List = RemoveFromList(item, List, ";") 
    15301624        while(ItemsInList(List, ";")>0) 
    1531         //tile the PICTs in the layout 
     1625        //tile the PNGs in the layout 
    15321626        Tile/O=8 
    15331627End 
     
    15561650Proc CompileAndLoadReports() 
    15571651        Compile_Reports() 
    1558         SaveNotebook /O/P=savePath/S=2 Compilation 
     1652//      SaveNotebook /O/P=savePath/S=2 Compilation 
     1653        SaveNotebook /O/P=home/S=2 Compilation 
    15591654//      Print "Saved as:  ",S_Path 
    15601655        DoWindow/K Compilation 
     
    15671662End 
    15681663 
    1569 Proc Compile_Reports(Number_of_Parameters) 
    1570         Variable Number_of_Parameters=7 
     1664Proc Compile_Reports(Number_of_Parameters,tagStr) 
     1665        Variable Number_of_Parameters=(root:AutoFit:numPar) 
     1666        String tagStr="v1" 
     1667 
     1668        fCompile_ReportsTable(Number_of_Parameters,tagStr) 
     1669 
    15711670        fCompile_Reports(Number_of_Parameters) 
    1572         fCompile_ReportsTable(Number_of_Parameters) 
     1671         
     1672        DoWindow/F AutoFitResults 
     1673 
    15731674End 
    15741675 
     
    16241725                GetSelection notebook,$item,2 
    16251726                textStr=S_Selection 
    1626                 Print textStr 
     1727                 
     1728//              Print textStr 
    16271729                 
    16281730                sscanf textStr,"Npnts = %g\t\tSqrt(X^2/N) = %g\r",dum,chi 
     
    16411743//// 
    16421744// compiles the results into a table. 
    1643 Function fCompile_ReportsTable(nPar) 
     1745// add tagStr to the end to (try) to make sure that the compilations are unique 
     1746Function fCompile_ReportsTable(nPar,tagStr) 
    16441747        Variable nPar 
     1748        String tagStr 
    16451749         
    16461750        String list=WinList("*", ";", "WIN:16") 
     
    16511755        numRep=ItemsInList(list,";") 
    16521756         
    1653         Make/O/T/N=(numRep) fittedFiles 
    1654         Make/O/D/N=(numRep) chiSQ 
    1655         Edit fittedFiles,chiSQ 
     1757        Make/O/T/N=(numRep) $("fittedFiles"+"_"+tagStr) 
     1758        Make/O/D/N=(numRep) $("chiSQ"+"_"+tagStr) 
     1759        Wave/T fittedFiles = $("fittedFiles"+"_"+tagStr) 
     1760        Wave chiSq = $("chiSQ"+"_"+tagStr) 
     1761        Edit/N=AutoFitResults fittedFiles,chiSQ 
    16561762         
    16571763        for(ii=0;ii<nPar;ii+=1)         //waves for the parameters 
    1658                 Make/O/D/N=(numRep) $("par"+num2str(ii)),$("par"+num2str(ii)+"_err") 
    1659                 AppendToTable $("par"+num2str(ii)),$("par"+num2str(ii)+"_err") 
     1764                Make/O/D/N=(numRep) $("par"+num2str(ii)+"_"+tagStr),$("par"+num2str(ii)+"_err"+"_"+tagStr) 
     1765                AppendToTable $("par"+num2str(ii)+"_"+tagStr),$("par"+num2str(ii)+"_err"+"_"+tagStr) 
    16601766        endfor 
    16611767         
     
    16841790                        sscanf textStr,"= \t%g\t ± \t%g\r",val1,val2 
    16851791                         
    1686                         Print textStr 
     1792//                      Print textStr 
    16871793                                                 
    1688                         Wave w1 = $("par"+num2str(ii)) 
    1689                         Wave w2 = $("par"+num2str(ii)+"_err") 
     1794                        Wave w1 = $("par"+num2str(ii)+"_"+tagStr) 
     1795                        Wave w2 = $("par"+num2str(ii)+"_err"+"_"+tagStr) 
    16901796                         
    16911797                        w1[jj] = val1 
     
    17031809                GetSelection notebook,$item,2 
    17041810                textStr=S_Selection 
    1705                 Print textStr 
     1811                 
     1812//              Print textStr 
    17061813                 
    17071814                sscanf textStr,"Npnts = %g\t\tSqrt(X^2/N) = %g\r",dum,chi 
     
    17091816                chiSQ[jj] = chi  
    17101817        endfor 
     1818         
    17111819         
    17121820        return(0) 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/Wrapper_v40.ipf

    r901 r911  
    11971197                //save the graph separately as a PNG file, 2x screen 
    11981198                pictStr += nameStr 
    1199                 pictStr = pictStr[0,28]         //need a shorter name - why? 
     1199                pictStr = pictStr[0,24]+".png"          //need a shorter name - only 29 characters allowed - why? 
    12001200//              DoWindow/F $topGraph 
    12011201                // E=-5 is png @screen resolution 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf

    r902 r911  
    804804// returns the random deviate as a wave 
    805805// and the total SAS cross-section [1/cm] sig_sas 
     806// 
     807// MAY 2013 
     808// -- now this calculation is done adaptively, with very little speed hit. When doing either the  
     809// 1D SANS or USANS simulations, the longest time spent is for the re-calculation of a smeared model. Not this. 
     810// -- now I calculate USANS from 1e-7 to qu/100, (then qu ~ 0.05) and for SANS, qmin = 1e-4 (everything else is behind 
     811//    the beamstop) and is not really "seen" 
     812// 
     813// I key on the wavelength to determine if it's USANS data 
     814// 
     815// I can verify the calculation by calculating the exact SASxs for a sphere using SAS_XS_Sphere() below 
     816// 
    806817Function CalculateRandomDeviate(func,coef,lam,outWave,SASxs) 
    807818        FUNCREF SANSModelAAO_MCproto func 
     
    811822        Variable &SASxs 
    812823 
    813         Variable nPts_ran=10000,qu 
    814         qu = 4*pi/lam            
    815          
    816 // hard-wired into the Simulation directory rather than the SAS folder. 
    817 // plotting resolution-smeared models won't work any other way 
    818         Make/O/N=(nPts_ran)/D root:Simulation:Gq,root:Simulation:xw             // if these waves are 1000 pts, the results are "pixelated" 
    819         WAVE Gq = root:Simulation:gQ 
    820         WAVE xw = root:Simulation:xw 
    821         SetScale/I x (0+1e-4),qu*(1-1e-10),"", Gq,xw                    //don't start at zero or run up all the way to qu to avoid numerical errors 
    822  
    823 /// if all of the coefficients are well-behaved, then the last point is the background 
    824 // and I can set it to zero here (only for the calculation) 
    825         Duplicate/O coef,tmp_coef 
    826         Variable num=numpnts(coef) 
    827         tmp_coef[num-1] = 0 
    828          
    829         xw=x                                                                                            //for the AAO 
    830         func(tmp_coef,Gq,xw)                                                                    //call as AAO 
    831  
    832 //      Gq = x*Gq                                                                                                       // SAS approximation 
    833         Gq = Gq*sin(2*asin(x/qu))/sqrt(1-(x/qu))                        // exact 
    834         // 
    835         // 
    836         Integrate/METH=1 Gq/D=Gq_INT 
    837          
    838 //      SASxs = lam*lam/2/pi*Gq_INT[nPts_ran-1]                 //if the approximation is used 
    839         SASxs = lam*Gq_INT[nPts_ran-1] 
    840          
    841         Gq_INT /= Gq_INT[nPts_ran-1] 
     824        Variable nPts_ran=5000,qu,qu_scale=1,SASxs_old,qmin=1e-4 
     825        qu = 4*pi/lam    
     826         
     827         
     828        SASxs = 0 
     829        do 
     830                nPts_ran *= 2                   //first pass -- it starts at 2*5000= 10000 
     831                SASxs_old = SASxs               // "old" value is zero 
     832         
     833                // make qu much smaller if it's a call from USANS. then the points are spaced to the lower values as is necessary 
     834                // - qu of 5.2 is way too high for USANS-sized objects 
     835                if(lam < 2.9 && nPts_ran > 100000)              // USANS lam = 2.4 
     836                        qu_scale = 100 
     837                        qmin = 1e-7 
     838                endif    
     839                 
     840        // hard-wired into the Simulation directory rather than the SAS folder. 
     841        // plotting resolution-smeared models won't work any other way 
     842                Make/O/N=(nPts_ran)/D root:Simulation:Gq,root:Simulation:xw             // if these waves are 1000 pts, the results are "pixelated" 
     843                WAVE Gq = root:Simulation:gQ 
     844                WAVE xw = root:Simulation:xw 
     845                SetScale/I x (0+qmin),qu/qu_scale*(1-1e-10),"", Gq,xw                   //don't start at zero or run up all the way to qu to avoid numerical errors 
     846         
     847        /// if all of the coefficients are well-behaved, then the last point is the background 
     848        // and I can set it to zero here (only for the calculation) 
     849                Duplicate/O coef,tmp_coef 
     850                Variable num=numpnts(coef) 
     851                tmp_coef[num-1] = 0 
     852                 
     853                xw=x                                                                                            //for the AAO 
     854                func(tmp_coef,Gq,xw)                                                                    //call as AAO 
     855         
     856//              Gq = x*Gq                                                                                                       // SAS approximation 
     857                Gq = Gq*sin(2*asin(x/qu))/sqrt(1-(x/qu))                        // exact 
     858                // 
     859                // 
     860                Integrate/METH=1 Gq/D=Gq_INT 
     861                 
     862        //      SASxs = lam*lam/2/pi*Gq_INT[nPts_ran-1]                 //if the approximation is used 
     863                SASxs = lam*Gq_INT[nPts_ran-1] 
     864                 
     865                Gq_INT /= Gq_INT[nPts_ran-1] 
     866         
     867//              Print "nPts_ran, SASxs = ",nPts_ran, SASxs 
     868                 
     869        while( abs((SASxs_old-SASxs)/SASxs) > 0.02 && nPts_ran < 1e6)           // allow 5% error in XS 
    842870         
    843871        Duplicate/O Gq_INT $outWave 
    844  
     872         
     873//      Variable realXS 
     874//      realXS = SAS_XS_Sphere(coef,.1,lam) 
     875//      Print "Analytical XS = ",realXS 
     876         
    845877        return(0) 
    846878End 
     
    866898 
    867899        Variable nPts_ran=1000,qu,qmin,ii 
    868         qmin=1e-5 
     900        qmin=1e-7 
    869901        qu = 4*pi/lam            
    870902 
    871903// hard-wired into the Simulation directory rather than the SAS folder. 
    872904// plotting resolution-smeared models won't work any other way 
    873         Make/O/N=(nPts_ran)/D root:Simulation:Gq,root:Simulation:xw             // if these waves are 1000 pts, the results are "pixelated" 
    874         WAVE Gq = root:Simulation:gQ 
    875         WAVE xw = root:Simulation:xw 
     905        Make/O/N=(nPts_ran)/D root:Simulation:Gq_log,root:Simulation:xw_log             // if these waves are 1000 pts, the results are "pixelated" 
     906        WAVE Gq_log = root:Simulation:gQ_log 
     907        WAVE xw_log = root:Simulation:xw_log 
    876908//      SetScale/I x (0+1e-4),qu*(1-1e-10),"", Gq,xw                    //don't start at zero or run up all the way to qu to avoid numerical errors 
    877         xw =  alog(log(qmin) + x*((log(qu)-log(qmin))/nPts_ran)) 
     909        xw_log =  alog(log(qmin) + x*((log(qu)-log(qmin))/nPts_ran)) 
    878910 
    879911/// if all of the coefficients are well-behaved, then the last point is the background 
     
    883915        tmp_coef[num-1] = 0 
    884916         
    885         func(tmp_coef,Gq,xw)                                                                    //call as AAO 
    886         Gq = Gq*sin(2*asin(xw/qu))/sqrt(1-(xw/qu))                      // exact 
    887  
    888          
    889         Duplicate/O Gq Gq_INT 
    890         Gq_INT = 0 
     917        func(tmp_coef,Gq_log,xw_log)                                                                    //call as AAO 
     918        Gq_log = Gq_log*sin(2*asin(xw_log/qu))/sqrt(1-(xw_log/qu))                      // exact 
     919 
     920         
     921        Duplicate/O Gq_log Gq_INT_log 
     922        Gq_INT_log = 0 
    891923        for(ii=0;ii<nPts_ran;ii+=1) 
    892                 Gq_INT[ii] = AreaXY(xw,Gq,qmin,xw[ii]) 
     924                Gq_INT_log[ii] = AreaXY(xw_log,Gq_log,qmin,xw_log[ii]) 
    893925        endfor 
    894926         
    895         SASxs = lam*Gq_INT[nPts_ran-1] 
    896          
    897         Gq_INT /= Gq_INT[nPts_ran-1] 
     927        SASxs = lam*Gq_INT_log[nPts_ran-1] 
     928         
     929        Gq_INT_log /= Gq_INT_log[nPts_ran-1] 
     930         
     931         
     932        // now, before copying back, interpolate to a linear spacing 
     933        nPts_ran=100000                 //gobs of points 
     934        Make/O/N=(nPts_ran)/D root:Simulation:Gq,root:Simulation:xw             // if these waves are 1000 pts, the results are "pixelated" 
     935        WAVE Gq = root:Simulation:gQ 
     936        WAVE xw = root:Simulation:xw 
     937        SetScale/I x (qmin),qu*(1-1e-10),"", Gq,xw                      //don't start at zero or run up all the way to qu to avoid numerical errors 
     938        Duplicate/O Gq,Gq_INT 
     939        WAVE Gq_INT = root:Gq_INT               //keeps the same scaling 
     940 
     941        Gq_INT = interp(x,xw_log,Gq_INT_log) 
     942         
     943         
    898944         
    899945        Duplicate/O Gq_INT $outWave 
    900946 
    901947        return(0) 
     948End 
     949 
     950// 
     951// coef_sf must exist and be passed 
     952// 
     953Function SAS_XS_Sphere(cw,thick,lam) 
     954        Wave cw 
     955        Variable thick,lam 
     956         
     957        Variable SASxs,rad,Rg,phi,sld_s,sld_solv,rg2,i0,uval,tau,trans 
     958         
     959        phi = cw[0] 
     960        rad = cw[1] 
     961        sld_s = cw[2] 
     962        sld_solv = cw[3] 
     963         
     964 
     965        i0 = 4/3*pi*rad^3*(sld_s-sld_solv)^2*phi 
     966        Rg2 = 3/5*rad^2 
     967        Uval = (thick*1e8)*i0*lam^2/Rg2         // convert thick to A, and all cancels out 
     968 
     969        tau = 27/40/pi*uval 
     970         
     971        SASxs = tau/thick               // keep thick in cm here, so that SASxs is in cm^-1 
     972        trans = exp(-tau) 
     973         
     974        Print "SAS XS(cm^-1) = ",SASxs 
     975        Print "Est Trans = ",trans 
     976         
     977        return(SASxs) 
    902978End 
    903979 
     
    21722248        // subtracted before the calculation. 
    21732249        CalculateRandomDeviate(funcUnsmeared,$coefStr,wavelength,"root:Packages:NIST:SAS:ran_dev",sig_sas) 
    2174          
     2250 
     2251        if(sig_sas > 100) 
     2252                DoAlert 0,"SAS cross section > 100. Estimates of multiple scattering are unreliable. Choosing a model with a well-defined Rg may help" 
     2253        endif            
    21752254//                              if(sig_sas > 100) 
    21762255//                                      sprintf abortStr,"sig_sas = %g. Please check that the model coefficients have a zero background, or the low q is well-behaved.",sig_sas 
     
    22672346         
    22682347//      Simulate_1D_EmptyCell("TwoLevel_EC",aveint,qval,sigave,sigmaq,qbar,fsubs) 
     2348 
    22692349        Simulate_1D_EmptyCell("EC_Empirical",aveint,qval,sigave,sigmaq,qbar,fsubs) 
    22702350         
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf

    r901 r911  
    15291529 
    15301530 
    1531 // JAN 2013 -- Using John's measured values from 23 JAN 2013 
    1532 // 
    1533 // there are 13 discrete wavelengths in NGBLambda = 13 (only 10 used for 30m) 
    1534 // there are only 9 attenuators, not 10 as in the 30m 
     1531// xxxx JAN 2013 -- Using John's measured values from 23 JAN 2013 
     1532// 
     1533// xxxx there are 13 discrete wavelengths in NGBLambda = 13 (only 10 used for 30m) 
     1534// xxxx there are only 9 attenuators, not 10 as in the 30m 
     1535// 
     1536// -- updated MAY 2013 -- 
     1537// K. Weigandt's calibration  
     1538// 12 discrete wavelengths 
     1539// 10 attenuators 
    15351540// 
    15361541Proc MakeNGBAttenTable() 
     
    15381543        NewDataFolder/O root:myGlobals:Attenuators 
    15391544         
    1540         Variable num=13         //13 needed for tables to cover 3A - 30A 
     1545//      Variable num=13         //13 needed for tables to cover 3A - 30A 
     1546        Variable num=12         //12 needed for tables to cover 3A - 30A 
    15411547         
    15421548        Make/O/N=(num) root:myGlobals:Attenuators:NGBatt0 
     
    15501556        Make/O/N=(num) root:myGlobals:Attenuators:NGBatt8 
    15511557        Make/O/N=(num) root:myGlobals:Attenuators:NGBatt9 
    1552 //      Make/O/N=(num) root:myGlobals:Attenuators:NGBatt10 
     1558        Make/O/N=(num) root:myGlobals:Attenuators:NGBatt10 
    15531559         
    15541560        // and a wave for the errors at each attenuation factor 
     
    15631569        Make/O/N=(num) root:myGlobals:Attenuators:NGBatt8_err 
    15641570        Make/O/N=(num) root:myGlobals:Attenuators:NGBatt9_err 
    1565 //      Make/O/N=(num) root:myGlobals:Attenuators:NGBatt10_err   
     1571        Make/O/N=(num) root:myGlobals:Attenuators:NGBatt10_err   
    15661572         
    15671573        //NGB wave has 13 elements, the transmission of att# at the wavelengths  
     
    15691575        // note that some of the higher attenuations and ALL of the 30A data is interpolated 
    15701576        // none of these values are expected to be used in reality since the flux would be too low in practice 
    1571         Make/O/N=(num) root:myGlobals:Attenuators:NGBlambda={3,4,5,6,7,8,10,12,14,17,20,25,30} 
    1572  
    1573 // New calibration, Jan 2013 John Barker 
     1577//      Make/O/N=(num) root:myGlobals:Attenuators:NGBlambda={3,4,5,6,7,8,10,12,14,17,20,25,30}          //this is for 13 wavelengths 
     1578        Make/O/N=(num) root:myGlobals:Attenuators:NGBlambda={3,4,5,6,8,10,12,14,16,20,25,30}            // 12 wavelengths, MAY 2013 
     1579 
     1580 
     1581// new calibrations MAY 2013 
    15741582        root:myGlobals:Attenuators:NGBatt0 = {1,1,1,1,1,1,1,1,1,1,1,1,1}         
    1575         root:myGlobals:Attenuators:NGBatt1 = {0.522,0.476,0.42007,0.39298,0.36996,0.35462,0.31637,0.29422,0.27617,0.24904,0.22263,0.18525,0.15} 
    1576         root:myGlobals:Attenuators:NGBatt2 = {0.27046,0.21783,0.17405,0.15566,0.13955,0.1272,0.10114,0.087289,0.077363,0.063607,0.051098,0.0357,0.023} 
    1577         root:myGlobals:Attenuators:NGBatt3 = {0.12601,0.090906,0.064869,0.054644,0.046916,0.041169,0.028926,0.023074,0.019276,0.014244,0.01021,0.006029,0.0033} 
    1578         root:myGlobals:Attenuators:NGBatt4 = {0.057782,0.037886,0.024727,0.019499,0.015719,0.013041,0.0080739,0.0059418,0.0046688,0.0031064,0.0020001,0.0010049,0.0005} 
    1579         root:myGlobals:Attenuators:NGBatt5 = {0.026627,0.016169,0.0096679,0.0071309,0.0052982,0.0040951,0.0021809,0.001479,0.001096,0.00066564,0.00039384,0.0002,9e-05} 
    1580         root:myGlobals:Attenuators:NGBatt6 = {0.0091671,0.0053041,0.0029358,0.0019376,0.0013125,0.00096946,0.00042126,0.0002713,0.00019566,0.00011443,5e-05,3e-05,1.2e-05} 
    1581         root:myGlobals:Attenuators:NGBatt7 = {0.0017971,0.00089679,0.00040572,0.0002255,0.00013669,8.7739e-05,3.3373e-05,2.0759e-05,1.5624e-05,1e-05,8e-06,4e-06,2.1e-06} 
    1582         root:myGlobals:Attenuators:NGBatt8 = {0.00033646,0.00012902,4.6033e-05,2.414e-05,1.4461e-05,9.4644e-06,4.8121e-06,4e-06,3e-06,2e-06,1e-06,7e-07,3.3e-07} 
    1583         root:myGlobals:Attenuators:NGBatt9 = {7e-05,2e-05,8.2796e-06,4.5619e-06,3.1543e-06,2.6216e-06,8e-07,6e-07,4e-07,3e-07,2e-07,1e-07,5e-08} 
    1584 //      root:myGlobals:Attenuators:NGBatt10 = {} 
    1585  
    1586   // percent errors as measured, Jan 2013 values 
     1583        root:myGlobals:Attenuators:NGBatt1 = {0.512,0.474,0.418,0.392,0.354,0.325,0.294,0.27,0.255,0.222,0.185,0.155} 
     1584        root:myGlobals:Attenuators:NGBatt2 = {0.268,0.227,0.184,0.16,0.129,0.108,0.0904,0.0777,0.0689,0.0526,0.0372,0.0263} 
     1585        root:myGlobals:Attenuators:NGBatt3 = {0.135,0.105,0.0769,0.0629,0.0455,0.0342,0.0266,0.0212,0.0178,0.0117,0.007,0.00429} 
     1586        root:myGlobals:Attenuators:NGBatt4 = {0.0689,0.0483,0.0324,0.0249,0.016,0.0109,0.00782,0.00583,0.0046,0.00267,0.00135,0.000752} 
     1587        root:myGlobals:Attenuators:NGBatt5 = {0.0348,0.0224,0.0136,0.00979,0.0056,0.00347,0.0023,0.0016,0.0012,0.000617,0.000282,0.000155} 
     1588        root:myGlobals:Attenuators:NGBatt6 = {0.018,0.0105,0.00586,0.00398,0.00205,0.00115,0.000709,0.000467,0.000335,0.000157,7.08e-05,4e-05} 
     1589        root:myGlobals:Attenuators:NGBatt7 = {0.00466,0.00226,0.00104,0.000632,0.00026,0.000123,6.8e-05,4.26e-05,3e-05,1.5e-05,8e-06,4e-06} 
     1590        root:myGlobals:Attenuators:NGBatt8 = {0.00121,0.000488,0.000187,0.000101,3.52e-05,1.61e-05,9.79e-06,7.68e-06,4.4e-06,2e-06,1e-06,5e-07} 
     1591        root:myGlobals:Attenuators:NGBatt9 = {0.000312,0.000108,3.53e-05,1.78e-05,6.6e-06,4.25e-06,2e-06,1.2e-06,9e-07,4e-07,1.6e-07,9e-08} 
     1592        root:myGlobals:Attenuators:NGBatt10 = {8.5e-05,2.61e-05,8.24e-06,4.47e-06,2.53e-06,9e-07,5e-07,3e-07,2e-07,1e-07,4e-08,2e-08} 
     1593 
     1594  // percent errors as measured, MAY 2013 values 
    15871595  // zero error for zero attenuators, large values put in for unknown values (either 2% or 5%) 
    15881596        root:myGlobals:Attenuators:NGBatt0_err = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 
    1589         root:myGlobals:Attenuators:NGBatt1_err = {0.12116,0.111059,0.150188,0.15168,0.174434,0.218745,0.0938678,0.144216,0.2145,0.141995,0.153655,0.157188,5} 
    1590         root:myGlobals:Attenuators:NGBatt2_err = {0.183583,0.19981,0.278392,0.286518,0.336599,0.240429,0.190996,0.178529,0.266807,0.23608,0.221334,0.245336,5} 
    1591         root:myGlobals:Attenuators:NGBatt3_err = {0.271054,0.326341,0.30164,0.31008,0.364188,0.296638,0.1914,0.22433,0.340313,0.307021,0.279339,0.319965,5} 
    1592         root:myGlobals:Attenuators:NGBatt4_err = {0.333888,0.361023,0.356208,0.368968,0.437084,0.322955,0.248284,0.260956,0.402069,0.368168,0.337252,0.454958,5} 
    1593         root:myGlobals:Attenuators:NGBatt5_err = {0.365745,0.433845,0.379735,0.394999,0.470603,0.357534,0.290938,0.291193,0.455465,0.426855,0.434639,2,5} 
    1594         root:myGlobals:Attenuators:NGBatt6_err = {0.402066,0.470239,0.410136,0.432342,0.523241,0.389247,0.333352,0.325301,0.517036,0.539386,2,2,5} 
    1595         root:myGlobals:Attenuators:NGBatt7_err = {0.542334,0.549954,0.45554,0.497426,0.624473,0.454971,0.432225,0.464043,0.752858,2,5,5,5} 
    1596         root:myGlobals:Attenuators:NGBatt8_err = {0.704775,0.673556,0.537178,0.62027,0.814375,0.582449,0.662811,2,2,5,5,5,5} 
    1597         root:myGlobals:Attenuators:NGBatt9_err = {2,2,0.583513,0.685477,0.901413,0.767115,2,5,5,5,5,5,5} 
    1598 //      root:myGlobals:Attenuators:NGBatt10_err = {}   
     1597        root:myGlobals:Attenuators:NGBatt1_err = {0.174,0.256,0.21,0.219,0.323,0.613,0.28,0.135,0.195,0.216,0.214,19.8} 
     1598        root:myGlobals:Attenuators:NGBatt2_err = {0.261,0.458,0.388,0.419,0.354,0.668,0.321,0.206,0.302,0.305,0.315,31.1} 
     1599        root:myGlobals:Attenuators:NGBatt3_err = {0.319,0.576,0.416,0.448,0.431,0.688,0.37,0.247,0.368,0.375,0.41,50.6} 
     1600        root:myGlobals:Attenuators:NGBatt4_err = {0.41,0.611,0.479,0.515,0.461,0.715,0.404,0.277,0.416,0.436,0.576,111} 
     1601        root:myGlobals:Attenuators:NGBatt5_err = {0.549,0.684,0.503,0.542,0.497,0.735,0.428,0.3,0.456,0.538,1.08,274} 
     1602        root:myGlobals:Attenuators:NGBatt6_err = {0.61,0.712,0.528,0.571,0.52,0.749,0.446,0.333,0.515,0.836,2.28,5} 
     1603        root:myGlobals:Attenuators:NGBatt7_err = {0.693,0.76,0.556,0.607,0.554,0.774,0.516,0.56,0.924,5,5,5} 
     1604        root:myGlobals:Attenuators:NGBatt8_err = {0.771,0.813,0.59,0.657,0.612,0.867,0.892,1.3,5,5,5,5} 
     1605        root:myGlobals:Attenuators:NGBatt9_err = {0.837,0.867,0.632,0.722,0.751,1.21,5,5,5,5,5,5} 
     1606        root:myGlobals:Attenuators:NGBatt10_err = {0.892,0.921,0.715,0.845,1.09,5,5,5,5,5,5,5}   
     1607 
     1608 
     1609//// (old) New calibration, Jan 2013 John Barker 
     1610//      root:myGlobals:Attenuators:NGBatt0 = {1,1,1,1,1,1,1,1,1,1,1,1,1}         
     1611//      root:myGlobals:Attenuators:NGBatt1 = {0.522,0.476,0.42007,0.39298,0.36996,0.35462,0.31637,0.29422,0.27617,0.24904,0.22263,0.18525,0.15} 
     1612//      root:myGlobals:Attenuators:NGBatt2 = {0.27046,0.21783,0.17405,0.15566,0.13955,0.1272,0.10114,0.087289,0.077363,0.063607,0.051098,0.0357,0.023} 
     1613//      root:myGlobals:Attenuators:NGBatt3 = {0.12601,0.090906,0.064869,0.054644,0.046916,0.041169,0.028926,0.023074,0.019276,0.014244,0.01021,0.006029,0.0033} 
     1614//      root:myGlobals:Attenuators:NGBatt4 = {0.057782,0.037886,0.024727,0.019499,0.015719,0.013041,0.0080739,0.0059418,0.0046688,0.0031064,0.0020001,0.0010049,0.0005} 
     1615//      root:myGlobals:Attenuators:NGBatt5 = {0.026627,0.016169,0.0096679,0.0071309,0.0052982,0.0040951,0.0021809,0.001479,0.001096,0.00066564,0.00039384,0.0002,9e-05} 
     1616//      root:myGlobals:Attenuators:NGBatt6 = {0.0091671,0.0053041,0.0029358,0.0019376,0.0013125,0.00096946,0.00042126,0.0002713,0.00019566,0.00011443,5e-05,3e-05,1.2e-05} 
     1617//      root:myGlobals:Attenuators:NGBatt7 = {0.0017971,0.00089679,0.00040572,0.0002255,0.00013669,8.7739e-05,3.3373e-05,2.0759e-05,1.5624e-05,1e-05,8e-06,4e-06,2.1e-06} 
     1618//      root:myGlobals:Attenuators:NGBatt8 = {0.00033646,0.00012902,4.6033e-05,2.414e-05,1.4461e-05,9.4644e-06,4.8121e-06,4e-06,3e-06,2e-06,1e-06,7e-07,3.3e-07} 
     1619//      root:myGlobals:Attenuators:NGBatt9 = {7e-05,2e-05,8.2796e-06,4.5619e-06,3.1543e-06,2.6216e-06,8e-07,6e-07,4e-07,3e-07,2e-07,1e-07,5e-08} 
     1620////    root:myGlobals:Attenuators:NGBatt10 = {} 
     1621// 
     1622//  // percent errors as measured, Jan 2013 values 
     1623//  // zero error for zero attenuators, large values put in for unknown values (either 2% or 5%) 
     1624//      root:myGlobals:Attenuators:NGBatt0_err = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 
     1625//      root:myGlobals:Attenuators:NGBatt1_err = {0.12116,0.111059,0.150188,0.15168,0.174434,0.218745,0.0938678,0.144216,0.2145,0.141995,0.153655,0.157188,5} 
     1626//      root:myGlobals:Attenuators:NGBatt2_err = {0.183583,0.19981,0.278392,0.286518,0.336599,0.240429,0.190996,0.178529,0.266807,0.23608,0.221334,0.245336,5} 
     1627//      root:myGlobals:Attenuators:NGBatt3_err = {0.271054,0.326341,0.30164,0.31008,0.364188,0.296638,0.1914,0.22433,0.340313,0.307021,0.279339,0.319965,5} 
     1628//      root:myGlobals:Attenuators:NGBatt4_err = {0.333888,0.361023,0.356208,0.368968,0.437084,0.322955,0.248284,0.260956,0.402069,0.368168,0.337252,0.454958,5} 
     1629//      root:myGlobals:Attenuators:NGBatt5_err = {0.365745,0.433845,0.379735,0.394999,0.470603,0.357534,0.290938,0.291193,0.455465,0.426855,0.434639,2,5} 
     1630//      root:myGlobals:Attenuators:NGBatt6_err = {0.402066,0.470239,0.410136,0.432342,0.523241,0.389247,0.333352,0.325301,0.517036,0.539386,2,2,5} 
     1631//      root:myGlobals:Attenuators:NGBatt7_err = {0.542334,0.549954,0.45554,0.497426,0.624473,0.454971,0.432225,0.464043,0.752858,2,5,5,5} 
     1632//      root:myGlobals:Attenuators:NGBatt8_err = {0.704775,0.673556,0.537178,0.62027,0.814375,0.582449,0.662811,2,2,5,5,5,5} 
     1633//      root:myGlobals:Attenuators:NGBatt9_err = {2,2,0.583513,0.685477,0.901413,0.767115,2,5,5,5,5,5,5} 
     1634////    root:myGlobals:Attenuators:NGBatt10_err = {}   
    15991635   
    16001636End 
     
    18421878                case "NGA": 
    18431879                case "NGB": 
    1844 //                      Print "Using the NG7 table for NGB *** this needs to be updated ***" 
    18451880                        attenFactor = LookupAttenNGB(lam,attenNo,atten_err) 
    18461881                        break 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/U_CALC.ipf

    r807 r911  
    904904                // -there are only a few points in the USANS range, and extending it lower caused issues before. 
    905905                CalculateRandomDeviate(funcUnsmeared,$coefStr,wavelength,"root:Packages:NIST:SAS:ran_dev",sig_sas) 
    906                  
     906 
     907                if(sig_sas > 100) 
     908                        DoAlert 0,"SAS cross section > 100. Estimates of multiple scattering are unreliable. Choosing a model with a well-defined Rg may help" 
     909                endif                    
    907910//              if(sig_sas > 100) 
    908911//                      sprintf abortStr,"sig_sas = %g. Please check that the model coefficients have a zero background, or the low q is well-behaved.",sig_sas 
     
    930933 
    931934                Print "Sig_sas = ",sig_sas 
    932                  
     935                Print "Estimated Transmission = ",estTrans 
    933936                 
    934937                Duplicate/O qvals prob_i 
Note: See TracChangeset for help on using the changeset viewer.