question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Help reproducing fitparams task

See original GitHub issue

Disclaimer: 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:

captura realizada el 2017-05-23 16 36 17

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:

  1. I don’t know how the sigma column (rightmost column in Fig 27) is obtained. Following the trace, I see that the iraf/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 between C and Fortran?) looks like an impossible mess to decipher to me.

  2. I can not reproduce the average scatter value. I have no idea what formula is used. I’ve tried several to no avail.

  3. 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 by fitparams (as long as the formulas shown above are correct).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
kellecommented, May 31, 2017

@Gabriel-p I’ve just approved your request to join the FB group.

1reaction
bsipoczcommented, May 31, 2017

@kelle is one of the admins there (I’m not sure who else), they can add you as a member.

Read more comments on GitHub >

github_iconTop Results From Across the Web

fitparams produces an ERROR: segmentation violation - iraf.net
I have IRAF 2.15.1a 64bits on a GNU/Linux Ubuntu system and I get a [b:e6f2534c1b]segmentation violation[/b:e6f2534c1b] when I try to use ...
Read more >
CHARMM c39b2 fitparam.doc - NIH HPC
Correct accounting for charge multiplicity will help FITPARAM to provide meaningful information about total charge of the optimized molecule.
Read more >
How to pass a parameter to only one part of a pipeline object ...
I've provided much more information, and hopefully it is enough to reproduce the error. Let me know if it is still not clear....
Read more >
Question 2: The code in the cell below has errors. | Chegg.com
Your task is to find all mistakes, remove them, make the code function ... It is strongly recommended to start the exercise by...
Read more >
iraf/bugs.log at master · joequant/iraf - GitHub
STATUS: The bug has been fixed in IRAF 2.10 and the help page which uses ... BUG: The fitparams task could produce incorrect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found