soxspipe.commonutils.subtract_background

fit and subtract background flux from scattered light from frame

Author

David Young

Date Created

June 3, 2021

Module Contents

Classes

subtract_background

fit and subtract background flux from scattered light from frame

API

class soxspipe.commonutils.subtract_background.subtract_background(log, frame, orderTable, sofName=False, recipeName=False, settings=False, qcTable=False, productsTable=False, lamp='', startNightDate='')[source][source]

Bases: object

fit and subtract background flux from scattered light from frame

Key Arguments:

  • log – logger

  • settings – the settings dictionary

  • frame – the frame to subtract background light from

  • recipeName – name of the parent recipe

  • sofName – the sof file name given to the parent recipe

  • orderTable – the order geometry table

  • qcTable – the data frame to collect measured QC metrics

  • productsTable – the data frame to collect output products

  • lamp – needed for UVB flats

  • startNightDate – YYYY-MM-DD date of the observation night. Default “”

Usage:

To setup your logger, settings and database connections, please use the fundamentals package (see tutorial here https://fundamentals.readthedocs.io/en/master/initialisation.html).

To fit and subtract the background from an image:

from soxspipe.commonutils import subtract_background
background = subtract_background(
    log=log,
    frame=myCCDDataObject,
    orderTable="/path/to/orderTable",
    settings=settings
)
backgroundFrame, backgroundSubtractedFrame = background.subtract()

Initialization

create_background_image(rowFitOrder, gaussianSigma)[source][source]

model the background image from intra-order flux detected

Key Arguments:

  • rowFitOrder – order of the polynomial fit to flux in each row

  • gaussianSigma – the sigma of the gaussian used to blur the final image

mask_order_locations(orderPixelTable)[source][source]

mask the order locations and return the masked frame

Key Arguments:

  • orderPixelTable – the order location in a pandas datafrmae.

subtract()[source][source]

fit and subtract background light from frame

Return:

  • backgroundSubtractedFrame – a CCDData object of the original input frame with fitted background light subtracted