Autostronomy / AutoProf

Automatic Isophotal solutions for galaxy images
https://autoprof.readthedocs.io/
GNU General Public License v3.0
27 stars 4 forks source link

Axis Ratio issue with fit of Sersic Profile #11

Open JordanDucatel opened 9 months ago

JordanDucatel commented 9 months ago

Hello,

I am using AutoProf v0.7.3 to fit Sersic profiles to a set of galaxies with the Levenberg-Marquardt fitting method. I run into the issue that a large portion of my sample has a fitted axis ratio q = b/a ~ 1, despite not looking like circles in the data.

I believe that this is cause by the initial guess for the fit made by AutoProf misidentifying the semi-major (a) and semi-minor (b) axis. Since the fitting parameters are the semi-major axis (a) and axis ratio (q), when trying to improve on the initial guess with new iterations, the fits get 'stuck' with 'a' parameter being the size of the semi-minor axis and 'q' parameter ~ 1 (or slightly less). Note that the position angle (tilt of the ellipse) is also a parameter in the fit, but it would have to rotate by ~90 degrees to fix this issue which would be unlikely happen with this least square fitting method.

To solve this issue, I changed the prior on the 'q' parameter from 0 < q < 1 (default) to 0 < q < 10. Now the galaxies fits which where stuck at q ~ 1 go to q > 1 but with the 'a' parameter now representing the semi-minor instead of the semi-major axis. Therefor the real axis ratio, which by definition is q = b/a, now is a/b. To make everything consistent, I add in my code after the fit a line 'if q > 1: q = 1/q' so that my axis ratio still represents semi-minor/semi-major axis and are all between 0 and 1.

I have tested this solution against the SExtractor measurement for this axis ratio (ELONGATION = a/b = 1/q), and it seems to work. I have attached a plot with a sample of 400 galaxies to better visualize what I described. In blue are the galaxies with q ~ 1 and red the normal galaxies. The blue data points which were refitted with the new q prior now have a better distribution similar to the red data points, and match better the SExtractor found axis ratio. Note that the data I am using is relatively low signal and contains noise. Visual checks show that this suggested solution fixes the issue.

Best,

Jordan

update_roundness_problem_plot

ConnorStoneAstro commented 9 months ago

Hi @JordanDucatel , thanks for identifying this! First, I have to apologize for the confusion, but this project has migrated to a new name AstroPhot which can be found here: https://github.com/Autostronomy/AstroPhot . If possible, it would be great if you could update to the latest version (pip install astrophot) to see if the problem is fixed since there have been some improvements to the initialization since version 0.7.3 (we are now on version 0.14.2)

Ok, on the problem at hand, this is very interesting! I would like to keep the definition of q=b/a so perhaps we can figure out how to improve the initial parameters so that a and b don't get flipped. That said, if everything can be solved by relaxing the allowed q range, that is a workable fix. Do you have an example that you could attach so I can see how the initialization/fitting is failing?