|
1 | | -# PyAutoArray |
| 1 | +# PyAutoArray: Arrays, Grids and Masks for Astronomy |
2 | 2 |
|
3 | | -**PyAutoArray** (package `autoarray`) is the low-level data-structure and |
4 | | -numerical-utility layer of the [PyAuto](https://github.com/PyAutoLabs) |
5 | | -ecosystem. It provides masks, arrays, (y,x) coordinate grids, |
6 | | -imaging/interferometer datasets, inversions/pixelizations for source |
7 | | -reconstruction, and convolution/over-sampling operators. |
| 3 | +**PyAutoArray** provides arrays, masks, coordinate grids and numerical tools for astronomical imaging and interferometer data. It powers the data handling and image reconstruction in **PyAutoGalaxy** and **PyAutoLens**. |
8 | 4 |
|
9 | | -`PyAutoGalaxy` and `PyAutoLens` build directly on autoarray: every grid a |
10 | | -profile consumes, every masked image a fit operates on, and the linear-algebra |
11 | | -inversions behind pixelized source reconstruction are autoarray objects. The |
12 | | -package supports both a NumPy and an opt-in JAX (`xp=jnp`) backend. |
| 5 | +If you want to model galaxies or gravitational lenses, start with [PyAutoGalaxy](https://github.com/PyAutoLabs/PyAutoGalaxy) or [PyAutoLens](https://github.com/PyAutoLabs/PyAutoLens). Use PyAutoArray directly when you need these building blocks in your own Python code. |
13 | 6 |
|
14 | | -## Install |
| 7 | +## Getting Started |
| 8 | + |
| 9 | +Install the package: |
15 | 10 |
|
16 | 11 | ```bash |
17 | 12 | pip install autoarray |
18 | 13 | ``` |
19 | 14 |
|
20 | | -## Examples |
21 | | - |
22 | | -A masked 2D array tied to a pixel scale: |
| 15 | +Create a two-dimensional array with a pixel scale: |
23 | 16 |
|
24 | 17 | ```python |
25 | 18 | import autoarray as aa |
26 | 19 |
|
27 | | -arr = aa.Array2D.no_mask(values=[[1.0, 2.0], [3.0, 4.0]], pixel_scales=0.1) |
28 | | -arr.shape_native # (2, 2) |
29 | | -arr.native[0, 0] # 1.0 |
| 20 | +image = aa.Array2D.no_mask( |
| 21 | + values=[[1.0, 2.0], [3.0, 4.0]], |
| 22 | + pixel_scales=0.1, |
| 23 | +) |
30 | 24 | ``` |
31 | 25 |
|
32 | | -A circular mask and the (y,x) coordinate grid of its unmasked pixels: |
| 26 | +Create a circular mask and a grid of coordinates for its unmasked pixels: |
33 | 27 |
|
34 | 28 | ```python |
35 | | -mask = aa.Mask2D.circular(shape_native=(50, 50), pixel_scales=0.1, radius=2.0) |
36 | | -mask.pixels_in_mask # 1264 |
| 29 | +mask = aa.Mask2D.circular( |
| 30 | + shape_native=(50, 50), |
| 31 | + pixel_scales=0.1, |
| 32 | + radius=2.0, |
| 33 | +) |
37 | 34 |
|
38 | | -grid = aa.Grid2D.from_mask(mask=mask) # shape (1264, 2) |
39 | | -uniform = aa.Grid2D.uniform(shape_native=(10, 10), pixel_scales=0.1) |
| 35 | +grid = aa.Grid2D.from_mask(mask=mask) |
40 | 36 | ``` |
41 | 37 |
|
42 | | -A normalized Gaussian PSF convolver: |
43 | | - |
44 | | -```python |
45 | | -convolver = aa.Convolver.from_gaussian( |
46 | | - shape_native=(11, 11), pixel_scales=0.1, sigma=1.0, normalize=True |
47 | | -) |
48 | | -convolver.kernel.shape_native # (11, 11) |
49 | | -convolver.kernel.array.sum() # 1.0 |
50 | | -``` |
| 38 | +## Explore Further |
51 | 39 |
|
52 | | -## Community & Contributing |
| 40 | +- **[Galaxy modeling examples](https://github.com/PyAutoLabs/autogalaxy_workspace#find-your-examples)** — see arrays, grids and masks used in galaxy analysis. |
| 41 | +- **[Lensing examples](https://github.com/PyAutoLabs/autolens_workspace#find-your-examples)** — explore their use in gravitational lens modeling. |
| 42 | +- **[Source code](https://github.com/PyAutoLabs/PyAutoArray/tree/main/autoarray)** — explore the data structures and numerical tools. |
| 43 | +- **[Tests](https://github.com/PyAutoLabs/PyAutoArray/tree/main/test_autoarray)** — find focused examples of individual components. |
53 | 44 |
|
54 | | -**PyAutoFit** is built in the open by its users: everyone is welcome to ask questions, |
55 | | -share what they have made with it, and contribute. |
| 45 | +## Community and Contributing |
56 | 46 |
|
57 | | -Questions, ideas and bug reports: the [PyAutoLabs Discussions](https://github.com/orgs/PyAutoLabs/discussions). |
58 | | -Chat with us on [Slack](https://join.slack.com/t/pyautolens/shared_invite/zt-2cufp4eyf-fXfgMxRGuvg~bMrI3uOAxg). |
| 47 | +Ask questions, suggest improvements and share your work in [PyAutoLabs Discussions](https://github.com/orgs/PyAutoLabs/discussions), or chat with us on [Slack](https://join.slack.com/t/pyautolens/shared_invite/zt-2cufp4eyf-fXfgMxRGuvg~bMrI3uOAxg). |
59 | 48 |
|
60 | | -Community-built tools and tutorials, and how to contribute: the [**PyAutoFit** community page](https://pyautofit.readthedocs.io/en/latest/general/community.html). |
| 49 | +To contribute, see the [contribution guide](https://github.com/PyAutoLabs/PyAutoArray/blob/main/CONTRIBUTING.md). |
61 | 50 |
|
62 | | -## Links |
| 51 | +## License |
63 | 52 |
|
64 | | -- Source & tests: [`autoarray/`](autoarray), [`test_autoarray/`](test_autoarray) |
65 | | -- Decorators & JAX deep dive: [`docs/agents/jax_and_decorators.md`](docs/agents/jax_and_decorators.md) |
66 | | -- Agent/contributor instructions: [`AGENTS.md`](AGENTS.md) |
67 | | -- Ecosystem: [PyAutoLabs on GitHub](https://github.com/PyAutoLabs) |
| 53 | +See the [license](https://github.com/PyAutoLabs/PyAutoArray/blob/main/LICENSE). |
0 commit comments