hpmoc.points module

exception hpmoc.points.NoDisks

Bases: ValueError

Indicates that there are no point sources with nonzero support (sigma). Catch this to avoid wasting an extra artist plotting non-existent disks.

class hpmoc.points.PointsTuple(points: List[Tuple[float, float, Optional[float], Optional[str]]], rgba: hpmoc.points.Rgba = Rgba(red=0, green=1, blue=0, alpha=0.2), marker: str = 'x', label: Optional[str] = None)

Bases: tuple

A collection of points for scatterplots.


cmap – A color map to be used as the cmap argument to imshow alongside the return value of render.

Return type


classmethod dedup(*pts)

Deduplicate a collection of PointsTuple instances, converting color tuples to Rgba and converting all input tuples to PointsTuple instances. Preserves ordering.

property label

Alias for field number 3

property marker

Alias for field number 2

meta_dict(*, start=0) dict

Create a flattened meta dictionary, e.g. for a fits file, out of the provided PointsTuple instances.

classmethod meta_read(meta: dict) List[__class__]
property points

Alias for field number 0

render(u⃗o, extent=1.0)

Similar to hpmoc.PartialUniqSkymap.render, but for support disks specified by the input points’ sigma parameters. Will raise NoDisks if all point source sigmas are undefined and/or zero. Use this with the cmap method and your WCSAxes instance’s imshow method to display these disks. You will need to call WCSAxes.scatter separately to display the point locations themselves using self.marker. You will also need to label the point names separately using self.label_points.

All of this is done automatically if this instance is passed as a scatter parameter to PartialUniqSkymap.plot.

  • u⃗ᵒ (array or astropy.wcs.WCS) – The pixels to fill. If an array, treated as UNIQ indices (duplicates allowed); if WCS, treated as a set of pixels to render to.

  • extent (float, optional) – How many multiples of sigma to extend the disk out to.


pixels – Pixel values at locations specified in u⃗ᵒ. If a WCS instance, then the pixels will be suitable for immediate display in a WCSAxes instance using imshow; otherwise, you might wish to use the nonzero values as a mask to select pixels in a PartialUniqSkymap near the point sources in this instance.

Return type



NoDisks – If all sigmas are zero or undefined. Use this to avoid an extraneous call to imshow, or to catch missing sigmas.

property rgba

Alias for field number 1

scale_sigma(factor, **kwargs)

Return a new PointsTuple with sigma scaled for each point by factor (if sigma is defined). Optionally also change rgba, marker, or label (will be unchanged by default). A convenience method for plotting multiple sigmas around a point source.

class hpmoc.points.Rgba(red: Union[float, int], green: Union[float, int], blue: Union[float, int], alpha: Union[float, int] = 1)

Bases: tuple

An RGBA color tuple. If alpha is omitted, set to 1.

property alpha

Alias for field number 3

property blue

Alias for field number 2

classmethod from_hex(hexcolor)

Convert a color of the forms rgb, rgba, rrggbb, rrggbbaa, #rgb, #rrggbb, #rgba, or #rrggbbaa to a new Rgba instance. Alpha can be omitted, in which case it is set to 1.

property green

Alias for field number 1

property red

Alias for field number 0


Get a hex string of the form #rrggbbaa for this Rgba tuple.