build_pixels

Contents

build_pixels#

build_pixels(shape, oversampling=10)[source]#

Build a pixel coordinate system with optional oversampling.

Coordinates are in units of the (non-oversampled) pixels, with (0, 0) at the center of the image.

Parameters:
  • shape (tuple of int) – Shape (ny, nx) of the image.

  • oversampling (int or list of int or None, optional) – Oversampling factor: a single integer for symmetric oversampling, or [oversampling_y, oversampling_x] for asymmetric oversampling. None means 1. Default is 10.

Returns:

dict – Dictionary with keys:

  • "centroids": (x, y) pixel centers, as an open mesh-grid of shapes (1, nx * oversampling_x) and (ny * oversampling_y, 1);

  • "edges": (x_edges, y_edges) pixel edges, as an open mesh-grid (one more element than "centroids" along each axis);

  • "shape": the input shape;

  • "pixelarea": area of a single oversampled pixel;

  • "fullshape": shape of the oversampled image;

  • "oversampling": the oversampling factor(s) used.