[Ifeffit] Residual

Matt Newville newville at cars.uchicago.edu
Mon Mar 7 14:41:51 CST 2005


Dear Ye,

> sorry to reply so late due to our exp in SSRL.

No problem. I think we all understand the results of beamtime, 
and we're just glad that SSRL is back!!


I also get an effectively NULL residual with your project.  
It's not exactly identical to the data, but it's very close. For
other fits, the plotting of the residual definitely works, so I
started looking into what could be the issue with this fit.

First, it's a pretty complicated fit, and some of the parameters
(notably your delA, delB parameters) are not very well
constrained by the data -- that is they give pretty weird values
and uncertainties.....  For this kind of diagnosis it would
really help to simplify the problem.

Second, and more important, the arrays for your chi(k)  data is
not on a uniform k-grid with delta k = 0.05 Ang^-1.  In fact, it
looks like it there are many repeated k=0 values at the
beginning of chi(k) array.  I think this is screwing up the
taking of the residual for the following reason:

The fit in the feffit() command itself does not require the data
to start out on a uniform or delta_k=0.05 grid, but it does
internally put the data on such a grid, and does calculate the
best-fit chi(k) on this grid.

Anyway, the point is that Artemis is subtly assuming the chi(k)  
data is on this grid when it calculates the residual.  It simply
subtracts the best fit .chi array from the data .chi array,
which is done point-by-point.  If the data and fit are not on
the same k-grids, the subtraction is pretty much useless.

A long-term improvement in Artemis could be to make sure the
Data and Fit are on the same grid for calculating the residual.

A more immediate fix for you would be to save the chi(k) data on 
the standard chi(k) grid.  Here's one way to do that:
 1 In Artemis, click the Data and do File->Save Data as... chi(k).
   note that this file will contain all the data, including the
   repeated zeros, and the non-uniform grid.
 2 Read this file into Athena (where you'll be warned about 
   the repeated values of 0), and save it as chi(k).  This will 
   be on the standard delta_k=0.05 grid.
 3 Use this data in Artemis.

Hope that helps,

--Matt





More information about the Ifeffit mailing list