Jammy2211 / PyAutoGalaxy

PyAutoGalaxy: Open-Source Multiwavelength Galaxy Structure & Morphology
https://pyautogalaxy.readthedocs.io/
MIT License
28 stars 14 forks source link

Calculate critical curves using JAX #207

Closed CKrawczyk closed 2 weeks ago

CKrawczyk commented 2 weeks ago

This overhauls the current critical curve method from a grid search to an application of Newton's method for zero finding.

The steps are as follows:

1) Create a set of n_points initial points in a circle of radius init_r and centred on init_centre

2) Apply n_steps of Newton's method to these points in the "radial" direction only (i.e. keeping the angle fixed). Jax's auto differentiation is used to find the radial derivatives of the eigenvalue function for this step.

3) Filter the results and only keep points that have their eigenvalue threshold of 0. This step is needed because Newton's method will fail when the radial derivative is equal to zero (i.e. near a max or min of the eigenvalue).

No underlying grid is needed for this method, but the quality of the results are dependent on the initial circle of points. For best results, the circle should be drawn around each max/min of the eigenvalue function. This is typically the centre of each mass in the profile.