Help reproducing fitparams task
See original GitHub issueDisclaimer: This is not an issue with photutils
. I’m just out of ideas and I don’t where else to turn for help. I will therefore understand completely if this is closed on the spot. That said, I will really appreciate any help you could give me, since I’ve been trying to figure this out for weeks now.
I’m trying to reproduce the fitparams task from the photcal
package.
I’ve already sent en email to the STScI (the developers of Pyraf), posted in the IRAF forum, and even wrote to Lindsey Davis. The STScI guys told me they don’t work with this package and I should ask in the forum, the forum post has been sitting there for ~20 days (it doesn’t look like it’s going to receive an answer), and I never got a response from Dr Davis.
In page 32 of the A user’s guide to stellar CCD photometry with IRAF guide, an output of doing a :vshow
in fitparams
is shown in Fig 27:
Where function, fit
are the observed and predicted values in the best found least squares regression, residuals=function-fit
, and I have no idea how sigma
is obtained or what it represents (issue 1. below). I’d like to reproduce the statistical values found for the fit. I can (almost) reproduce most of these:
standard deviation 0.0214969
reduced chi 1.0036573
average error 0.0214577
average scatter ?
RMS 0.0183326
as follows :
-
standard deviation
sum_sq = np.sum((function - fit) ** 2) nu = len(function) - deg stddev = np.sqrt(sum_sq / nu)
where
deg=3
since 3 parameters parameters are being fitted. -
reduced chi
chisq = np.sum(((function - fit) / sigma) ** 2) nu = len(function) - deg red_chi = chisq / nu
-
average error
avrg_error = stddev / np.sqrt(red_chi)
-
average scatter
avrg_scatter = ?
-
RMS
RMS = np.sqrt(((function - fit) ** 2).mean())
The issues I find are:
-
I don’t know how the
sigma
column (rightmost column in Fig 27) is obtained. Following the trace, I see that theiraf/pkg/xtools/inlfit/ingresults.gx
file writes to that column the following values:(sqrt (PIXEL (1.0) / Mem$t[wts1+i-1]))
I assume
Mem$t[wts1+i-1]
is some kind of standard deviation? I tried diving in deeper into the code, but the language used (some kind of mixture betweenC
andFortran
?) looks like an impossible mess to decipher to me. -
I can not reproduce the
average scatter
value. I have no idea what formula is used. I’ve tried several to no avail. -
Most of the statistical parameters shown above (except the
average scatter
) are almost reproduced using those equations. There are visible differences nonetheless, which I can only assign to floating point rounding errors byfitparams
(as long as the formulas shown above are correct).
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
@Gabriel-p I’ve just approved your request to join the FB group.
@kelle is one of the admins there (I’m not sure who else), they can add you as a member.