qusp.paths module

Provides a class to manage paths to boss data directories.

Examples

Via standard constructor:

>>> paths = qusp.paths.Paths(boss_root='/Users/daniel/data/boss', boss_version='v5_7_0')

Via environment variables:

BOSS_ROOT='/Users/daniel/data/boss'
BOSS_VERSION='v5_7_0'
>>> paths = qusp.paths.Paths()

Via command line arguments:

./example --boss-root /Users/daniel/data/boss --boss-version v5_7_0

where the example program looks something like:

def main():
    parser = argparse.ArgumentParser()
    qusp.Paths.add_args(parser)
    args = parser.parse_args()
    paths = qusp.Paths(**qusp.Paths.from_args(args))

class qusp.paths.Paths(boss_root=None, boss_version=None)

Bases: object

Manages a path to a boss data directory.

Parameters:
  • boss_root (str, optional) – The root boss directory path. Defaults to None, in which case, the environment variable BOSS_ROOT is expected to specify the path to the root boss directory.
  • boss_version (str, optional) – The boss version directory name. Defaults to None, in which case, the environment variable BOSS_VERSION is expected to specify the boss version directory name.
Raises:

RuntimeError if either `boss_root` or `boss_version` are not – specifed by parameters or environment variables.

static add_args(parser)

Adds arguments to the provided command-line parser.

Parameters:parser (argparse.ArgumentParser) – an argument parser
static from_args(args)

Returns a dictionary of constructor parameter values based on the parsed args provided.

Parameters:args (argparse.Namespace) – argparse argument namespace
Returns:a dictionary of Paths constructor parameter values
get_spec_filename(target, lite=False)
get_spplate_filename(target)

Returns full path to the specified target’s spPlate fits file.

Parameters:target (qusp.target.Target) –
Returns:spplate_filename (str)