API UsageΒΆ

To use the bossdata package in your own python projects, you will normally start with:

import bossdata.path
import bossdata.remote

try:
    finder = bossdata.path.Finder()
    mirror = bossdata.remote.Manager()
except ValueError as e:
    print(e)
    return -1

This code will use the environment variables $BOSS_SAS_PATH, $BOSS_REDUX_VERSION, $BOSS_DATA_URL and $BOSS_LOCAL_ROOT to configure your access to SDSS data files (see Configuration for details.) The finder and mirror objects can be used together to access locally mirrored copies of BOSS data files. For example:

remote_path = finder.get_spec_path(plate=4567, mdj=55589, fiber=88, lite=True)
local_path = mirror.get(remote_path)

Refer to the API documentation for details on using the bossdata.path and bossdata.remote modules.

Certain data files have a helper class for accessing their contents:

For example, to open the spec-lite file used in the example above, use:

import bossdata.spec

spec = bossdata.spec.SpecFile(local_path)

The pattern for accessing large metadata files is somewhat different, and handled by the bossdata.meta.Database class.