-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feature/shapelets #91
Conversation
lower_limit: -inf | ||
upper_limit: inf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gaussian limits are implicitly infinite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like to keep them there so users know they exist (I know this is source code but principle still applies).
def __init__( | ||
self, | ||
n: int, | ||
m: int, | ||
centre: Tuple[float, float] = (0.0, 0.0), | ||
beta: float = 1.0, | ||
): | ||
""" | ||
Shapelets where the basis function is defined according to a Exponential (r,theta) grid of coordinates. | ||
|
||
Shapelets are defined according to: | ||
|
||
https://arxiv.org/abs/astro-ph/0105178 | ||
|
||
Shapelets are are described in the context of strong lens modeling in: | ||
|
||
https://ui.adsabs.harvard.edu/abs/2016MNRAS.457.3066T/abstract | ||
|
||
Parameters | ||
---------- | ||
n_y | ||
The order of the shapelets basis function in the y-direction. | ||
n_x | ||
The order of the shapelets basis function in the x-direction. | ||
centre | ||
The (y,x) arc-second coordinates of the profile (shapelet) centre. | ||
beta | ||
The characteristic length scale of the shapelet basis function, defined in arc-seconds. | ||
""" | ||
|
||
super().__init__(n=n, m=m, centre=centre, ell_comps=(0.0, 0.0), beta=beta) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if there's any point in this constructor?
def __init__( | ||
self, | ||
n: int, | ||
m: int, | ||
centre: Tuple[float, float] = (0.0, 0.0), | ||
beta: float = 1.0, | ||
): | ||
""" | ||
Shapelets where the basis function is defined according to a Polar (r,theta) grid of coordinates. | ||
|
||
Shapelets are defined according to: | ||
|
||
https://arxiv.org/abs/astro-ph/0105178 | ||
|
||
Shapelets are are described in the context of strong lens modeling in: | ||
|
||
https://ui.adsabs.harvard.edu/abs/2016MNRAS.457.3066T/abstract | ||
|
||
Parameters | ||
---------- | ||
n_y | ||
The order of the shapelets basis function in the y-direction. | ||
n_x | ||
The order of the shapelets basis function in the x-direction. | ||
centre | ||
The (y,x) arc-second coordinates of the profile (shapelet) centre. | ||
beta | ||
The characteristic length scale of the shapelet basis function, defined in arc-seconds. | ||
""" | ||
|
||
super().__init__(n=n, m=m, centre=centre, ell_comps=(0.0, 0.0), beta=beta) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with this one. You could just put docs at the class level and not bother with the init
def test__image_2d_from(): | ||
|
||
shapelet = ag.lp_shapelets.ShapeletExponential( | ||
n=2, m=0, centre=(0.0, 0.0), beta=1.0 | ||
) | ||
|
||
image = shapelet.image_2d_from(grid=np.array([[0.0, 1.0], [0.5, 0.25]])) | ||
|
||
assert image == pytest.approx(np.array([0.05784, 0.17962]), 1e-4) | ||
|
||
shapelet = ag.lp_shapelets.ShapeletExponential( | ||
n=2, m=0, centre=(0.2, 0.4), beta=1.0 | ||
) | ||
|
||
image = shapelet.image_2d_from(grid=np.array([[0.0, 1.0], [0.5, 0.25]])) | ||
|
||
assert image == pytest.approx(np.array([0.16136, 0.22476]), 1e-4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be separated into two separate tests
|
||
import autogalaxy as ag | ||
|
||
grid = np.array([[1.0, 1.0], [2.0, 2.0], [3.0, 3.0], [2.0, 4.0]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly safer to define this as a fixture in case the array is mutated in a test
Implement Shapelets in their various forms.
Example scripts here:
https://github.com/Jammy2211/autogalaxy_workspace/blob/main/scripts/imaging/modeling/advanced/light_shapelets.py
https://github.com/Jammy2211/autolens_workspace/blob/main/scripts/imaging/modeling/advanced/shapelets.py