soxspipe.commonutils.detect_continuum

find and fit the continuum trace across all echelle orders with low-order polynomials.

Author

David Young & Marco Landoni

Date Created

September 10, 2020

Module Contents

Classes

detect_continuum

find and fit the continuum trace across all echelle orders with low-order polynomials.

API

class soxspipe.commonutils.detect_continuum.detect_continuum(log, traceFrame, dispersion_map, settings=False, recipeSettings=False, recipeName=False, qcTable=False, productsTable=False, sofName=False, binx=1, biny=1, lampTag=False, locationSetIndex=False, orderPixelTable=False, startNightDate='', debug=False)[source][source]

Bases: soxspipe.commonutils.detect_continuum._base_detect

find and fit the continuum trace across all echelle orders with low-order polynomials.

Key Arguments:

  • log – logger

  • traceFrame – calibrated frame containing a source trace (CCDObject)

  • dispersion_map – path to dispersion map file containing polynomial fits of the dispersion solution for the frame

  • settings – the settings dictionary

  • recipeSettings – the recipe specific settings

  • recipeName – the recipe name as given in the settings dictionary

  • qcTable – the data frame to collect measured QC metrics

  • productsTable – the data frame to collect output products

  • sofName —- name of the originating SOF file

  • binx – binning in x-axis

  • biny – binning in y-axis

  • lampTag – add this tag to the end of the product filename. Default False

  • locationSetIndex – the index of the AB cycle locations (nodding mode only). Default False

  • orderPixelTable – this is used for tuning the pipeline. Default False

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

  • debug – if True then extra debugging information is printed. Default False

Usage:

To use the detect_continuum object, use the following:

from soxspipe.commonutils import detect_continuum
detector = detect_continuum(
    log=log,
    traceFrame=traceFrame,
    dispersion_map=dispersion_map,
    settings=settings,
    recipeName="soxs-order-centres"
)
order_table_path = detector.get()

Initialization

calculate_residuals(orderPixelTable, coeff, axisACol, axisBCol, orderCol=False, writeQCs=False)[source]
create_pixel_arrays()[source][source]

create a pixel array for the approximate centre of each order

Return:

  • orderPixelTable – a data-frame containing lines and associated pixel locations

  • dmBinx – the dispersion map binning in x

  • dmBiny – the dispersion map binning in y

fit_1d_gaussian_to_slices(orderPixelTable, sliceLength, medianStddev=False)[source][source]

Optimized version of Gaussian fitting to slices

fit_global_polynomial(pixelList, axisACol='cont_x', axisBCol='cont_y', orderCol='order', exponentsIncluded=False, writeQCs=False)[source]
fit_order_polynomial(pixelList, order, axisBDeg, axisACol, axisBCol, exponentsIncluded=False)[source]
get()[source][source]

return the order centre table filepath

Return:

  • order_table_path – file path to the order centre table giving polynomial coeffs to each order fit

plot_results(orderPixelTable, orderPolyTable, clippedData)[source][source]

generate a plot of the polynomial fits and residuals

Key Arguments:

  • orderPixelTable – the pixel table with residuals of fits

  • orderPolyTable – data-frame of order-location polynomial coeff

  • clippedData – the sigma-clipped data

Return:

  • filePath – path to the plot pdf

  • orderMetaTable – dataframe of useful order fit metadata

sample_trace()[source][source]

take many cross-dispersion samples across each order to try and find an object trace

Return:

  • orderPixelTable – the detector locations at which a trace was found

write_order_table_to_file(frame, orderPolyTable, orderMetaTable)[source]