PyDL:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- pydl v1.0.1 »
- SDSS Spectroscopic Data (`pydl.pydlspec2d`)

# SDSS Spectroscopic Data (`pydl.pydlspec2d`)

## Introduction

This package provides functionality in the SDSS idlspec2d package. This package is used for processing and analyzing data from the SDSS optical spectrographs. The code is thus relevant to the SDSS Legacy, BOSS and eBOSS surveys. This package does not work with any infrared spectrograph data associated with the APOGEE-2 survey.

The primary technical focus of this particular implementation is the function `combine1fiber()`. This function is responsible for resampling 1D spectra onto a new wavelength solution. This allows for:

1. Shifting a spectrum from observed redshift to rest frame.

2. Coaddition of spectra of the same object, after resampling all spectra onto the same wavelength solution.

The primary scientific motivation of implementing `combine1fiber()` is to create template spectra based on curated spectra of, e.g., luminous red galaxies (LRGs). Principal Component Analysis (PCA) or other techniques may be used to construct template spectra, but putting all spectra on the same rest-frame wavelength solution is the first step.

The idlspec2d package is itself divided into a number of subpackages. Below we list the subpackages and the usability of the PyDL equivalent. The readiness levels are defined as:

Obsolete

  No point in implementing because the purpose of the code lapsed many years ago.

Not Applicable (NA)

  No point in implementing because another built-in or numpy/scipy/astropy package completely replaces this.

None

  Not (yet) implemented at all.

Rudimentary

  Only a few functions are implemented.

Fair

  Enough functions are implemented to be useful, but some are missing.

Good

  Pretty much anything you could do with the idlspec2d code you can do with the equivalent here.

Subpackage | Readiness Level | Comments
--- | --- | ---
apo2d | None | Quick extraction code for quality assurance at observation time.
config | None | Extraction pipeline configuration parameters in object-oriented IDL.
fluxfix | None | Flux calibration
guider | None | Interface to guider camera.
inspect | None | Tools for manual inspection of spectra.
photoz | Obsolete | Photometric redshifts for SDSS objects using spectral templates.
plan | None | Tools for planning exposures and recordings summaries of exposures.
plate | Obsolete | Tools for designing SDSS spectroscopic plates, especially for star clusters.
science | None | Code for science analysis of sets of 1D spectra.
spec1d | Fair | Tools for processing 1D spectra, including redshift fitting.
spec2d | Fair | Tools for extracting spectra from 2D images.
specdb | Obsolete | Tests on storing spectroscopic results in SQL databases.
specflat | None | Flat-fielding of spectroscopic 2D images.
templates | None | Tools for constructing spectroscopic templates.
testsuite | None | Tools for high-level quality assurance, e.g. comparing two reductions of the same data.

## API

### pydl.pydlspec2d Package

This subpackage implements functions from the idlspec2d package.

#### Classes

`Pydlspec2dException` | Exceptions raised by `pydl.pydlspec2d` that don't fit into a standard exception class like `ValueError`.
`Pydlspec2dUserWarning` | Class for warnings issued by `pydl.pydlspec2d`.

#### Class Inheritance Diagram

digraph inheritance9e0d82d933 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "AstropyUserWarning" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="The primary warning class for Astropy."]; "AstropyWarning" -> "AstropyUserWarning" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AstropyWarning" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="The base warning class from which all Astropy warnings should inherit."]; "PydlException" [URL="api/pydl.PydlException.html#pydl.PydlException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for exceptions raised in PyDL functions."]; "Pydlspec2dException" [URL="api/pydl.pydlspec2d.Pydlspec2dException.html#pydl.pydlspec2d.Pydlspec2dException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Exceptions raised by :mod:`pydl.pydlspec2d` that don't fit into a"]; "PydlException" -> "Pydlspec2dException" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Pydlspec2dUserWarning" [URL="api/pydl.pydlspec2d.Pydlspec2dUserWarning.html#pydl.pydlspec2d.Pydlspec2dUserWarning",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Class for warnings issued by :mod:`pydl.pydlspec2d`."]; "AstropyUserWarning" -> "Pydlspec2dUserWarning" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

### pydl.pydlspec2d.spec1d Module

This module corresponds to the spec1d directory in idlspec2d.

#### Functions

`findspec`(*args, **kwargs) | Find SDSS/BOSS spectra that match a given RA, Dec.
`latest_mjd`(plate, **kwargs) | Find the most recent MJD associated with a plate.
`number_of_fibers`(plate, **kwargs) | Returns the total number of fibers per plate.
`pca_solve`(newflux, newivar[, maxiter, ...]) | Replacement for idlspec2d pca_solve.pro.
`plot_eig`(filename[, title, save]) | Plot spectra from an eigenspectra/template file.
`preprocess_spectra`(flux, ivar[, loglam, ...]) | Handle the processing of input spectra through the `combine1fiber()` stage.
`readspec`(platein[, mjd, fiber]) | Read SDSS/BOSS spec2d & spec1d files.
`skymask`(invvar, andmask[, ormask, ngrow]) | Mask regions where sky-subtraction errors are expected to dominate.
`spec_append`(spec1, spec2[, pixshift]) | Append the array spec2 to the array spec1 & return a new array.
`spec_path`(plate[, path, topdir, run2d]) | Return the directory containing spPlate files.
`template_input`(inputfile, dumpfile[, flux, ...]) | Collect spectra and pass them to PCA or HMF solvers to compute spectral templates.
`template_input_main`() | Entry point for the compute_templates script.
`template_metadata`(inputfile[, verbose]) | Read template metadata from file.
`template_qso`(metadata, newflux, newivar[, ...]) | Run PCA or HMF on QSO spectra.
`template_star`(metadata, newloglam, newflux, ...) | Run PCA or HMF on stellar spectra of various classes.
`wavevector`(minfullwave, maxfullwave[, ...]) | Return an array of wavelengths.

#### Classes

`HMF`(spectra, invvar[, K, n_iter, seed, ...]) | Class used to manage data for Heteroscedastic Matrix Factorization (HMF).

#### Class Inheritance Diagram

digraph inheritance3861a94cb3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "HMF" [URL="api/pydl.pydlspec2d.spec1d.HMF.html#pydl.pydlspec2d.spec1d.HMF",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Class used to manage data for Heteroscedastic Matrix Factorization (HMF)."]; }

### pydl.pydlspec2d.spec2d Module

This module corresponds to the spec2d directory in idlspec2d.

#### Functions

`aesthetics`(flux, invvar[, method]) | Add nice values to a spectrum where it is masked.
`combine1fiber`(inloglam, objflux, newloglam) | Combine several spectra of the same object, or resample a single spectrum.
`filter_thru`(flux[, waveimg, wset, mask, ...]) | Compute throughput in SDSS filters.