Changeset 313


Ignore:
Timestamp:
Apr 21, 2008 4:50:24 PM (14 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. Same change propogated to the Analysis macros.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.10/FIT_Ops.ipf

    r300 r313  
    631631// **cursors are already on the graph, done by Rescale_Data() 
    632632// 
     633// will expand the scale to show an extra 5 points in each direction (if available) 
    633634Function AdjustAxisToCursors() 
    634635 
     
    637638        WAVE yAxisWave = root:yAxisWave 
    638639        Variable xlow,xhigh,ylow,yhigh,yptlow,ypthigh 
    639          
    640         //x-levels 
    641         xlow = xAxisWave[xcsr(A)] 
    642         xhigh = xAxisWave[xcsr(B)] 
    643         if(xlow > xhigh) 
    644                 xhigh = xlow 
    645                 xlow = xAxisWave[xcsr(B)] 
    646         endif 
    647          
    648         //y-levels 
    649         FindLevel/P/Q xAxisWave, xlow 
    650         if(V_flag == 1)                 //level NOT found 
    651                 DoAlert 0,"Lower q-limit not in experimental q-range. Re-enter a better value" 
    652         endif 
    653         yptlow = V_LevelX 
    654         FindLevel/P/Q xAxisWave, xhigh 
    655         if(V_flag == 1) 
    656                 DoAlert 0,"Upper q-limit not in experimental q-range. Re-enter a better value" 
    657         endif 
    658         ypthigh = V_LevelX 
     640        Variable extraPts = 5, num=numpnts(xAxisWave) 
     641         
     642        String csrA = CsrInfo(A ,"FitWindow") 
     643        String csrB = CsrInfo(B ,"FitWindow") 
     644         
     645        //x-levels, these are monotonic 
     646        Variable ptLow,ptHigh,tmp 
     647        ptLow = NumberByKey("POINT", csrA ,":" ,";") 
     648        ptHigh = NumberByKey("POINT", csrB ,":" ,";") 
     649        if(ptLow > ptHigh) 
     650                tmp= ptLow 
     651                ptLow=ptHigh 
     652                ptHigh=tmp 
     653        endif 
     654 
     655        // keep extended point range in bounds 
     656        ptLow = (ptLow-extraPts) >= 0 ? ptLow-extraPts : 0 
     657        ptHigh = (ptHigh+extraPts) <= (num-1) ? ptHigh + extraPts : num-1 
     658         
     659        xlow = xAxisWave[ptLow] 
     660        xhigh = xAxisWave[ptHigh] 
     661//old way 
     662//      xlow = xAxisWave[xcsr(A)] 
     663//      xhigh = xAxisWave[xcsr(B)] 
     664//      if(xlow > xhigh) 
     665//              xhigh = xlow 
     666//              xlow = xAxisWave[xcsr(B)] 
     667//      endif 
     668         
     669        //y-levels (old way) 
     670//      FindLevel/P/Q xAxisWave, xlow 
     671//      if(V_flag == 1)                 //level NOT found 
     672//              DoAlert 0,"Lower q-limit not in experimental q-range. Re-enter a better value" 
     673//      endif 
     674//      yptlow = V_LevelX 
     675//      FindLevel/P/Q xAxisWave, xhigh 
     676//      if(V_flag == 1) 
     677//              DoAlert 0,"Upper q-limit not in experimental q-range. Re-enter a better value" 
     678//      endif 
     679//      ypthigh = V_LevelX 
    659680 
    660681//      Print xlow,xhigh,yptlow,ypthigh 
    661682//      Print yAxisWave[yptlow],yAxisWave[ypthigh] 
    662683         
     684 
     685        // make sure ylow/high are in the correct order, since the slope could be + or - 
     686        yhigh = max(yAxisWave[ptlow],yAxisWave[pthigh]) 
     687        ylow = min(yAxisWave[ptlow],yAxisWave[pthigh]) 
     688         
     689//      Print ptLow,ptHigh 
     690//      print xlow,xhigh 
     691//      print ylow,yhigh 
     692         
    663693        SetAxis bottom,xlow,xhigh 
    664         // make sure ylow/high are in the correct order 
    665         Variable temp 
    666         yhigh = max(yAxisWave[yptlow],yAxisWave[ypthigh]) 
    667         ylow = min(yAxisWave[yptlow],yAxisWave[ypthigh]) 
    668694        SetAxis left ylow,yhigh 
    669695         
    670696End 
     697 
    671698 
    672699//**************************************** 
Note: See TracChangeset for help on using the changeset viewer.