Command-line interface

The command target_selection provides CLI access to some of the features of the library.

Examples of use

When target_selection is imported a database connection to sdss5db is attempted using the profile that sdssdb identifies as matching the domain. To use a specific profile

target_selection --profile operations

or one can provide the database connection parameters. Most commands require a read-write connection to the database so we set the user to sdss

target_selection --user sdss --host operations.sdss.org

We can also enable the verbose mode by passing -v. To run a cross-match run we use the xmatch subcommand with the cross-match plan version in the configuration file

target_selection --user sdss xmatch "0.1.2"

The run subcommand will execute target selection for a given plan and load the results into targetdb

target_selection --verbose --user sdss run --overwrite "0.4.1"

This will execute target selection plan 0.4.1 from the configuration file, overwriting the intermediate table if it exists.

We can remove the results of a target selection run from targetdb

target_selection --user sdss clear "0.4.1"

Note that this won’t remove entries from the target or magnitude table because a target entry can be related to multiple target selection plans.

Available commands

This is an auto-generated list the subcommands and parameters available for the target_selection CLI. It is equivalent of running target_selection <subcommand> --help for each subcommand.

target_selection

Performs tasks related to target selection for SDSS-V.

target_selection [OPTIONS] COMMAND [ARGS]...

Options

-p, --profile <profile>
-d, --dbname <dbname>
-u, --user <user>
-h, --host <host>
-P, --port <port>
-v, --verbose

outputs extra debug information

--save-log <save_log>

saves the log to a file.

clear

Clear all data for a target selection plan.

target_selection clear [OPTIONS] TARGETING_PLAN

Options

--tables

also remove intermediate tables

Arguments

TARGETING_PLAN

Required argument

load-files

Loads a carton from a FITS file.

target_selection load-files [OPTIONS] PLAN FILES...

Options

--program <program>
Default:

'open_fiber'

--category <category>
Default:

'open_fiber'

Arguments

PLAN

Required argument

FILES

Required argument(s)

run

Runs target selection for all cartons.

target_selection run [OPTIONS] TARGETING_PLAN

Options

--config-file <config_file>

the file to read. Defaults to the internal configuration file.

--overwrite

drop intermediate tables if they exist

--keep

keep intermediate tables after loading

--skip-query

do not run the query, only load intermediate table if it exists

-r, --region <region>

the region (ra, dec, radius) to query

-l, --limit <limit>

limit number of targets in the carton

--load, --no-load

whether to load data into targetdb.target

-i, --include <include>

comma-separated carton names to include

-e, --exclude <exclude>

comma-separated carton names to exclude

-w, --write-table

write table of loaded targets as a FITS file

--exclude-open-fiber

do not process open fiber cartons

-M, --add-magnitudes, -m, --no-add-magnitudes

Whether to add optical magnitudes during the carton run.

Arguments

TARGETING_PLAN

Required argument

skies

Runs the parent sky catalogue creation routine.

target_selection skies [OPTIONS]

Options

--cpus <cpus>

Number of CPUs to use.

xmatch

Runs catalogue cross-matching from a configuration file.

target_selection xmatch [OPTIONS] XMATCH_PLAN

Options

--file <file>

the file to read. Defaults to the internal configuration file.

Arguments

XMATCH_PLAN

Required argument