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()
- Returns
cmap – A color map to be used as the
cmap
argument toimshow
alongside the return value ofrender
.- Return type
matplotlib.colors.LinearSegmentedColormap
- classmethod dedup(*pts)
Deduplicate a collection of
PointsTuple
instances, converting color tuples toRgba
and converting all input tuples toPointsTuple
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.See also
- 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 raiseNoDisks
if all point source sigmas are undefined and/or zero. Use this with thecmap
method and yourWCSAxes
instance’simshow
method to display these disks. You will need to callWCSAxes.scatter
separately to display the point locations themselves usingself.marker
. You will also need to label the point names separately usingself.label_points
.All of this is done automatically if this instance is passed as a
scatter
parameter toPartialUniqSkymap.plot
.- Parameters
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.
- Returns
pixels – Pixel values at locations specified in
u⃗ᵒ
. If aWCS
instance, then the pixels will be suitable for immediate display in aWCSAxes
instance usingimshow
; otherwise, you might wish to use the nonzero values as a mask to select pixels in aPartialUniqSkymap
near the point sources in this instance.- Return type
array
- Raises
NoDisks – If all sigmas are zero or undefined. Use this to avoid an extraneous call to
imshow
, or to catch missing sigmas.
See also
hpmoc.partial.PartialUniqSkymap.plot
,hpmoc.partial.PartialUniqSkymap.render
,WCSAxes.scatter
- property rgba
Alias for field number 1
- scale_sigma(factor, **kwargs)
Return a new
PointsTuple
with sigma scaled for each point byfactor
(if sigma is defined). Optionally also changergba
,marker
, orlabel
(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 to1
.- 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 newRgba
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
- to_hex(include_alpha=True)
Get a hex string of the form
#rrggbbaa
for thisRgba
tuple.