This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description

Simple python code to read and work with Mangle masks.

The underlying code is in C for speed, and is based on some C++ code written by Martin White. Martin has posted his C++ code at

Currently supports ascii mangle polygon files, with and without pixelization. The code works in python2 and python3

Authors: Erin Sheldon. Long double support added by Eli Rykoff.


import pymangle

# read a mangle polygon file

# test an ra,dec point against the mask
good = m.contains(200.0, 0.0)

# test arrays of ra,dec points against the mask
ra=numpy.array([200.0, 152.7])
dec=numpy.array([0.0, -15.0])
good = m.contains(ra, dec)

# get the polygon ids
ids = m.polyid(ra,dec)

# get the weights
weights = m.weight(ra,dec)

# get poth polyids and weights
ids, weights = m.polyid_and_weight(ra, dec)

# generate random points
ra_rand, dec_rand = m.genrand(1000)

# generate randoms from the mask and with the additional constraint that they
# are within the specified rectangle.  This speeds things up if your mask is
# relatively small compared to the full sphere; choose the box just big enough
# to contain the mask.

ra_rand, dec_rand = m.genrand_range(1000,ra_min,ra_max,dec_min,dec_max)

# get the polygon weights
weights = m.weights

# read in a new set of weights

# set the weights

m.weights = weight_array

build and install python library

python install --prefix=/some/path
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pymangle-0.9.0.tar.gz (26.5 kB) Copy SHA256 Checksum SHA256 Source Aug 19, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting