Ignore:
Timestamp:
Apr 21, 2008 4:51:10 PM (15 years ago)
Author:
srkline
Message:

Changes to the Linear fit to show +/- 5 points from the selected fit range to give a broader view of what was fitted. Sa
me change propogated to the Reduction macros.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v4.00/Packages/LinearizedFits/LinearizedFits_v40.ipf

    r273 r314  
    636636// **cursors are already on the graph, done by Rescale_Data() 
    637637// 
     638// will expand the scale to show an extra 5 points in each direction (if available) 
    638639Function A_AdjustAxisToCursors() 
    639640 
     
    642643        WAVE yAxisWave = root:yAxisWave 
    643644        Variable xlow,xhigh,ylow,yhigh,yptlow,ypthigh 
    644          
    645         //x-levels 
    646         xlow = xAxisWave[xcsr(A)] 
    647         xhigh = xAxisWave[xcsr(B)] 
    648         if(xlow > xhigh) 
    649                 xhigh = xlow 
    650                 xlow = xAxisWave[xcsr(B)] 
    651         endif 
    652          
    653         //y-levels 
    654         FindLevel/P/Q xAxisWave, xlow 
    655         if(V_flag == 1)                 //level NOT found 
    656                 DoAlert 0,"Lower q-limit not in experimental q-range. Re-enter a better value" 
    657         endif 
    658         yptlow = V_LevelX 
    659         FindLevel/P/Q xAxisWave, xhigh 
    660         if(V_flag == 1) 
    661                 DoAlert 0,"Upper q-limit not in experimental q-range. Re-enter a better value" 
    662         endif 
    663         ypthigh = V_LevelX 
     645        Variable extraPts = 5, num=numpnts(xAxisWave) 
     646         
     647        String csrA = CsrInfo(A ,"A_FitWindow") 
     648        String csrB = CsrInfo(B ,"A_FitWindow") 
     649         
     650        //x-levels, these are monotonic 
     651        Variable ptLow,ptHigh,tmp 
     652        ptLow = NumberByKey("POINT", csrA ,":" ,";") 
     653        ptHigh = NumberByKey("POINT", csrB ,":" ,";") 
     654        if(ptLow > ptHigh) 
     655                tmp= ptLow 
     656                ptLow=ptHigh 
     657                ptHigh=tmp 
     658        endif 
     659 
     660        // keep extended point range in bounds 
     661        ptLow = (ptLow-extraPts) >= 0 ? ptLow-extraPts : 0 
     662        ptHigh = (ptHigh+extraPts) <= (num-1) ? ptHigh + extraPts : num-1 
     663         
     664        xlow = xAxisWave[ptLow] 
     665        xhigh = xAxisWave[ptHigh] 
     666//old way 
     667//      xlow = xAxisWave[xcsr(A)] 
     668//      xhigh = xAxisWave[xcsr(B)] 
     669//      if(xlow > xhigh) 
     670//              xhigh = xlow 
     671//              xlow = xAxisWave[xcsr(B)] 
     672//      endif 
     673         
     674        //y-levels (old way) 
     675//      FindLevel/P/Q xAxisWave, xlow 
     676//      if(V_flag == 1)                 //level NOT found 
     677//              DoAlert 0,"Lower q-limit not in experimental q-range. Re-enter a better value" 
     678//      endif 
     679//      yptlow = V_LevelX 
     680//      FindLevel/P/Q xAxisWave, xhigh 
     681//      if(V_flag == 1) 
     682//              DoAlert 0,"Upper q-limit not in experimental q-range. Re-enter a better value" 
     683//      endif 
     684//      ypthigh = V_LevelX 
    664685 
    665686//      Print xlow,xhigh,yptlow,ypthigh 
    666687//      Print yAxisWave[yptlow],yAxisWave[ypthigh] 
    667688         
     689 
     690        // make sure ylow/high are in the correct order, since the slope could be + or - 
     691        yhigh = max(yAxisWave[ptlow],yAxisWave[pthigh]) 
     692        ylow = min(yAxisWave[ptlow],yAxisWave[pthigh]) 
     693         
     694//      Print ptLow,ptHigh 
     695//      print xlow,xhigh 
     696//      print ylow,yhigh 
     697         
    668698        SetAxis bottom,xlow,xhigh 
    669         // make sure ylow/high are in the correct order 
    670         Variable temp 
    671         yhigh = max(yAxisWave[yptlow],yAxisWave[ypthigh]) 
    672         ylow = min(yAxisWave[yptlow],yAxisWave[ypthigh]) 
    673699        SetAxis left ylow,yhigh 
    674700         
     
    679705// 
    680706 
    681 //function called byt the popups to get a file list of data that can be sorted 
     707//function called by the popups to get a file list of data that can be sorted 
    682708// this procedure simply removes the raw data files from the string - there 
    683709//can be lots of other junk present, but this is very fast... 
Note: See TracChangeset for help on using the changeset viewer.