sparse3d
This package contains implementations of a class for working with data that looks like a single large sparse image containing small regions of dense data. This is designed for working with astronomical images where we often have many small dense images (e.g. stars) set into a sparse frame (e.g. a large astronomical image).
What is sparse3D
?
We often have large images in astronomy that might look like the sketch below. In this sketch we have a large, sparse image with 4 dense regions; A, B, C, and D. In astronomy we have this situation often, where we have small images of point-like stars spread over large images.
+-------------------------------------+
| |
| +-----+ +-----+ |
| | | | | |
| | A | | B | |
| | | | | |
| +-----+ +-----+ |
| |
| +-----+ |
| | | |
| +-----+ | C | |
| | | | | |
| | D | +-----+ |
| | | |
| +-----+ * |
| |
+-------------------------------------+
We may wish to calculate a model for star brightness in each of these regions. In this case, we likely do not care about the value of the model outside these regions, e.g. at the point in the image indicated by *
. However, our model may still be based on where we are within this larger image.
Because of this, it is efficient for us to take this image and cast it into a sparse representation using scipy
's sparse
library.
Unfortunately sparse
does not easily enable us to do this, as it only allows 2D arrays.
This small repository implements a way that we can hold the data corresponding to each of the sub-images inside of a sparse array, by "unwrapping" the indices for the sub-images and insetting them in the larger, sparse image.
Installation
You can install with pip using
pip install sparse3d --upgrade
or you can clone this repo and install using
cd sparse3d/
pip install poetry --upgrade
poetry install