lenstronomy.LensModel.Util package¶
Submodules¶
lenstronomy.LensModel.Util.epl_util module¶
- min_approx(x1, x2, x3, y1, y2, y3)[source]¶
Get the x-value of the minimum of the parabola through the points (x1,y1), …
- Parameters:
x1 – x-coordinate point 1
x2 – x-coordinate point 2
x3 – x-coordinate point 3
y1 – y-coordinate point 1
y2 – y-coordinate point 2
y3 – y-coordinate point 3
- Returns:
x-location of the minimum
- cdot(a, b)[source]¶
Calculates some complex dot-product that simplifies the math :param a: complex number :param b: complex number :return: dot-product.
- ps(x, p)[source]¶
A regularized power-law that gets rid of singularities, abs(x)**p*sign(x) :param x: x :param p: p :return:
- cart_to_pol(x, y)[source]¶
Convert from cartesian to polar :param x: x-coordinate :param y: y-coordinate :return: tuple of (r, theta)
- pol_to_cart(r, th)[source]¶
Convert from polar to cartesian :param r: r-coordinate :param th: theta- coordinate :return: tuple of (x,y)
- geomlinspace(a, b, N)[source]¶
Constructs a geomspace from a to b, with a linspace prepended to it from 0 to a, with the same spacing as the geomspace would have at a.
- solvequadeq(a, b, c)[source]¶
Solves a quadratic equation.
Care is taken for the numerics, see also https://en.wikipedia.org/wiki/Loss_of_significance :param a: a :param b: b :param c: c :return: tuple of two solutions
- brentq_nojit(f, xa, xb, xtol=2e-14, rtol=3.552713678800501e-15, maxiter=100, args=())[source]¶
A numba-compatible implementation of brentq (largely copied from scipy.optimize.brentq).
Unfortunately, the scipy verison is not compatible with numba, hence this reimplementation :( :param f: function to optimize :param xa: left bound :param xb: right bound :param xtol: x-coord root tolerance :param rtol: x-coord relative tolerance :param maxiter: maximum num of iterations :param args: additional arguments to pass to function in the form f(x, args) :return:
- brentq_inline(f, xa, xb, xtol=2e-14, rtol=3.552713678800501e-15, maxiter=100, args=())¶
A numba-compatible implementation of brentq (largely copied from scipy.optimize.brentq).
Unfortunately, the scipy verison is not compatible with numba, hence this reimplementation :( :param f: function to optimize :param xa: left bound :param xb: right bound :param xtol: x-coord root tolerance :param rtol: x-coord relative tolerance :param maxiter: maximum num of iterations :param args: additional arguments to pass to function in the form f(x, args) :return: