soxspipe.commonutils.dispersion_map_to_pixel_arrays

use a first-guess dispersion map to convert wavelengths to pixels

Author

David Young

Date Created

April 15, 2021

Module Contents

Functions

dispersion_map_to_pixel_arrays

Use a dispersion solution to convert wavelength, slit-position and echelle order numbers to X,Y pixel positions.

get_cached_coeffs

find cached coefficients (if they exist)

API

soxspipe.commonutils.dispersion_map_to_pixel_arrays.dispersion_map_to_pixel_arrays(log, dispersionMapPath, orderPixelTable, removeOffDetectorLocation=True, trimColumns=False)[source][source]

Use a dispersion solution to convert wavelength, slit-position and echelle order numbers to X,Y pixel positions.

Return a line-list with x,y fits given a first guess dispersion map.*

Key Arguments:

  • log – logger

  • dispersionMapPath – path to the dispersion map

  • orderPixelTable – a data-frame including ‘order’, ‘wavelength’ and ‘slit_pos’ columns

  • removeOffDetectorLocation – if data points are found to lie off the detector plane then remove them from the results. Default True

  • trimColumns – if True, only return the specified columns. Default False

Usage:

from soxspipe.commonutils import dispersion_map_to_pixel_arrays
myDict = {
    "order": [11, 11, 11],
    "wavelength": [850.3, 894.3, 983.2],
    "slit_position": [0, 0, 0]
}
orderPixelTable = pd.DataFrame(myDict)
orderPixelTable = dispersion_map_to_pixel_arrays(
    log=log,
    dispersionMapPath="/path/to/map.csv",
    orderPixelTable=orderPixelTable
)
soxspipe.commonutils.dispersion_map_to_pixel_arrays.get_cached_coeffs(log, arm, settings, recipeName, orderDeg, wavelengthDeg, slitDeg, reset=False)[source][source]

find cached coefficients (if they exist)

Return a line-list with x,y fits given a first guess dispersion map.*

Key Arguments:

  • log – logger

  • arm – the spectrograph arm.

  • settings pipeline settings dictionary

  • recipeName – the name of the recipe.

  • orderDeg – the order deg

  • wavelengthDeg – wavelength degree

  • slitDeg – slit degree

  • reset – always reset the coeffs. Don’t use cached. Default False

Usage:

from soxspipe.commonutils import get_cached_coeffs
xcoeff, ycoeff = get_cached_coeffs(
    log=log,
    arm=arm,
    settings=settings,
    recipeName=recipeName,
    orderDeg=orderDeg,
    wavelengthDeg=wavelengthDeg,
    slitDeg=slitDeg
)