measure_edges#

esis.optics.measure_edges(frame, footprints, axis_field=('detector_x', 'detector_y'), fraction=0.35, skip=25, stride=2, half=30, band=6, clip=3.0, margin=40)[source]#

Measure where the edges of every window cross the rows and columns of a frame.

Each side of each predicted outline is fit as one blurred straight edge, see _fit_side(), along the rows that cross the left and right sides and the columns that cross the top and bottom, within a band about the window’s centre so that the corners of the octagon, where two sides meet, are left out.

Parameters:
  • frame (ndarray) – The frame, indexed [y, x] in pixels.

  • footprints (list[AbstractCartesian2dVectorArray]) – The predicted outline of each window, one per spectral line, in pixels, see optika.systems.AbstractLinearSystem.footprint().

  • axis_field (tuple[str, str]) – The names of the sensor axes, for the metadata only.

  • fraction (float) – The half-height of the band of rows (columns) about the window’s centre, as a fraction of the window’s half-extent.

  • skip (int) – Rows within this distance of the window’s centre are left out of the left and right sides.

  • stride (int) – Every stride-th column is fit on the top and bottom sides.

  • half (int) – How far from the predicted outline each edge is searched for, in pixels.

  • band (int) – Half the length of the profile fit across each edge, in pixels.

  • clip (float) – Rows and columns whose residual is more than this multiple of the side’s median are left out.

  • margin (int) – Crossings closer than this to the edge of the frame are left out.

Returns:

  • A table with a row per crossing (line, side, index (the row)

  • for the left and right sides, the column for the top and bottom),

  • position and error, where the side’s straight edge crosses that

  • row or column, and width, the standard deviation of the side’s

  • blur normal to the edge, all in pixels. The width includes the

  • pixels’ own, 1/sqrt(12) px in quadrature, and on the left and

  • right sides the width of the spectral line. Only the rows and columns

  • the clip kept are listed.

Return type:

QTable