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.

examples

importpymangle# read a mangle polygon filem=pymangle.Mangle("mask.ply")# test an ra,dec point against the maskgood=m.contains(200.0,0.0)# test arrays of ra,dec points against the maskra=numpy.array([200.0,152.7])dec=numpy.array([0.0,-15.0])good=m.contains(ra,dec)# get the polygon idsids=m.polyid(ra,dec)# get the weightsweights=m.weight(ra,dec)# get poth polyids and weightsids,weights=m.polyid_and_weight(ra,dec)# generate random pointsra_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_min=200.0ra_max=210.0dec_min=0.0dec_max=10.0ra_rand,dec_rand=m.genrand_range(1000,ra_min,ra_max,dec_min,dec_max)# get the polygon weightsweights=m.weights# read in a new set of weightsm.read_weightfile(weightfile)# set the weightsm.weights=weight_array