-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9ba3c28
Showing
20 changed files
with
2,145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Build and upload to PyPI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, windows-2019, macos-11] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_SKIP: 'pp{37,38,39}-{macosx_x86_64,win_amd64}' | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/*.tar.gz | ||
|
||
upload_pypi: | ||
name: Upload to PyPI | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.pypi_password }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.*.swp | ||
python/healpix.c | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Copyright (c) 2022, Nicolas Tessore, based on the healpix_bare library | ||
|
||
Copyright (c) 1997-2019, Krzysztof M. Gorski, Eric Hivon, Martin Reinecke, Benjamin D. Wandelt, Anthony J. Banday, Matthias Bartelmann, Reza Ansari & Kenneth M. Ganga | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include src/healpix.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
healpix | ||
======= | ||
|
||
**Python and C package for HEALPix discretisation of the sphere** | ||
|
||
This package implements a lean set of routines for working with the HEALPix | ||
discretisation of the sphere. It supports NSIDE parameters up to 2^29. | ||
|
||
The C library is based on the *healpix_bare* library, which was released under | ||
the 3-clause BSD license. | ||
|
||
If you are using this code in your research, please consider citing the | ||
original paper in your publications: | ||
|
||
* [Gorski et al., 2005, ApJ, 622, 759][Gorski+2005] | ||
|
||
[Gorski+2005]: http://adsabs.harvard.edu/abs/2005ApJ...622..759G | ||
|
||
|
||
Python | ||
------ | ||
|
||
The Python package provides functions that deal with the discretisation of the | ||
sphere itself. It is not meant to be a replacement of *healpy*, and does not | ||
contain things such as functions for the visualisation of maps, or spherical | ||
harmonic transforms. | ||
|
||
The Python package consists of two modules: | ||
|
||
* The low-level `chealpix` module, which is a native C extension, and | ||
efficiently vectorises the C library functions over arbitrary numpy array | ||
inputs (including scalars, of course). | ||
* The high-level `healpix` module, which contains a more streamlined interface, | ||
and additional functionality: | ||
|
||
* Random point picking in HEALPix pixels. | ||
|
||
The high-level functions in the `healpix` module can be used more or less | ||
interchangeably with functions from the *healpy* package. However, in some | ||
cases, compatibility is sacrificed for consistency. | ||
|
||
The Python package requires only *numpy*, and can be installed using pip: | ||
|
||
pip install healpix | ||
|
||
The vectorised C functions carefully avoid the creation of temporary arrays, | ||
and therefore have minimal memory overhead: | ||
|
||
```py | ||
>>> import numpy as np, healpix, tracemalloc | ||
>>> | ||
>>> # random vectors with 1G of memory per component (less than a NSIDE=4K map) | ||
>>> x, y, z = np.random.randn(3, 125_000_000) | ||
>>> | ||
>>> tracemalloc.start() | ||
>>> | ||
>>> lon, lat = healpix.vec2ang(x, y, z, lonlat=True) | ||
>>> | ||
>>> tracemalloc.get_traced_memory() | ||
(2000010342, 2000013889) # current, peak | ||
>>> | ||
>>> # no memory overhead: only the 2G output arrays were used | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel", "oldest-supported-numpy"] | ||
|
||
build-backend = "setuptools.build_meta" |
Oops, something went wrong.