Skip to main content

SkySegmentor: Splits a binary map into several regions using the binary space partition algorithm.

Project description

biglogo

Python Tests Python Version Support Version PyPI version Documentation Status GitHub repository License: MIT Code style: black

Introduction

SkySegmentor is a python package for dividing points or maps (in HEALPix format) on the celestial sphere into equal-sized segments. It employs a sequential binary space partitioning scheme -- a generalization of the k-d tree algorithm -- that supports segmentation of arbitrarily shaped sky regions. By design, all partitions are approximately equal in area, with discrepancies no larger than the HEALPix pixel scale.

Dependencies

  • numpy>=1.22,<1.27
  • healpy>=1.15.0

Installation

Pip installation:

pip install skysegmentor

From the source:

Clone the repository

git clone https://github.com/knaidoo29/SkySegmentor.git
cd SkySegmentor

and install by running

pip install . [--user]

Documentation

Documentation, including tutorials and explanation of API, can be found here https://skysegmentor.readthedocs.io/. Alternatively a PDF version of the documentation is located in the docs/ folder called skysegmentor.pdf. Offline documentation can be generating by running make html in the docs/ folder which will generate html documentation in the docs/build/html folder that can be accessed by opening the index.html file in a browser.

Tutorial

Basic Usage

Segmenting Healpix Maps

import healpy
import skysegmentor

# Healpix mask, where zeros are regions outside of the mask and ones inside the
# mask. You can also input a weighted map, where instead of 1s you give weights.
mask = # define mask values

Npartitions = 100 # Number of partitions
partitionmap = skysegmentor.segmentmapN(mask, Npartitions)

Segmenting Points on the Sphere

import skysegmentor

# Define points on the sphere to be segmented.
phi = # longitude defined in radians from [0, 2*pi]
the = # latitude defined in radians from [0, pi], where 0 = North Pole.

Npartitions = 100 # Number of partitions
partitionIDs = skysegmentor.segmentpointsN(phi, the, Npartitions)

if using RA and Dec in degrees you can convert to phi and the using

phi = np.deg2rad(ra)
the = np.deg2rad(90. - dec)

if not all points are equal, you can specify a weight

weights = # define point weights
partitionIDs = skysegmentor.segmentpointsN(phi, the, Npartitions, weights=weights)

Citing

SkySegmentor was developed as part of the Euclid angular power spectra internal covariance pipeline. If you use SkySegmentor please cite this paper, which can be found here:

--THESE ARE PLACEHOLDERS TO BE UPDATED LATER--

  • NASA ADS:
  • ArXiv:
  • BibTex:
    @ARTICLE{Naidoo2025,
            author = {{Euclid Collaboration} and {Naidoo}, K. and 
            {Ruiz-Zapatero}, J. and {Tessore}, N. and 
            {Joachimi}, B. and {Loureiro}, A. and
            others ...}
            title = "{Euclid preparation: TBD. Accurate and precise data-driven angular power spectrum covariances}
    }
    

and include a link to the SkySegmentor documentation page:

https://skysegmentor.readthedocs.io/

Support

If you have any issues with the code or want to suggest ways to improve it please open a new issue (here) or (if you don't have a github account) email krishna.naidoo.11@ucl.ac.uk.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skysegmentor-1.0.0.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skysegmentor-1.0.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file skysegmentor-1.0.0.tar.gz.

File metadata

  • Download URL: skysegmentor-1.0.0.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for skysegmentor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4882c7d6fec64acbddc42e8e62afcd949874871315a13d3150947b669fe74fe8
MD5 d3318563e98516a8e6466452e387e027
BLAKE2b-256 9a6652f6086b4cd9158bf5609f0547675158dd7cfc7c5d304a84023b42a944eb

See more details on using hashes here.

File details

Details for the file skysegmentor-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: skysegmentor-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for skysegmentor-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fd0df2289e352a281d4e88c262e559fc0bc3e4671c936fc760bd5d985f3067b
MD5 a3fc53f2ae2748b0d8c5cddc2c4f4bab
BLAKE2b-256 2a226c1c07db6aaefe9ab1f6ba23e822f326464cf99487502046ae8311c0830d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page