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

Compute background grid as fast as sep, but without sep #89

Open
HannoSpreeuw opened this issue Oct 30, 2024 · 0 comments
Open

Compute background grid as fast as sep, but without sep #89

HannoSpreeuw opened this issue Oct 30, 2024 · 0 comments
Assignees

Comments

@HannoSpreeuw
Copy link
Collaborator

HannoSpreeuw commented Oct 30, 2024

Currently, the fast way in PySE to compute the background grid (mean and standard deviation of the background pixels on a regular grid with its nodes centered on subimages with size back_size_x * back_size_y) is to use sep.

It is considerably faster than PySE's default way to compute the background grid, which applies parallellisation using Dask over rows of subimages fed into stats.sigma_clip. The default approach is more accurate though, since inside stats.sigma_clip a more intelligent algorithm than sep's i.e. than SExtractor's, is deployed.

The code for computing the two background characteristics of a single subimage is stats.sigma_clip. With some adjustments, stats.sigma_clip can be deployed with Numba's guvectorize decorator.

Using a reshape of the image data as an input argument to the decorated and slightly modified version of stats.sigma_clip would then be sufficient to compute the background characteristics on all background grid nodes in a vectorized way.

Tests reveal that this takes about the same time as deploying sep, while arriving at the same numbers as PySE's default approach - through Dask's map_blocks and stats.sigma_clip - i.e. while retaining the same accuracy, but these tests exclude the time taken by image.ImageData._interpolate. If the latter time is negligible, applying Numba's guvectorize decorator would offer a great improvement.

Both Dask and sep could be removed as dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant