Spectral utilities

Spectral utilities#

excalibuhr.utils Module#

Functions#

PolyfitClip(x, y, order[, mask, clip, max_iter])

Perform weighted least-square polynomial fit, iterratively cliping pixels above a certain sigma threshold

SpecConvolve(in_wlen, in_flux, out_res[, ...])

Convolve the input spectrum to a lower resolution with a Gaussian kernel.

SpecConvolve_GL(in_wlen, in_flux, out_res, gamma)

Convolve the input spectrum to a lower resolution with a Voigt kernel, i.e. the convolution of a Gaussian and a Lorentzian kernel.

align_jitter(dt, err, pix_shift[, tw, debug])

apply flat fielding

combine_frames(dt, err[, collapse, clip, ...])

combine multiple images or spectra with error propogation

create_eso_recipe_config(eso_recipe, ...)

tomasstolker/pycrires Internal method for creating a configuration file with default values for a specified EsoRex recipe.

detector_shotnoise(im, ron[, GAIN, NDIT])

calculate the detector shotnoise map

extract_blaze(im, badpix, trace[, f0, fw, sigma])

Collpase 2D image along the cross-dispersion direction in an order-by-order basis.

extract_spec(det, det_err, badpix, trace, ...)

Extract 1D spectra from detector images

flat_fielding(det, err, flat[, debug])

apply flat fielding

func_wlen_optimization(poly, *args)

cost function for optimizing wavelength solutions

genline(wlen, wlen_id)

generate lamp model spectra for specific wavelength settings from linelist

get_PHOENIX_stellar_model(temp, wave_cut[, logg])

Get the PHOENIX stellar model.

im_order_cut(im, trace)

Cut out individual orders from the detector image

instrument_response(std, tellu, temp, vsini)

Method for calibrating spectral shape using standard star observations.

master_flat_norm(det, badpix, trace, slit_meta)

normalize master flat frame and extract balze function

measure_Gaussian_center(y, peaks, width)

measure the centers of lines by fitting guassian profiles

molecfit(input_path, spec[, wave_range, ...])

A wrapper of molecfit for telluric correction

optimal_extraction(D_full, V_full, bpm_full, ...)

Optimal extraction based on Horne(1986).

order_trace(det, badpix, slitlen[, ...])

Trace the spectral orders

peak_slit_fraction(im, trace)

locate the peak signal along the slit

readout_artifact(det, det_err, badpix, trace)

Correct for readout noise artifacts that appear like vertical strips by subtracting the inter-order average value in each column on detector.

remove_skylight(D_full, V_full, M_bpm, ...)

Remove sky background in a 2D detector image.

remove_starlight(D_full, V_full, spec_star, ...)

[EXPERIMENTAL!] Remove starlight contamination at the position of the widely separated companion in a 2D detector image.

rot_int_cmj(wave, flux, vsini[, epsilon, ...])

Adapted from Carvalho & Johns-Krull (2023).

slit_curve(fpet, une, badpix, trace, ...[, ...])

Trace the curvature of the slit and determine the wavelength solution

slit_polyval(xx, meta)

evaluate slit curvature polynomials given the pixel grid

spectral_rectify_interp(im_list, badpix, ...)

Correct for the slit-tilt by interpolating to a pixel-grid

trace_polyval(xx, tw)

evaluate trace polynomials given the pixel grid

trace_rectify_interp(im_list, trace[, debug])

Correct for the curvature of traces by interpolating to a pixel-grid pivoting on the middle of the detector

util_master_dark(dt[, combine_mode, badpix_clip])

combine dark frames; generate bad pixel map and readout noise frame

util_master_flat(dt, dark[, combine_mode, ...])

combine flat frames; generate bad pixel map

wlen_solution(fluxes, errs, w_init, transm_spec)

Method for refining wavelength solution using a quadratic polynomial correction Poly(p0, p1, p2).