subtract_tilted_background

laserbeamsize.background.subtract_tilted_background(image, corner_fraction=0.035)[source]

Return image with tilted planar background subtracted.

Take all the points around the perimeter of an image and fit these to a tilted plane to determine the background to subtract. Details of the linear algebra are at https://math.stackexchange.com/questions/99299

Since the sample contains noise, it is important not to remove this noise at this stage and therefore we offset the plane so that one standard deviation of noise remains.

Parameters:
  • image – the image to work with

  • corner_fraction – the fractional size of corner rectangles

Returns:

image – 2D array with tilted planar background subtracted