kosmos package¶
Submodules¶
kosmos.apextract module¶
- kosmos.apextract.BoxcarExtract(img, trace_line, apwidth=8, skysep=3, skywidth=7, skydeg=0, Saxis=0, Waxis=1, display=False, ax=None)¶
This is nearly identical to specreduce.extract.BoxcarExtract, because that was based on the same PyDIS source code as this.
1. Extract the spectrum using the trace. Simply add up all the flux around the aperture within a specified +/- width.
Note: implicitly assumes wavelength axis is perpendicular to the trace.
Fits a polynomial to the sky at each column
Computes the uncertainty in each pixel
- Parameters
img (CCDData object) – This is the image to run extract over
trace_line (1-d array) – The spatial positions (Y axis) corresponding to the center of the trace for every wavelength (X axis), as returned from trace
apwidth (int, optional) – The width along the Y axis on either side of the trace to extract. Note: a fixed width is used along the whole trace. (default is 8 pixels, must be at least 1 pixel)
skysep (int, optional) – The separation in pixels from the aperture to the sky window. (Default is 3, must be at least 1 pixel)
skywidth (int, optional) – The width in pixels of the sky windows on either side of the aperture. (Default is 7, must be at least 1 pixel)
skydeg (int, optional) – The polynomial order to fit between the sky windows. (Default is 0)
Saxis (int, optional) – Set which axis is the spatial dimension. For DIS, Saxis=0 (corresponds to NAXIS2 in header). For KOSMOS, Saxis=1. (Default is 0)
Waxis (int, optional) – Set which axis is the wavelength dimension. For DIS, Waxis=1 (corresponds to NAXIS1 in the header). For KOSMOS, Waxis=0. (Default is 1) NOTE: if Saxis is changed, Waxis will be updated, and visa versa.
ax (matplotlib axes or subplot object, optional) – axes or subplot to be plotted onto. If not specified one will be created. (Default is None)
- Returns
spec (Spectrum1D object) – The extracted spectrum
skyspec (Spectrum1D object) – The sky spectrum used in the extraction process
- kosmos.apextract.trace(img, nbins=20, guess=None, window=None, Saxis=0, Waxis=1, display=False, ax=None)¶
Trace the spectrum aperture in an image
Assumes wavelength axis is along the X, spatial axis along the Y. Chops image up in bins along the wavelength direction, fits a Gaussian within each bin to determine the spatial center of the trace. Finally, draws a cubic spline through the bins to up-sample trace along every X pixel.
- Parameters
img (2d numpy array, or CCDData object) – This is the image to run trace over
nbins (int, optional) – number of bins in wavelength (X) direction to chop image into. Use fewer bins if trace is having difficulty, such as with faint targets (default = 20, but minimum must be 4)
guess (int, optional) – A guess at where the desired trace is in the spatial direction (Y). If set, overrides the normal max peak finder. Good for tracing a fainter source if multiple traces are present.
window (int, optional) – If set, only fit the trace within a given region around the guess position. Useful for tracing faint sources if multiple traces are present, but potentially bad if the trace is substantially bent or warped.
display (bool, optional) – If set to true display the trace over-plotted on the image
Saxis (int, optional) – Set which axis is the spatial dimension. For DIS, Saxis=0 (corresponds to NAXIS2 in header). For KOSMOS, Saxis=1. (Default is 0)
Waxis (int, optional) – Set which axis is the wavelength dimension. For DIS, Waxis=1 (corresponds to NAXIS1 in the header). For KOSMOS, Waxis=0. (Default is 1) NOTE: if Saxis is changed, Waxis will be updated, and visa versa.
ax (matplotlib axes or subplot object, optional) – axes or subplot to be plotted onto. If not specified one will be created. (Default is None)
- Returns
my – The spatial (Y) positions of the trace, interpolated over the entire wavelength (X) axis
- Return type
array
kosmos.flatfield module¶
- kosmos.flatfield.find_illum(flat, threshold=0.9, Saxis=0, Waxis=1)¶
Use threshold to define the illuminated portion of the image.
- Parameters
flat (CCDData object) – An image, typically the median-combined flat
threshold (float) – the fraction to clip to determine the illuminated portion (between 0 and 1)
Saxis (int, optional) – Set which axis is the spatial dimension. For DIS, Saxis=0 (corresponds to NAXIS2 in header). For KOSMOS, Saxis=1. (Default is 0)
Waxis (int, optional) – Set which axis is the wavelength dimension. For DIS, Waxis=1 (corresponds to NAXIS1 in the header). For KOSMOS, Waxis=0. (Default is 1) NOTE: if Saxis is changed, Waxis will be updated, and visa versa.
- Returns
ilum – the indicies along the spatial dimension that are illuminated
- Return type
numpy array
- kosmos.flatfield.flat_response(medflat, smooth=False, npix=11, display=False, Saxis=0, Waxis=1, ax=None)¶
Divide out the spatially-averaged spectrum response from the flat image. This is to remove the spectral response of the flatfield (e.g. Quartz) lamp.
Input flat is first averaged along the spatial dimension to make a 1-D flat. This is optionally smoothed, and then the 1-D flat is divided out of each row of the image.
Note: implicitly assumes spatial and spectral axes are orthogonal, i.e. does not trace lines of constant wavelength for normalization.
- Parameters
medflat (CCDData object) – An image, typically the median-combined flat
smooth (bool (default=False)) – Should the 1-D, mean-combined flat be smoothed before dividing out?
npix (int (default=11)) – if smooth=True, how big of a boxcar smooth kernel should be used (in pixels)?
display (bool (default=False))
Saxis (int, optional) – Set which axis is the spatial dimension. For DIS, Saxis=0 (corresponds to NAXIS2 in header). For KOSMOS, Saxis=1. (Default is 0)
Waxis (int, optional) – Set which axis is the wavelength dimension. For DIS, Waxis=1 (corresponds to NAXIS1 in the header). For KOSMOS, Waxis=0. (Default is 1) NOTE: if Saxis is changed, Waxis will be updated, and visa versa.
ax (matplotlib axes or subplot object, optional) – axes or subplot to be plotted onto. If not specified one will be created. (Default is None)
- Returns
flat
- Return type
CCDData object
- kosmos.flatfield.flatcombine(ffiles, bias=None, trim=True, normframe=True, illumcor=True, threshold=0.9, responsecor=True, smooth=False, npix=11, Saxis=0, Waxis=1, EXPTIME='EXPTIME', DATASEC='DATASEC')¶
A general-purpose wrapper function to create a science-ready flatfield image.
- Parameters
ffiles (list of paths to the flat frame .fits files)
bias (CCDData object, optional (default=None)) – median bias frame generated using e.g. biascombine to subtract from each flat image
trim (bool (default=True)) – Trim the “bias section” out of each flat frame. Uses fits header field defined by DATASEC keyword
normframe (bool (default=True)) – if set normalize each bias frame by its median value before combining
illumcor (bool (default=True)) – use the median-combined flat to determine the illuminated portion of the CCD. Runs find_illum.
threshold (float (optional, default=0.9)) – Passed to find_illum. the fraction to clip to determine the illuminated portion (between 0 and 1)
responsecor (bool (default=True)) – Divide out the spatially-averaged spectrum response from the flat image. Runs flat_response
smooth (bool (default=False)) – Passed to flat_response. Should the 1-D, mean-combined flat be smoothed before dividing out?
npix (int (default=11)) – Passed to flat_response. if smooth=True, how big of a boxcar smooth kernel should be used (in pixels)?
EXPTIME (string (optional, default=’EXPTIME’)) – FITS header field containing the exposure time in seconds.
DATASEC (string (optional, default=’DATASEC’)) – FITS header field containing the data section of the CCD, i.e. to remove the bias section. Used if trim=True
Saxis (int, optional) – Set which axis is the spatial dimension. For DIS, Saxis=0 (corresponds to NAXIS2 in header). For KOSMOS, Saxis=1. (Default is 0)
Waxis (int, optional) – Set which axis is the wavelength dimension. For DIS, Waxis=1 (corresponds to NAXIS1 in the header). For KOSMOS, Waxis=0. (Default is 1) NOTE: if Saxis is changed, Waxis will be updated, and visa versa.
- Returns
flat (CCDData object) – Always returned, the final flat image object
ilum (array) – Returned if illumcor=True, the 1-D array to use for trimming science images to the illuminated portion of the CCD.
kosmos.fluxcal module¶
- kosmos.fluxcal.airmass_cor(object_spectrum, airmass, Xfile)¶
Correct the spectrum based on the airmass. Requires observatory extinction file
- Parameters
object_spectrum (Spectrum1D object)
airmass (float) – The value of the airmass. Note: NOT the header keyword.
Xfile (astropy table) – The extinction table from obs_extinction, with columns (‘wave’, ‘X’) that have standard units of: (angstroms, mag/airmass)
- Return type
The airmass-corrected Spectrum1D object
- kosmos.fluxcal.apply_sensfunc(object_spectrum, sensfunc_spec)¶
Apply the derived sensitivity function, converts observed units (e.g. ADU/s) to physical units (e.g. erg/s/cm2/A).
Sensitivity function is first linearly interpolated onto the wavelength scale of the observed data, and then directly multiplied.
- Parameters
object_spectrum (Spectrum1D object) – the observed object spectrum to apply the sensfunc to
sensfunc_spec (Spectrum1D object) – the output of standard_sensfunc
- Return type
The sensfunc-corrected spectrum, a Spectrum1D object
- kosmos.fluxcal.mag2flux(spec_in, zeropt=48.6)¶
Convert magnitudes to flux units. This is important for dealing with standards and files from IRAF, which are stored in AB mag units. To be clear, this converts to “PHOTFLAM” units in IRAF-speak. Assumes the common flux zeropoint used in IRAF
- Parameters
spec_in (a Spectrum1D object) – An input spectrum with wavelength of the data points in Angstroms as the
spectral_axisand magnitudes of the data as theflux.zeropt (float, optional) – Conversion factor for mag->flux. (Default is 48.60 from AB system)
- Return type
Spectrum1D object with
fluxnow in flux units (erg/s/cm2/A)
- kosmos.fluxcal.obs_extinction(obs_file)¶
Load the observatory-specific airmass extinction file from the supplied library in the directory kosmos/resources/extinction
- Parameters
obs_file (str, {‘apoextinct.dat’, ‘ctioextinct.dat’, ‘kpnoextinct.dat’, ‘ormextinct.dat’}) – The observatory-specific airmass extinction file. If not known for your observatory, use one of the provided files (e.g. kpnoextinct.dat).
Following IRAF standard, extinction files have 2-column format: wavelength (Angstroms), Extinction (Mag per Airmass)
- Returns
Astropy Table with the observatory extinction data, columns have names
(wave, X) and units of (Angstroms, Airmass)
- kosmos.fluxcal.onedstd(stdstar)¶
Load the one-dimensional standard star from the supplied library “onedstd”, originally from IRAF. The provenance of these reference spectra are varied, and future work includes creating a uniform set.
- Parameters
stdstar (str) – Name of the standard star file in the kosmos/resources/onedstds directory to be used for the flux calibration. The user must provide the subdirectory and file name. For example:
>>> standard_sensfunc(obj_spec, standard, stdstar='spec50cal/bd284211.dat', mode='spline')
If no standard is supplied, or an improper path is given, will raise a ValueError.
- Return type
astropy Table with onedstd data
- kosmos.fluxcal.standard_sensfunc(object_spectrum, standard, mode='spline', polydeg=9, badlines=None, display=False, ax=None)¶
Compute the standard star sensitivity function. First down-samples the observed standard star spectrum to the reference spectrum, then computes log_10(Reference Flux / Observed Flux). This log sensfunc is then interpolated using the specified mode back to the entire observed wavelength range, and the normal (i.e. not log10) sensfunc is returned.
- Parameters
object_spectrum (Spectrum1D object) – The observed standard star spectrum
standard (astropy table) – output from onedstd, has columns (‘wave’, ‘width’, ‘mag’, ‘flux’)
mode (str, optional {‘linear’, ‘spline’, ‘poly’, ‘interp’}) – (Default is spline)
polydeg (float, optional) – if mode=’poly’, this is the order of the polynomial to fit through (Default is 9)
display (bool, optional) – If True, plot the sensfunc (Default is False)
badlines (array-like, optional) – A list of values (lines) to mask out of when generating sensfunc
ax (matplotlib axes or subplot object, optional) – axes or subplot to be plotted onto. If not specified one will be created. (Default is None)
- Returns
sensfunc_spec – The sensitivity function in the covered wavelength range for the given standard star, stored as a Spectrum1D
- Return type
Spectrum1D object
kosmos.identify module¶
Functions that work to identify spectral features, and fit them for wavelength calibration.
The work flow is: identify functions are used to either manually or automatically find features (e.g. arclines at known wavelengths), and then fit_wavelength simply interpolates.
IMPROVEMENT NEEDED: some form of reidentify, which takes a very close solution and does simple (affine?) scaling.
- kosmos.identify.air_to_vac(spec)¶
Simple wrapper for the air_to_vac calculation within specutils.utils.wcs_utils
- Parameters
spec (Spectrum1D object)
- Return type
Spectrum1D object with spectral_axis converted from air to vaccum units
- kosmos.identify.find_peaks(wave, flux, pwidth=10, pthreshold=0.97, minsep=1)¶
Given a slice thru an arclamp image, find the significant peaks. Originally from PyDIS
- Parameters
wave (~numpy.ndarray) – Wavelength (could be approximate)
flux (~numpy.ndarray) – Flux
pwidth (float (default=10)) – the number of pixels around the “peak” to fit over
pthreshold (float (default = 0.97)) – Peak threshold, between 0 and 1
minsep (float (default=1)) – Minimum separation
- Return type
Peak Pixels, Peak Wavelengths
- kosmos.identify.fit_wavelength(spec, xpoints, wpoints, display=False, mode='poly', deg=7, GPRscale=101, returnpoints=False, returnvar=False)¶
Fit the wavelength solution from a series of (pixel, Wavelength) datapoints, and apply it a spectrum
- Parameters
spec (Spectrum1D) – the object spectrum to have a new wavelength axis added
xpoints (array-like object) – the pixel values of identified arcline features
wpoints (astropy Quantity) – the corresponding wavelengths for the identiifed pixels. NOTE: Must have sensible units like angstroms, which will be applied to the resulting spectrum.
display (bool, optional (default is False)) – should we plot the (pixel,wavelength) fit residuals?
mode (str, [‘poly’, ‘spline’, ‘interp’, ‘gp’]) – which fitting mode should be used? (Default is ‘poly’) Select between Polynomial, UnivariateSpline, Interpolation, and a Gaussian Process (via george, using ExpSquaredKernel)
deg (int, optional (default is 7)) – if mode=’poly’, set the polynomial degree to use if mode=’interp’, set the interpolation degree (passed as kind=deg to interp1d()).
GPRscale (int, optional (default is 101)) – If mode=’gp’, the Rscale parameter to use with ExpSquaredKernel
returnpoints (bool, optional (default is False)) – If set, return just the fit values corresponding to the input (xpoints, wpoints)
returnvar (bool, optional (default is False)) – If set and mode=’gp’, additionally return the variance on the resulting wavelength axis
- Returns
outspec (Sepctrum1D object) – the same input spectrum, but with the newly fit wavelength axis added.
if returnvar=True, then return – outspec, wavelength_variance
- kosmos.identify.identify_dtw(arc, ref, display=False, upsample=False, Ufactor=5, step_pattern='symmetric1', open_begin=False, open_end=False, peak_spline=True, pthreshold=0.95)¶
Align an arc lamp spectrum in pixel-units to a reference spectrum in wavelength units using Dynamic Time Warping (DTW).
Notes: very simple, fairly robust, but has several key limitations: - resulting wavelength axis may not be smooth (mapping to reference) - DTW fixes the first/last pixel to the start/stop of reference spectrum.
If reference is much wider than observed lamp, this is a big problem. Suggest using identify_dtw for 1st-pass, but examine (pixel, wavelength) plot to see if it diverges strongly!
This function should probably be wrapped with something instrument- specific, to handle known limitations and input a sensible reference.
- Parameters
arc (Spectrum1D object) – the observed Arc-lamp spectrum to align, as returned by e.g. BoxcarExtract spectral axis typically has units of pixels.
ref (Spectrum1D object) – reference spectrum to match to
upsample (bool (default=True)) – do the DTW on an up-sampled version of the observed arc and reference spectra using a gaussian smooth. Linearlly down-sample result. WARNING: doesn’t like backwards wavelength axis for either arc or ref…
Ufactor (int (default=5)) – the factor to up-sample both the ref and arc spectra by. UPGRADE IDEA: up-sample the arc and ref by different factors?
peak_spline (bool (default=True)) – After DTW match has been run on the whole spectrum, select pixels with peaks in arc spectrum and fit a spline. Final wavelength solution returned comes from spline fit. This is often useful since only the peaks carry “information” in the DTW match, and the wavelength solution can be very non-smooth between peaks. This mode essentially uses DTW to do peak-wavelength identification. If you don’t like the spline default, set to False and do your own interpolation of the line wavelengths. NEED TO UPDATE DESCRIPTION HERE… RETURNS ONLY PEAKS, LIKE OTHER IDENTIFY MODES!
pthreshold (float (default=0.95)) – Number between 0 and 1, the threshold to use in defining “peaks” in the spectrum if peak_spline=True.
display (bool (optional, default=False)) – if set, produce a plot of pixel vs wavelength solution
- Returns
The pixel locations and wavelengths of the identified features
(lines or the whole spectrum) – pixel, wavelength
- kosmos.identify.identify_nearest(arcspec, wapprox=None, linelist=None, linewave=None, autotol=25, silent=False)¶
Identify arc lines using a simple greedy “nearest neighbor” approach. Requires an approximate wavelength solution (e.g. as provided by image header keywords). Peaks are first detected in the 1d spectrum. Starting from the center of the spectrum, the closest lines within a tolerance are picked. A linear interpolation solution is iteratively fit with each successive line added.
- Parameters
arcspec (Spectrum1D) – the 1d spectrum of the arc lamp to be fit.
wapprox (astropy Quantity, or None) – the approximate wavelenth solution, as e.g. provided by the image header. Must have sensible units, like Angstroms. NOTE: If set to None, assumes the arcspec object has the approximate wavelength axis.
linelist (str, optional) – name of linelist to load, is passed to loadlinelist()
linewave (numpy array or None, optional) – Optionally pass an array of arclines to fit, as returned by e.g. loadlinelist()
autotol (int, optional (default is 25)) – the tolerance in pixel units to allow nearest matches within.
silent (bool, optional (default is False)) – suppress a few helpful summary messages
- Returns
xpoints, wpoints – successfully identified lines.
- Return type
the pixel and wavelength values of the
- kosmos.identify.identify_widget(arcspec, silent=False)¶
Interactive version of the Identify GUI, specifically using ipython widgets.
Each line is roughly identified by the user, then a Gaussian is fit to determine the precise line center. The reference value for the line is then entered by the user.
When finished, the output lines should usually be passed in a new Jupter notebook cell to identify for determining the wavelength solution: >>>> xpl,wav = identify_widget(arcspec) # doctest: +SKIP >>>> fit_spec = fit_wavelength(obj_spec, xpl, wav) # doctest: +SKIP
NOTE: Because of the widgets used, this is not well suited for inclusion in pipelines, and instead is ideal for interactive analysis.
- Parameters
arcspec (Spectrum1D) – the 1d spectrum of the arc lamp to be fit.
silent (bool, optional (default is False)) – Set to True to silence the instruction print out each time.
- Returns
The pixel locations and wavelengths of the identified lines
pixel, wavelength
- kosmos.identify.loadlinelist(file)¶
Load a list of arclamp lines from the supplied library of files in the directory: kosmos/resources/linelists.
Note: this directory was mostly taken from IRAF. https://github.com/joequant/iraf/tree/master/noao/lib/linelists
- Parameters
file (str) – name of linelist to load
- Return type
numpy array of arclines
kosmos.imtools module¶
This file contains tools to help with image manipulation, such as wrappers around astropy tools for bias combining.
- kosmos.imtools.biascombine(bfiles)¶
A simple wrapper to go through bias frames, read them in, and combine them.
Currently median combine is hard-coded, but ccdproc.Combiner does have functions for other methods. See: https://ccdproc.readthedocs.io/en/latest/api/ccdproc.Combiner.html
- Parameters
bfiles (list of paths to bias frame .fits files)
- Returns
bias
- Return type
CCDData object
- kosmos.imtools.proc(file, bias=None, flat=None, dark=None, trim=True, ilum=None, Saxis=0, Waxis=1, EXPTIME='EXPTIME', DATASEC='DATASEC', CR=False, GAIN='GAIN', READNOISE='RDNOISE', CRsigclip=4.5)¶
Semi-generalized function to read a FITS file in, divide by exposure time (returns units of ADU/s), and optionally perform basic CCD processing to it (bias, dark, flat corrections, biassec and illumination region trimming).
- Parameters
file (string) – path to FITS file
bias (CCDData object, optional (default=None)) – median bias frame generated using e.g. biascombine to subtract from each flat image
dark (CCDData object, optional) – dark frame to subtract
flat (CCDData object, optional) – combined flat frame to divide
trim (bool (default=True)) – Trim the “bias section” out of each flat frame. Uses fits header field defined by DATASEC keyword
ilum (array, optional) – if provided, trim image to the illuminated portion of the CCD.
EXPTIME (string (optional, default=’EXPTIME’)) – FITS header field containing the exposure time in seconds.
DATASEC (string (optional, default=’DATASEC’)) – FITS header field containing the data section of the CCD, i.e. to remove the bias section. Used if trim=True
Saxis (int, optional) – Set which axis is the spatial dimension. For DIS, Saxis=0 (corresponds to NAXIS2 in header). For KOSMOS, Saxis=1. (Default is 0)
Waxis (int, optional) – Set which axis is the wavelength dimension. For DIS, Waxis=1 (corresponds to NAXIS1 in the header). For KOSMOS, Waxis=0. (Default is 1) NOTE: if Saxis is changed, Waxis will be updated, and visa versa.
CR (bool (default=False)) – If True, use the L.A. Cosmic routine to remove cosmic rays from image before reducing.
GAIN (string (optional, default=’GAIN’)) – FITS header field containing the Gain parameter, used by L.A. Cosmic
READNOISE (string (optional, default=’RDNOISE’)) – FITS header field containing the Read Noise parameter, used by L.A. Cosmic
CRsigclip (int (optional, default=4.5)) – sigma-clipping parameter passed to L.A. Cosmic
gain_apply (bool (optional, default=False)) – apply gain to image. If this is set to true and the bias or flat are not in units of electrons per adu this may result in an error
- Returns
img
- Return type
CCDData object
kosmos.version module¶
kosmos.wrappers module¶
Scripts that wrap around the spectral reduction functions. In the future, could include instrument or setup sepcific reduction workflows here.
- kosmos.wrappers.script_reduce(script, trim=True, apwidth=10, skysep=5, skywidth=5, trace_nbins=15, trace_guess=None, trace_window=None, stdtrace=False, obs_file='apoextinct.dat', linelist='apohenear.dat', waveapprox=False, Saxis=0, Waxis=1, display=True, display_all=False, write_reduced=True, debug=False, silencewarnings=False)¶
Wrapper function that carries out all aspects of simple spectral reduction, according to a script. Here the script file is analogous to a simple observing log, a CSV that has two columns:
file path, type
- where type must be from the list of available filetypes:
(bias, flat, arc, std, object)
The script is processed top-to-bottom. Sequential files of the same type are processed together (e.g. biases are combined), and applied on all subsequent files. Wavelength solutions or sensitivity functions are defined and used on all subsequent files. If Arc lamps are taken after each observation, putting the arc file before the observation file ensures a new wavelength solution is applied.
- Standards must have the onedstd reference included as:
std:LIBRARY/FILE.dat
(see example script below)
This framework allows script_reduce to automatically process most sets of simple long-slit observations – even from multiple nights – with well-defined results, but does not allow for fully customized adjustments that may be needed for precision work.
- EXAMPLE SCRIPT FILE
file1.fits, bias file2.fits, bias file3.fits, flat file4.fits, flat file8.fits, arc file6.fits, std:spec50cal/bd284211.dat file7.fits, object
- Parameters
script (str) – The .csv file to process (required)
trim (bool, optional (default is True))
apwidth (int, optional (default is 10)) – The width along the spatial axis on either side of the trace to extract. (passed to apextract)
skysep (int, optional (default is 5)) – The separation in pixels from the aperture to the sky window. (passed to apextract)
skywidth (int, optional (default is 5)) – The width in pixels of the sky windows on either side of the aperture. (passed to apextract)
trace_nbins (int, optional (default is 15)) – number of bins in wavelength direction to chop image into. (passed to trace as nbins)
trace_guess (int or None, optional (default is None)) – A guess at where the desired trace is in the spatial direction. If set, overrides the normal max peak finder. Good for tracing a fainter source if multiple traces are present. (passed to trace as guess)
trace_window (int or None, optional (default is None)) – If set, only fit the trace within a given region around the guess position. Useful for tracing faint sources if multiple traces are present, but potentially bad if the trace is substantially bent or warped. (passed to trace as window)
stdtrace (bool, optional (default is False)) – if True, use first object or standard to establish the trace, and use for extracting every spectrum thereafter.
obs_file (str, optional (default is ‘apoextinct.dat’)) –
- Observatory-specific airmass extinction file
passed to obs_extinction
linelist (str, optional (default is ‘apohenear.dat’)) – Passed to loadlinelist to load arclines, which are used by identify_nearest.
waveapprox (bool, optional (default is False)) – if set, use the approximate wavelength from the header ‘DISPDW’ and ‘DISPWC’ keywords. Usually not great. (probably needs to be genearlized better)
Saxis (int, optional (default is 0)) – Set which axis is the spatial dimension. For DIS, Saxis=0 (corresponds to NAXIS2 in header). For KOSMOS, Saxis=1.
Waxis (int, optional (default is 1)) – Set which axis is the wavelength dimension. For DIS, Waxis=1 (corresponds to NAXIS1 in the header). For KOSMOS, Waxis=0. NOTE: if Saxis is changed, Waxis will be updated, and visa versa.
display (bool, optional (default is True)) – if set, plot reduced object and standard spectra to the screen
display_all (bool, optional (default is False)) – if set, passes display=True to all other functions
write_reduced (bool, optional (default is True)) – if set, write reduced object and standard spectra to a .fits file, and make a log file for this run.
silencewarnings (bool, optional (default is False)) – aggresively silence warnings that get spit out, mainly from WCS. (caution: you might miss an important failure)
- Returns
(e.g. bias.fits, flat.fits), and fully reduced versions of objects
- Return type
Output files are created for combined calibration frames