Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moffat maxK computation : Galsim 2.4-> 2.5 #52

Open
jecampagne opened this issue Aug 28, 2023 · 1 comment
Open

Moffat maxK computation : Galsim 2.4-> 2.5 #52

jecampagne opened this issue Aug 28, 2023 · 1 comment

Comments

@jecampagne
Copy link
Collaborator

This issue is to keep in mind that the maxK computation of Untruncated Moffat is the 2.4.x versions of Glasim will be changed in the 2.5.x versions. The JAX-Galsim Moffat code will have to be adapted accordingly. Some formula are discussed in the PR #49.

@jecampagne
Copy link
Collaborator Author

One way to make the maxK search for untruncated Moffat, is to use the approx 2D functions of (beta, gsparam.maxk_threshold) parameters

def nlm3(x,y):
    return -0.871303 \
    + 2125.34*jnp.exp(548.446*x*y) \
    + (-1.0 + x)**0.551405 * (2.3663 - 0.496395 * y) \
    - 1.78113*y

def nlm4(x,y):
    return -54.7189 \
    + (-1.0 + x)**0.0151804 * (60.3922 + 0.118008 * y) \
    + jnp.exp(0.118008*x*y)* (-4.87159 + 0.690609 * y) - 2.10138*y

def sigmoide(x):
    return 1.0/(1.0 + jnp.exp(-x*5.0))

@jax.jit
def approx(beta, thr):
  y = jnp.log10(thr)
  w = sigmoide(beta-2.0)
  return w * nlm3(beta,y) + (1.0-w) * nlm4(beta,y)

it has been fitted for beta in [1.001,100] and threshold in [10^-6, 10^-2], but this function can be used to get a bracket intervalle of the true maxK value, to use jaxopt Bisection algorithm if one wants a better approx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant