caseresearch / code-review

⛔️ [DEPRECATED] A repo for code review sessions at CAS. ⛔️ [DEPRECATED] See
https://github.com/swincas/code-review
MIT License
0 stars 41 forks source link

sersic fit #3

Closed leoniechevalier closed 7 years ago

leoniechevalier commented 7 years ago

A couple of problems on how to use python to fit a sersic profile. the code works on synthetic data but produces odd results for my dataset.

Archive.zip

manodeep commented 7 years ago

Can you give a little more details about the exact problem you are having? Or better yet a plot or two to demonstrate what's going wrong.

For instance, are you facing a python runtime error, or the returned fits are vastly wrong etc..

leoniechevalier commented 7 years ago

As it turned out my fitting issue were largely related to my dataset (now hopefully fixed). I attached the slightly changed notebook and data. It now returns more believable values. Archive.zip

manodeep commented 7 years ago

Fantastic. Do you want to tell us how you figured out the issue during code review?

leoniechevalier commented 7 years ago

distance bins (arcmin) : [ 0.25 0.55 0.775 1. 1.23333333] density:[ 40.10704566 20.61779945 22.40304184 11.93662073 7.09745016]

manodeep commented 7 years ago

What does the MLE say: https://www.johndcook.com/blog/2015/11/24/estimating-the-exponent-of-discrete-power-law-data/

leoniechevalier commented 7 years ago

The offset that was still present was due to a missing normalisation factor. The code was outputting the average surface density at the effective radius and not the surface density at the effective radius. The code now produces very good fits surface_density_revised