Skip to main content

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

Project description

biglogo

Python Tests PyPI version Documentation Status License: MIT GitHub repository 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

First clone the repository

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

and install by running

pip install . [--user]

You should now be able to import the module:

import skysegmentor

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-0.1.0.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for skysegmentor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0d189ea745d7d62b2427aebbbda0b8d16fa0512de2234bfd2e7e564b7b2cc0e0
MD5 d45cda15f84e57487e9d57f728625973
BLAKE2b-256 7b43af79a7dac0ec1ffdf911f230d1cecbfc377c9783bd4fc0ed392cffd83965

See more details on using hashes here.

File details

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

File metadata

  • Download URL: skysegmentor-0.1.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-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b295c4ff43a29bac6dfb93ec256f618d769e6c06a1b8143461a6c58ed382a104
MD5 5f35bd61703cbf0243dcf8ca1f86a9fb
BLAKE2b-256 0b847e51ac2a61a06453424d6115704b1fb85aa3717cc42f3778cde3efa1866e

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