sofia_redux.spectroscopy: Spectroscopic Algorithms for SOFIA Pipelines#

The sofia_redux.spectroscopy package contains supporting algorithms and helper functions for spectroscopic data reduction pipelines.

Reference/API#

sofia_redux.spectroscopy.adjustguesspos Module#

Functions#

adjustguesspos(edgecoeffs, xranges, flat, ...)

Adjust the guess positions via cross-correlation

sofia_redux.spectroscopy.atmosdisp Module#

Functions#

atmosdisp(wavelength, refwave, za, pressure, ...)

Compute the atmospheric dispersion relative to wave0

sofia_redux.spectroscopy.binspec Module#

Functions#

binspec(x, y, delta[, xout, lmin, lmax, average])

Bin a spectrum between lmin and lmax with bins delta wide

sofia_redux.spectroscopy.combflagstack Module#

Functions#

combflagstack(stack[, nbits, axis])

Combine bit-set flag arrays.

sofia_redux.spectroscopy.earthvelocity Module#

Functions#

cartesian_lsr([definition])

Find the radial LSR velocity towards sky coordinates.

cartesian_helio(time[, center, location])

Calculate the Cartesian velocity of the Sun.

earthvelocity(ra, dec, time[, equinox, ...])

Provide velocities of the Earth towards a celestial position.

sofia_redux.spectroscopy.extinction_model Module#

Classes#

ExtinctionModel([model, cval, sigma, ...])

Extinction model for de-reddening spectra.

Class Inheritance Diagram#

Inheritance diagram of sofia_redux.spectroscopy.extinction_model.ExtinctionModel

sofia_redux.spectroscopy.extspec Module#

Functions#

col_subbg(col_arc, col_image, col_var, ...)

Fit background to a single column.

extspec(rectimg[, profile, spatial_map, ...])

Extracts spectra from a rectified spectral image.

sofia_redux.spectroscopy.findapertures Module#

Functions#

find_apertures(profiles[, npeaks, orders, ...])

Determine the position of the aperture(s) in a spatial profile.

sofia_redux.spectroscopy.findorders Module#

Functions#

findorders(image, guesspos[, sranges, step, ...])

Determines the position of the order(s) in a spectral image

sofia_redux.spectroscopy.flats Module#

Classes#

FlatBase(filename)

FlatInfo(filename)

Flat(filename)

Class Inheritance Diagram#

Inheritance diagram of sofia_redux.spectroscopy.flats.FlatBase, sofia_redux.spectroscopy.flats.FlatInfo, sofia_redux.spectroscopy.flats.Flat

sofia_redux.spectroscopy.fluxcal Module#

Functions#

get_wave_shift(flux, correction, ...[, ...])

Get pixel shift between flux and correction curve.

fluxcal(spectra, atran[, response, ...])

Calibrate and telluric correct spectral flux.

sofia_redux.spectroscopy.getapertures Module#

Functions#

get_apertures(profiles, apertures[, ...])

Determine aperture radii for extraction.

sofia_redux.spectroscopy.getspecscale Module#

Functions#

getspecscale(stack[, refidx])

Determines the scale factors for a _stack of spectra

sofia_redux.spectroscopy.interpflagspec Module#

Functions#

interpflagspec(x, y, xout[, nbits, cval])

Performs a linear interpolation on a bit-set flag array

sofia_redux.spectroscopy.interpspec Module#

Functions#

interpspec(x, y, xout[, error, leavenans, cval])

Perform a linear interpolation and propagate errors

sofia_redux.spectroscopy.mergespec Module#

Functions#

mergespec(spec1, spec2[, info, sum_flux, ...])

Combine two spectra into a single spectrum

sofia_redux.spectroscopy.mkapmask Module#

Functions#

mkapmask(slit, wave, apertures[, background])

Constructs a 2D aperture mask.

sofia_redux.spectroscopy.mkspatprof Module#

Functions#

mkspatprof(rectimg[, atran, atmosthresh, ...])

Construct average spatial profiles.

sofia_redux.spectroscopy.nlambda Module#

Functions#

nlambda(wavelength, pressure, temperature[, ...])

Compute the real part of the refractive index of air.

sofia_redux.spectroscopy.radvel Module#

Functions#

radvel(header[, equinox])

Calculate the expected extrinsic radial velocity wavelength shift.

sofia_redux.spectroscopy.readflat Module#

Functions#

readflat(filename)

Reads a Spextool flat field FITS image

sofia_redux.spectroscopy.readspec Module#

Functions#

readspec(filename)

Reads a SpeX spectral FITS image

sofia_redux.spectroscopy.readwavecal Module#

Functions#

readwavecal(filename[, rotate, info])

Read a Spextool wavecal file

sofia_redux.spectroscopy.rectify Module#

Functions#

rectify(image, ordermask, wavecal, spatcal)

Construct average spatial profiles over multiple orders

sofia_redux.spectroscopy.rectifyorder Module#

Functions#

get_rect_xy(xarray, yarray, xvals, yvals[, ...])

Given arrays of x and y coordinates, interpolate to defined grids

trim_xy(xarray, yarray, xgrid, ygrid[, ...])

Trim rows and columns from the edges of the coordinate arrays.

rectifyorder(image, ordermask, wavecal, ...)

Construct average spatial profiles for a single order

update_wcs(result, spatcal)

Update a FITS header with spectral WCS information.

rectifyorder(image, ordermask, wavecal, ...)

Construct average spatial profiles for a single order

sofia_redux.spectroscopy.rieke_unred Module#

Functions#

rieke_unred(wave, flux, ebv[, r_v])

De-redden a flux vector.

sofia_redux.spectroscopy.scaleimgs Module#

Functions#

scaleimgs(images[, variances, axis, nan])

Scales a set of images to the median flux level of all images

sofia_redux.spectroscopy.si_index_of_refraction Module#

Functions#

si_index_of_refraction(wave, temperature)

Return the index of refraction for Si

sofia_redux.spectroscopy.simwavecal2d Module#

Functions#

simwavecal2d(shape, edgecoeffs, xranges, ...)

Simulate a 2D wavecal file using pixels for wavelengths

sofia_redux.spectroscopy.smoothres Module#

Functions#

smoothres(x, y, resolution[, siglim])

Smooth a data to a constant resolution

sofia_redux.spectroscopy.speccor Module#

Functions#

speccor(stack[, fwidth, err_stack, refspec, ...])

Correct a _stack of spectra for shape differences

sofia_redux.spectroscopy.tracespec Module#

Functions#

tracespec(rectimg, positions[, orders, ...])

Trace spectral continua in a spatially/spectrally rectified image.

sofia_redux.spectroscopy.wave_calibration Module#

Functions#

readwavecalinfo(filename)

Retrieve wave calibration

Classes#

BaseWavecal()

Wavecal(data, header)

Initializes basic class

Wavecal1D(data, header)

Initializes basic class

Wavecal1DXD(data, header)

Initializes basic class

Wavecal2D(data, header)

Initializes basic class

Wavecal2DXD(data, header)

Initializes basic class

LineInfo()

Class Inheritance Diagram#

Inheritance diagram of sofia_redux.spectroscopy.wave_calibration.BaseWavecal, sofia_redux.spectroscopy.wave_calibration.Wavecal, sofia_redux.spectroscopy.wave_calibration.Wavecal1D, sofia_redux.spectroscopy.wave_calibration.Wavecal1DXD, sofia_redux.spectroscopy.wave_calibration.Wavecal2D, sofia_redux.spectroscopy.wave_calibration.Wavecal2DXD, sofia_redux.spectroscopy.wave_calibration.LineInfo