class pvextractor.Path(xy_or_coords, width=None)[source]

Bases: object

A curved path that may have a non-zero width and is used to extract slices from cubes.


xy_or_coords : list or Astropy coordinates

The points defining the path. This can be passed as a list of (x, y) tuples, which is interpreted as being pixel positions, or it can be an Astropy coordinate object containing an array of 2 or more coordinates.

width : None or float or Quantity

The width of the path. If coords is passed as a list of pixel positions, the width should be given (if passed) as a floating-point value in pixels. If coords is a coordinate object, the width should be passed as a Quantity instance with units of angle. If None, interpolation is used at the position of the path.

Methods Summary

add_point(xy_or_coord) Add a point to the path
get_xy([wcs]) Return the pixel coordinates of the path.
sample_points(spacing[, wcs])
sample_points_edges(spacing[, wcs])
sample_polygons(spacing[, wcs])
to_patches(spacing[, wcs])

Methods Documentation


Add a point to the path


xy_or_coord : tuple or Astropy coordinate

A tuple (x, y) containing the coordinates of the point to add (if the path is defined in pixel space), or an Astropy coordinate object (if it is defined in world coordinates).


Return the pixel coordinates of the path.

If the path is defined in world coordinates, the appropriate WCS transformation should be passed.


wcs : WCS

The WCS transformation to assume in order to transform the path to pixel coordinates.

sample_points(spacing, wcs=None)[source]
sample_points_edges(spacing, wcs=None)[source]
sample_polygons(spacing, wcs=None)[source]
to_patches(spacing, wcs=None, **kwargs)[source]