|
| 1 | +""" |
| 2 | +The `Galaxy` class is the central object in **PyAutoGalaxy** that groups light profiles, mass profiles, and |
| 3 | +other components (e.g. pixelizations) at a given redshift. |
| 4 | +
|
| 5 | +A `Galaxy` holds its components as named keyword-argument attributes, so the user can access them by name |
| 6 | +(e.g. `galaxy.bulge`, `galaxy.disk`). It then provides aggregate methods — `image_2d_from`, |
| 7 | +`deflections_yx_2d_from`, `convergence_2d_from`, `potential_2d_from` — that sum the contributions of all |
| 8 | +matching component types. |
| 9 | +
|
| 10 | +The `Galaxies` class (in `galaxies.py`) wraps a list of `Galaxy` objects and provides the same aggregate |
| 11 | +interface over the whole ensemble. |
| 12 | +""" |
1 | 13 | from typing import Dict, List, Optional, Type, Union |
2 | 14 |
|
3 | 15 | import numpy as np |
@@ -295,12 +307,41 @@ def convergence_2d_from( |
295 | 307 |
|
296 | 308 | return xp.zeros((grid.shape[0],)) |
297 | 309 |
|
| 310 | + @property |
| 311 | + def half_light_radius(self): |
| 312 | + """ |
| 313 | + The half-light radius of the galaxy. |
| 314 | +
|
| 315 | + Returns `None` because a `Galaxy` may contain multiple light profiles with different effective radii; |
| 316 | + there is no single half-light radius that characterises the whole galaxy. Individual light profile |
| 317 | + components expose their own `half_light_radius` / `effective_radius` attributes. |
| 318 | + """ |
| 319 | + return None |
| 320 | + |
298 | 321 | @aa.grid_dec.to_grid |
299 | 322 | def traced_grid_2d_from( |
300 | 323 | self, grid: aa.type.Grid2DLike, xp=np |
301 | 324 | ) -> aa.type.Grid2DLike: |
302 | 325 | """ |
303 | | - Trace an input grid using the galaxy's its deflection angles. |
| 326 | + Trace an input grid of (y,x) coordinates through the galaxy's deflection angles. |
| 327 | +
|
| 328 | + The traced grid is computed as: |
| 329 | +
|
| 330 | + β = θ − α(θ) |
| 331 | +
|
| 332 | + where θ is the image-plane grid and α(θ) are the deflection angles from the galaxy's mass profiles. |
| 333 | +
|
| 334 | + This is the lensing ray-tracing step that maps image-plane positions to source-plane positions. |
| 335 | +
|
| 336 | + Parameters |
| 337 | + ---------- |
| 338 | + grid |
| 339 | + The 2D (y, x) image-plane coordinates to be traced to the source plane. |
| 340 | +
|
| 341 | + Returns |
| 342 | + ------- |
| 343 | + aa.type.Grid2DLike |
| 344 | + The source-plane (y, x) coordinates after deflection. |
304 | 345 | """ |
305 | 346 | if isinstance(grid, aa.Grid2D): |
306 | 347 | return aa.Grid2D( |
@@ -343,10 +384,6 @@ def potential_2d_from( |
343 | 384 | ) |
344 | 385 | return xp.zeros((grid.shape[0],)) |
345 | 386 |
|
346 | | - @property |
347 | | - def half_light_radius(self): |
348 | | - return None |
349 | | - |
350 | 387 | def extract_attribute(self, cls, attr_name): |
351 | 388 | """ |
352 | 389 | Returns an attribute of a class and its children profiles in the galaxy as a `ValueIrregular` |
|
0 commit comments