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

Feature/shapelets #91

Merged
merged 13 commits into from
Mar 3, 2023
Merged

Feature/shapelets #91

merged 13 commits into from
Mar 3, 2023

Conversation

Comment on lines +6 to +7
lower_limit: -inf
upper_limit: inf
Copy link
Collaborator

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

Copy link
Owner Author

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).

Comment on lines +106 to +136
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)
Copy link
Collaborator

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?

Comment on lines +104 to +134
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)
Copy link
Collaborator

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

Comment on lines +10 to +26
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)
Copy link
Collaborator

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]])
Copy link
Collaborator

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

@Jammy2211 Jammy2211 merged commit e148b23 into main Mar 3, 2023
@Jammy2211 Jammy2211 deleted the feature/shapelets branch June 12, 2023 15:37
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

Successfully merging this pull request may close these issues.

None yet

2 participants