bossdata.path module

Generate paths to BOSS data files.

The path module provides convenience methods for building the paths of frequently used data files. Most scripts will create a single Finder object using the default constructor for this purpose:

import bossdata.path
finder = bossdata.path.Finder()

This finder object is normally configured by the $BOSS_SAS_PATH and $BOSS_REDUX_VERSION environment variables and no other modules uses these variables, except through a a Finder object. These parameters can also be set by Finder constructor arguments. When neither the environment variables nor the constructor arguments are set, defaults appropriate for the most recent public data release (DR12) are used.

Finder objects never interact with any local or remote filesystems: use the bossdata.remote module to download data files and access them locally. See API Usage for recommendations on using the bossdata.path and bossdata.remote modules together.

class bossdata.path.Finder(sas_path=None, redux_version=None, verbose=True)[source]

Bases: object

Initialize a path finder object.

When the constructor is called with no arguments, it will raise a ValueError if either BOSS_SAS_PATH or BOSS_REDUX_VERSION is not set.

Parameters:
  • sas_path (str) – Location of the SAS root path to use, e.g., /sas/dr12. Will use the value of the BOSS_SAS_PATH environment variable if this is not set.
  • redux_version (str) – String tag specifying the BOSS spectro reduction version to use, e.g., v5_7_0. Will use the value of the BOSS_REDUX_VERSION environment variable if this is not set.
Raises:

ValueError – No SAS root or redux version specified on the command line or via environment variables.

default_quasar_catalog_name = 'DR12Q'

Default quasar catalog name.

For more info about the BOSS quasar catalog, see http://www.sdss.org/dr12/algorithms/boss-dr12-quasar-catalog/

default_redux_version = 'v5_7_0'

Default to use when $BOSS_REDUX_VERSION is not set.

See Executable scripts and API Usage for details.

default_sas_path = '/sas/dr12/boss'

Default to use when $BOSS_SAS_PATH is not set.

See Executable scripts and API Usage for details.

get_plate_path(plate, filename=None)[source]

Get the path to the specified plate directory or file.

The returned path contains files that include all targets on the plate. Use the get_spec_path() method for the path of a single spectrum file.

This method only performs minimal checks that the requested plate number is valid.

Parameters:
  • plate (int) – Plate number, which must be positive.
  • filename (str) – Name of a file within the plate directory to append to the returned path.
Returns:

Full path to the specified plate directory or file within this directory.

Return type:

str

Raises:

ValueError – Invalid plate number must be > 0.

get_plate_plan_path(plate, mjd, combined=True)[source]

Get the path to the specified plate plan file.

A combined plan may span several nearby MJDs, in which case the last MJD is the one used to identify the plan.

Parameters:
  • plate (int) – Plate number, which must be positive.
  • mjd (int) – Modified Julian date of the observation, which must be > 45000.
  • combined (bool) – Specifies the combined plan, which spans all MJDs associated with a coadd, but does not include calibration frames (arcs,flats) for a specific MJD.
Returns:

Full path to the requested plan file.

Return type:

str

Raises:

ValueError – Invalid plate or mjd inputs.

get_plate_spec_path(plate, mjd)[source]

Get the path to the file containing combined spectra for a whole plate.

Combined spectra for all exposures of a plate are packaged in spPlate files. As of DR12, these files are about 110Mb for 1000 spectra.

Parameters:
  • plate (int) – Plate number, which must be positive.
  • mjd (int) – Modified Julian date of the observation, which must be > 45000.
Returns:

Full path to the requested plan file.

Return type:

str

Raises:

ValueError – Invalid plate or mjd inputs.

get_platelist_path()[source]

Get the location of the platelist summary file.

The platelist contains one row per observation (PLATE-MJD), unlike most other sources of metadata which contain one row per target (PLATE-MJD-FIBER).

get_quasar_catalog_path(catalog_name=None)[source]

Get the location of the quasar catalog file.

The quasar catalog is documented at http://www.sdss.org/dr12/algorithms/boss-dr12-quasar-catalog/. As of DR12, the file size is about 513Mb.

Parameters:catalog_name (str) – BOSS quasar catalog name. Will use the get_default_quasar_catalog_name() method if this is not set.
get_sp_all_path(lite=True)[source]

Get the location of the metadata summary file.

The spAll file provides extensive metadata for all survey targets as a FITS file. There is also a smaller “lite” version containing a subset of this metadata in compressed text format. As of DR12, the full file size is about 10Gb and the lite file is about 115Mb.

Parameters:lite (bool) – Specifies the “lite” version which contains all rows but only the most commonly used subset of columns. The lite version is a compressed (.gz) text data file, while the full version is a FITS file.
get_spec_path(plate, mjd, fiber, lite=True)[source]

Get the location of the spectrum file for the specified observation.

The DR12 data model for the returned files is at http://dr12.sdss3.org/datamodel/files/BOSS_SPECTRO_REDUX/RUN2D/spectra/PLATE4/spec.html but only HDUs 0-3 are included in the (default) lite format. Each lite (full) file is approximately 0.2Mb (1.7Mb) in size.

Use the get_plate_path() method for the path to files that include all targets on a plate.

This method only performs minimal checks that the requested plate-mjd-fiber are valid.

Parameters:
  • plate (int) – Plate number, which must be positive.
  • mjd (int) – Modified Julian date of the observation, which must be > 45000.
  • fiber (int) – Fiber number of the target on this plate, which must be in the range 1-1000 (or 1-640 for plate < 3510).
  • lite (bool) – Specifies the “lite” version which contains only HDUs 0-3, so no per-exposure data is included.
Returns:

Full path to the spectrum file for the specified observation.

Return type:

str

Raises:

ValueError – Invalid plate, mjd or fiber inputs.