[Ifeffit] Re: I should be able to find this somewhere...

Matt Newville newville at cars.uchicago.edu
Tue Jan 17 16:09:26 CST 2006

Hi Matthew, Bruce,

OK, I think it's a bug.  Well, maybe it's just a consequence of a
"known but not well advertised" problem.

The chi(k) data you have doesn't start at k=0.  By itself, this should
be OK, and the fit seems to be mostly fine.  There seems to be a bug
in Ifeffit that the output fit chi(k) has the same number of data
points as the input chi(k) data. In this case is incorrect -- it
should go to the last data point in k.  From looking at the code, I'm
pretty sure this has no effect on the fit and is only an error in the
output array.  But the shortened chi_fit(k) will have an impact on the
way Bruce is calculating the residual.   Even if that were fixed, the
residual would still be wrong, as the residual in Artemis is
calculated as
   set(data0_res.k = data0.k)
   set(data0_res.chi = data0.chi - data0_fit.chi)

and then Fourier transforming to R-space.   Since the data and fit
aren't aligned in k-space, the residual is incorrect.  It should be

  set(data0_res.chi = data0.chi - interp(data0_fit.k, data0_fit.chi, data0.k))

or some variation on that.

Sorry for the trouble.  It's definitely a result of narrow-mindedly
expecting that all chi(k) data comes from Ifeffit/Athena and will
always start at k=0.  We should get this fixed (it's mostly there!) so
that data from other sources can be used.  Right now, the easiest
work-around is to pre-pack the chi(k) data with zeros (starting from


More information about the Ifeffit mailing list