pixelate_coord_path#

sunpy.map.pixelate_coord_path(smap, coord_path, *, bresenham=False)[source]#

Return the pixel coordinates for every pixel that intersects with a coordinate path.

Each pair of consecutive coordinates in the provided coordinate array defines a line segment. Each pixel that intersects with a line segment has the coordinates of its center returned in the output.

To obtain the values of these pixels, pass the output to sample_at_coords().

Parameters:
  • smap (GenericMap) – The sunpy map.

  • coord (SkyCoord) – The coordinate path.

  • bresenham (bool) – If True, use Bresenham’s line algorithm instead of the default algorithm. Bresenham’s line algorithm is faster, but simplifies each coordinate-path point to the nearest pixel center and can skip a pixel on the path if two of its neighbors are diagonally connected and also on the path.

Notes

If a pixel intersects the coordinate path at only its corner, it may not be returned due to the limitations of floating-point comparisons.

If part of the coordinate path lies outside of the bounds of the map, this function will still return pixel coordinates that are consistent with the WCS of the map, but attempting to obtain the map data at these pixel coordinates (e.g., using sample_at_coords()) will raise an error, as these pixels are not “real” and have no corresponding data.

Returns:

SkyCoord – The coordinates for the pixels that intersect with the coordinate path.

Examples

Extracting intensity of a map along a line

Extracting intensity of a map along a line

Drawing and using a Great Arc

Drawing and using a Great Arc