[AstroPy] Info LevMarLSQFitter

Peter Dzwig pdzwig at summaventures.com
Tue May 12 08:16:32 EDT 2020


Diana,

How much are you varying the parameters in ini? Are you varying them by
only a very small amount or by a substantial amount.

I was going to suggest that you might be finding local minima in the
solution when I read Zé's comments.

Do you consistently get the same results if you repeat the run with
identical values? I am trying to understand whether your issue is: (a)
the algorithm itself; (b) sensitivity to initial conditions; or (c) some
issue with your code.

Peter Dzwig

On 12/05/2020 10:17, Zé Vinícius wrote:
> Hi Diana,
> 
> From my understanding, LevMarLSQFitter uses the least-squares function
> as the objective to be minimized using the Levenberg-Marquardt algorithm.
> 
> Because Sersic2D is a non-linear model on the parameters to be fitted,
> the problem is most likely non-convex, which means that
> Levenberg-Marquardt only guarantees to find a local solution, which will
> depend on the initial value for those parameters.
> 
> Best,
>> 
> On Tue, May 12, 2020 at 4:53 PM Diana Scognamiglio
> <dianasco at astro.uni-bonn.de <mailto:dianasco at astro.uni-bonn.de>> wrote:
> 
>     __
> 
>     Dear Astropy Staff,
> 
>     I am Diana Scognamiglio and I have some problems to deep understand
>     how LevMarLSQFitter works.
> 
>     I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter
>     classe, coding these lines:
> 
>      
> 
>      
> 
>     ini_mod =
>     EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0)
> 
>     fitter = fitting.LevMarLSQFitter()
> 
>     fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6,
>     estimate_jacobian=False)  
> 
>      
> 
>     I have figured out that if I change the initial parameters in
>     ini_mod (i.e., ini_flux, ini_r_eff, etc), I counterintuitively
>     obtain always a different result although the galaxy I am fitting is
>     the same. How does the fit depend on those initial parameters?
> 
>     Please, can you help me with this issue?
> 
>     Thank you in advance.
> 
>     I wait for hearing from you.
> 
>     Best regards,
> 
>     Diana Scognamiglio
> 
>      
> 
>     _______________________________________________
>     AstroPy mailing list
>     AstroPy at python.org <mailto:AstroPy at python.org>
>     https://mail.python.org/mailman/listinfo/astropy
> 
> 
> 
> -- 
> Zé Vinícius
> https://mirca.github.io
> 
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org
> https://mail.python.org/mailman/listinfo/astropy
> 

-- 

Dr. Peter Dzwig


More information about the AstroPy mailing list