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

Speed up w/parallelization #2

Open
keflavich opened this issue Jul 25, 2018 · 2 comments
Open

Speed up w/parallelization #2

keflavich opened this issue Jul 25, 2018 · 2 comments

Comments

@keflavich
Copy link
Collaborator

This is what you get running in spectral_cube:

In [5]: %timeit cube.sigma_clip(1.5, 0)
3.48 s ± 98.5 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

In [6]: %timeit cube.sigma_clip(1.5, 0, num_cores=4)
1.42 s ± 53.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

See radio-astro-tools/spectral-cube#494

@keflavich
Copy link
Collaborator Author

See also:
astropy/astropy#7478

@keflavich
Copy link
Collaborator Author

More benchmark tests:

In [7]: %timeit stats.sigma_clip(data, sigma=1.5, axis=0)
305 ms ± 12.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

In [8]: %timeit stats.sigma_clip(data, sigma=1.5, axis=0, cenfunc=np.nanmean)
273 ms ± 6.09 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

In [9]: %timeit stats.sigma_clip(data, sigma=1.5, axis=0, cenfunc=np.nanmedian)
1.6 s ± 9.89 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

the spectral-cube approach is actually much slower because it has to iterate over pixels, but it will be faster (and not crash your machine) for much larger data sets.

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

No branches or pull requests

1 participant