Skip to content

Commit c017003

Browse files
authored
Merge pull request #351 from PyAutoLabs/feature/data-typing-simplify
refactor: rename aa.grid_dec to aa.decorators
2 parents 447a2fd + e9afeef commit c017003

33 files changed

Lines changed: 157 additions & 157 deletions

autogalaxy/galaxy/galaxies.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def image_2d_list_from(
109109
for galaxy in self
110110
]
111111

112-
@aa.grid_dec.to_array
112+
@aa.decorators.to_array
113113
def image_2d_from(
114114
self, grid: aa.type.Grid2DLike, xp=np, operated_only: Optional[bool] = None
115115
) -> aa.Array2D:
@@ -175,7 +175,7 @@ def galaxy_image_2d_dict_from(
175175

176176
return galaxy_image_2d_dict
177177

178-
@aa.grid_dec.to_vector_yx
178+
@aa.decorators.to_vector_yx
179179
def deflections_yx_2d_from(
180180
self, grid: aa.type.Grid2DLike, xp=np, **kwargs
181181
) -> np.ndarray:
@@ -201,7 +201,7 @@ def deflections_yx_2d_from(
201201
"""
202202
return sum(map(lambda g: g.deflections_yx_2d_from(grid=grid, xp=xp), self))
203203

204-
@aa.grid_dec.to_grid
204+
@aa.decorators.to_grid
205205
def traced_grid_2d_from(
206206
self, grid: aa.type.Grid2DLike, xp=np
207207
) -> aa.type.Grid2DLike:
@@ -210,7 +210,7 @@ def traced_grid_2d_from(
210210
"""
211211
return grid - self.deflections_yx_2d_from(grid=grid, xp=xp)
212212

213-
@aa.grid_dec.to_array
213+
@aa.decorators.to_array
214214
def convergence_2d_from(
215215
self, grid: aa.type.Grid2DLike, xp=np, **kwargs
216216
) -> np.ndarray:
@@ -236,7 +236,7 @@ def convergence_2d_from(
236236
"""
237237
return sum(map(lambda g: g.convergence_2d_from(grid=grid, xp=xp), self))
238238

239-
@aa.grid_dec.to_array
239+
@aa.decorators.to_array
240240
def potential_2d_from(
241241
self, grid: aa.type.Grid2DLike, xp=np, **kwargs
242242
) -> np.ndarray:

autogalaxy/galaxy/galaxy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def image_2d_list_from(
210210
)
211211
]
212212

213-
@aa.grid_dec.to_array
213+
@aa.decorators.to_array
214214
def image_2d_from(
215215
self,
216216
grid: aa.type.Grid2DLike,
@@ -246,7 +246,7 @@ def image_2d_from(
246246
)
247247
return xp.zeros((grid.shape[0],))
248248

249-
@aa.grid_dec.to_vector_yx
249+
@aa.decorators.to_vector_yx
250250
def deflections_yx_2d_from(
251251
self, grid: aa.type.Grid2DLike, xp=np, **kwargs
252252
) -> np.ndarray:
@@ -277,7 +277,7 @@ def deflections_yx_2d_from(
277277

278278
return xp.zeros((grid.shape[0], 2))
279279

280-
@aa.grid_dec.to_array
280+
@aa.decorators.to_array
281281
def convergence_2d_from(
282282
self, grid: aa.type.Grid2DLike, xp=np, **kwargs
283283
) -> np.ndarray:
@@ -318,7 +318,7 @@ def half_light_radius(self):
318318
"""
319319
return None
320320

321-
@aa.grid_dec.to_grid
321+
@aa.decorators.to_grid
322322
def traced_grid_2d_from(
323323
self, grid: aa.type.Grid2DLike, xp=np
324324
) -> aa.type.Grid2DLike:
@@ -355,7 +355,7 @@ def traced_grid_2d_from(
355355

356356
return grid - self.deflections_yx_2d_from(grid=grid, xp=xp)
357357

358-
@aa.grid_dec.to_array
358+
@aa.decorators.to_array
359359
def potential_2d_from(
360360
self, grid: aa.type.Grid2DLike, xp=np, **kwargs
361361
) -> np.ndarray:

autogalaxy/galaxy/mock/mock_galaxy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ def __init__(self, value, shape=1):
88
self.value = value
99
self.shape = shape
1010

11-
@aa.grid_dec.to_array
11+
@aa.decorators.to_array
1212
def image_2d_from(self, grid):
1313
return np.full(shape=self.shape, fill_value=self.value)
1414

15-
@aa.grid_dec.to_array
15+
@aa.decorators.to_array
1616
def convergence_2d_from(self, grid):
1717
return np.full(shape=self.shape, fill_value=self.value)
1818

19-
@aa.grid_dec.to_array
19+
@aa.decorators.to_array
2020
def potential_2d_from(self, grid):
2121
return np.full(shape=self.shape, fill_value=self.value)
2222

23-
@aa.grid_dec.to_vector_yx
23+
@aa.decorators.to_vector_yx
2424
def deflections_yx_2d_from(self, grid):
2525
return np.full(shape=(self.shape, 2), fill_value=self.value)

autogalaxy/profiles/geometry_profiles.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class SphProfile(GeometryProfile):
9999
def __init__(self, centre: Tuple[float, float] = (0.0, 0.0)):
100100
super().__init__(centre=centre)
101101

102-
@aa.grid_dec.to_array
102+
@aa.decorators.to_array
103103
def radial_grid_from(self, grid: aa.type.Grid2DLike, xp=np, **kwargs) -> np.ndarray:
104104
"""
105105
Convert a grid of (y, x) coordinates, to their radial distances from the profile
@@ -126,7 +126,7 @@ def angle_to_profile_grid_from(
126126
"""
127127
return xp.cos(grid_angles), xp.sin(grid_angles)
128128

129-
@aa.grid_dec.to_grid
129+
@aa.decorators.to_grid
130130
def _cartesian_grid_via_radial_from(
131131
self,
132132
grid: aa.type.Grid2DLike,
@@ -153,7 +153,7 @@ def _cartesian_grid_via_radial_from(
153153

154154
return xp.multiply(radius[:, None], xp.vstack((sin_theta, cos_theta)).T)
155155

156-
@aa.grid_dec.to_grid
156+
@aa.decorators.to_grid
157157
def transformed_to_reference_frame_grid_from(self, grid, xp=np, **kwargs):
158158
"""
159159
Transform a grid of (y,x) coordinates to the reference frame of the profile.
@@ -167,7 +167,7 @@ def transformed_to_reference_frame_grid_from(self, grid, xp=np, **kwargs):
167167
"""
168168
return xp.subtract(grid.array, xp.array(self.centre))
169169

170-
@aa.grid_dec.to_grid
170+
@aa.decorators.to_grid
171171
def transformed_from_reference_frame_grid_from(self, grid, xp=np, **kwargs):
172172
"""
173173
Transform a grid of (y,x) coordinates from the reference frame of the profile to the original observer
@@ -282,7 +282,7 @@ def angle_to_profile_grid_from(self, grid_angles, xp=np, **kwargs):
282282
theta_coordinate_to_profile = xp.add(grid_angles, -self.angle_radians(xp=xp))
283283
return xp.cos(theta_coordinate_to_profile), xp.sin(theta_coordinate_to_profile)
284284

285-
@aa.grid_dec.to_grid
285+
@aa.decorators.to_grid
286286
def rotated_grid_from_reference_frame_from(
287287
self, grid, xp=np, angle: Optional[float] = None, **kwargs
288288
):
@@ -313,7 +313,7 @@ def rotated_grid_from_reference_frame_from(
313313
grid_2d=grid, centre=(0.0, 0.0), angle=angle, xp=xp
314314
)
315315

316-
@aa.grid_dec.to_array
316+
@aa.decorators.to_array
317317
def elliptical_radii_grid_from(
318318
self, grid: aa.type.Grid2DLike, xp=np, **kwargs
319319
) -> np.ndarray:
@@ -332,7 +332,7 @@ def elliptical_radii_grid_from(
332332
)
333333
)
334334

335-
@aa.grid_dec.to_array
335+
@aa.decorators.to_array
336336
def eccentric_radii_grid_from(
337337
self, grid: aa.type.Grid2DLike, xp=np, **kwargs
338338
) -> np.ndarray:
@@ -354,7 +354,7 @@ def eccentric_radii_grid_from(
354354

355355
return xp.multiply(xp.sqrt(self.axis_ratio(xp)), grid_radii.array)
356356

357-
@aa.grid_dec.to_grid
357+
@aa.decorators.to_grid
358358
def transformed_to_reference_frame_grid_from(
359359
self, grid: aa.type.Grid2DLike, xp=np, **kwargs
360360
) -> np.ndarray:
@@ -374,7 +374,7 @@ def transformed_to_reference_frame_grid_from(
374374
grid_2d=grid.array, centre=self.centre, angle=self.angle(xp), xp=xp
375375
)
376376

377-
@aa.grid_dec.to_grid
377+
@aa.decorators.to_grid
378378
def transformed_from_reference_frame_grid_from(
379379
self, grid: aa.type.Grid2DLike, xp=np, **kwargs
380380
) -> aa.type.Grid2DLike:

autogalaxy/profiles/light/mock/mock_light_profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(
2727
self.value = value
2828
self.value1 = value1
2929

30-
@aa.grid_dec.to_array
30+
@aa.decorators.to_array
3131
@check_operated_only
3232
def image_2d_from(
3333
self, grid, xp=np, operated_only: Optional[bool] = None, **kwargs

autogalaxy/profiles/light/standard/chameleon.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray, xp=np) -> np.ndarray:
9090
)
9191

9292
@aa.over_sample
93-
@aa.grid_dec.to_array
93+
@aa.decorators.to_array
9494
@check_operated_only
95-
@aa.grid_dec.transform
95+
@aa.decorators.transform
9696
def image_2d_from(
9797
self,
9898
grid: aa.type.Grid2DLike,

autogalaxy/profiles/light/standard/eff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray, xp=np) -> np.ndarray:
5858
)
5959

6060
@aa.over_sample
61-
@aa.grid_dec.to_array
61+
@aa.decorators.to_array
6262
@check_operated_only
63-
@aa.grid_dec.transform
63+
@aa.decorators.transform
6464
def image_2d_from(
6565
self,
6666
grid: aa.type.Grid2DLike,

autogalaxy/profiles/light/standard/gaussian.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray, xp=np) -> np.ndarray:
7272
)
7373

7474
@aa.over_sample
75-
@aa.grid_dec.to_array
75+
@aa.decorators.to_array
7676
@check_operated_only
77-
@aa.grid_dec.transform
77+
@aa.decorators.transform
7878
def image_2d_from(
7979
self,
8080
grid: aa.type.Grid2DLike,

autogalaxy/profiles/light/standard/moffat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ def image_2d_via_radii_from(self, grid_radii: np.ndarray, xp=np) -> np.ndarray:
7171
)
7272

7373
@aa.over_sample
74-
@aa.grid_dec.to_array
74+
@aa.decorators.to_array
7575
@check_operated_only
76-
@aa.grid_dec.transform
76+
@aa.decorators.transform
7777
def image_2d_from(
7878
self,
7979
grid: aa.type.Grid2DLike,

autogalaxy/profiles/light/standard/sersic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ def image_2d_via_radii_from(
164164
)
165165

166166
@aa.over_sample
167-
@aa.grid_dec.to_array
167+
@aa.decorators.to_array
168168
@check_operated_only
169-
@aa.grid_dec.transform
169+
@aa.decorators.transform
170170
def image_2d_from(
171171
self,
172172
grid: aa.type.Grid2DLike,

0 commit comments

Comments
 (0)