Command Line Interface¶
Astra provides a command line tool called astra for managing the database, migrating spectra, running analysis pipelines, creating data products, and managing configuration.
General Usage¶
astra [COMMAND] [OPTIONS] [ARGUMENTS]
Run astra --help to see all available commands, or astra COMMAND --help for help on a specific command.
astra version¶
Print the installed version of Astra.
Usage:
astra version
Example:
astra version
# Astra version: 0.6.0
astra init¶
Initialize the Astra database by creating the schema and all required tables. This must be run before any other operations that interact with the database.
Usage:
astra init [OPTIONS]
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
|
Drop all existing tables before re-creating them. |
|
int |
|
Delay in seconds before dropping tables (gives you time to cancel). |
Examples:
# Initialize the database (create tables if they don't exist)
astra init
# Re-initialize by dropping and re-creating all tables
astra init --drop-tables
# Drop and re-create with no delay
astra init --drop-tables --delay 0
astra migrate¶
Migrate spectra and auxiliary information (photometry, astrometry, targeting, extinction, etc.) into the Astra database. This command ingests APOGEE and/or BOSS spectra, creates source entries, links spectra to sources, and populates metadata from external catalogs.
Migration tasks are executed in dependency order: spectra are ingested first, then sources are created, then metadata is populated.
Usage:
astra migrate [OPTIONS]
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
str |
|
APOGEE data reduction pipeline version (e.g., |
|
str |
|
BOSS data reduction pipeline version (e.g., |
|
int |
|
Limit the number of spectra to migrate. |
|
int |
|
Maximum MJD of spectra to migrate. |
|
bool |
|
Migrate metadata (photometry, astrometry, targeting, etc.). |
|
bool |
|
Only attempt to migrate new spectra (skip already-ingested ones). |
|
bool |
|
Compute extinction values. |
Examples:
# Migrate APOGEE spectra from a specific data reduction version
astra migrate --apred 1.3
# Migrate BOSS spectra
astra migrate --run2d v6_1_3
# Migrate both APOGEE and BOSS spectra
astra migrate --apred 1.3 --run2d v6_1_3
# Migrate with a limit, skipping metadata
astra migrate --apred 1.3 --limit 1000 --no-metadata
# Migrate SDSS4 DR17 APOGEE spectra
astra migrate --apred dr17
When metadata migration is enabled, the following catalogs and computations are included:
Gaia DR3 source IDs, astrometry, and photometry
Gaia synthetic photometry
Zhang stellar parameters
Bailer-Jones distances
2MASS, unWISE, and GLIMPSE photometry
HEALPix values
TIC v8 identifiers
SDSS4 APOGEE IDs
Galactic coordinates
Targeting cartons
Visit spectra counts
W1/W2 magnitudes
Extinction / reddening
astra run¶
Run an Astra analysis pipeline task on spectra. The task is executed locally on the current machine.
Usage:
astra run TASK [SPECTRUM_MODEL] [SDSS_IDS...] [OPTIONS]
Arguments:
Argument |
Description |
|---|---|
|
The task name to run. Can be a short name (e.g., |
|
The spectrum model to use (e.g., |
|
Optional list of SDSS IDs to restrict processing to specific sources. |
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
int |
|
Limit the number of spectra to process. |
|
int |
|
Page number for paginated results ( |
Examples:
# Run the ASPCAP pipeline on all eligible spectra
astra run aspcap
# Run on a specific spectrum model
astra run aspcap ApogeeCombinedSpectrum
# Run on specific SDSS IDs
astra run aspcap ApogeeCombinedSpectrum 12345 67890
# Limit the number of spectra processed
astra run aspcap --limit 100
# Run with pagination
astra run aspcap --limit 100 --page 2
astra srun¶
Distribute an Astra pipeline task across multiple nodes using Slurm. This command generates Slurm job scripts and submits them with srun, displaying live progress for each node.
Usage:
astra srun TASK [MODEL] [SDSS_IDS...] [OPTIONS]
Arguments:
Argument |
Description |
|---|---|
|
The task name to run (e.g., |
|
The input model to use (e.g., |
|
Optional list of SDSS IDs to restrict processing to. |
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
int |
|
Number of Slurm nodes to use. |
|
int |
|
Number of |
|
int |
|
Limit the number of inputs. |
|
str |
|
Slurm account name. |
|
str |
same as |
Slurm partition. |
|
str |
|
Slurm Quality of Service. |
|
str |
|
Slurm generic resources (e.g., |
|
str |
|
Memory per node (e.g., |
|
str |
|
Wall-time limit. |
|
bool |
|
Use exclusive node allocation. |
Examples:
# Run ASPCAP across 4 nodes
astra srun aspcap --nodes 4
# Run with 2 processes per node on a specific model
astra srun aspcap ApogeeCombinedSpectrum --nodes 4 --procs 2
# Run with custom Slurm settings
astra srun aspcap --nodes 8 --account my-account --time 12:00:00 --mem 128G
# Request GPU resources
astra srun aspcap --nodes 2 --gres gpu:1
astra create¶
Create Astra summary data products (FITS files). Multiple products can be created in a single invocation.
Usage:
astra create PRODUCTS... [OPTIONS]
Arguments:
Argument |
Description |
|---|---|
|
One or more product names to create (see table below). |
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
|
Overwrite the product if it already exists. |
|
int |
|
Limit the number of rows per product. |
Available products:
Product |
Description |
|---|---|
|
MWM targets summary |
|
MWM all-star summary |
|
MWM all-visit summary |
|
MWM per-star products |
|
MWM per-visit products |
|
Both MWM visit and star products |
|
ASPCAP all-star summary |
|
APOGEENet all-star summary |
|
APOGEENet all-visit summary |
|
BOSSNet all-star summary |
|
BOSSNet all-visit summary |
|
LineForest all-star summary |
|
LineForest all-visit summary |
|
AstroNN all-star summary |
|
AstroNN all-visit summary |
|
AstroNN-dist all-star summary |
|
SLAM all-star summary |
|
MDwarfType all-star summary |
|
MDwarfType all-visit summary |
|
Corv all-visit summary |
|
SnowWhite all-star summary |
Examples:
# Create the MWM all-star product
astra create mwmAllStar
# Create multiple products
astra create mwmAllStar mwmAllVisit
# Overwrite existing products
astra create mwmAllStar --overwrite
# Create a product with a row limit (useful for testing)
astra create astraAllStarASPCAP --limit 1000
astra config¶
Manage Astra configuration settings. User configuration is stored in ~/.config/sdss/astra/astra.yml.
astra config show¶
Display all current configuration settings.
astra config show
astra config get¶
Get the value of a specific configuration key. Supports dot notation for nested keys.
astra config get KEY
Example:
astra config get database.host
astra config set¶
Set a configuration value in the user config file. Values are parsed as YAML, so booleans and numbers are handled automatically.
astra config set KEY VALUE
Example:
astra config set database.host localhost
astra config set database.port 5432
astra config path¶
Show the path to the user configuration file and whether it exists.
astra config path