Source¶
Module: astra.models.source
The Source model represents a single astronomical object. Every spectrum and pipeline result in Astra is linked back to a Source. Each source has a unique primary key (pk) and carries identifiers, astrometry, photometry, targeting information, and reddening estimates.
Key Fields¶
Identifiers¶
Field |
Type |
Description |
|---|---|---|
|
AutoField |
Primary key |
|
BigIntegerField |
Unique SDSS-V identifier |
|
TextField |
APOGEE identifier from SDSS-IV (e.g., |
|
BigIntegerField |
Gaia DR2 source identifier |
|
BigIntegerField |
Gaia DR3 source identifier |
|
BigIntegerField |
TESS Input Catalog (v8) identifier |
|
IntegerField |
HEALPix index for spatial indexing |
|
BigIntegerField |
SDSS-V catalog identifier |
|
BigIntegerField |
SDSS-V catalog identifier (v21 cross-match) |
|
BigIntegerField |
SDSS-V catalog identifier (v25 cross-match) |
|
BigIntegerField |
SDSS-V catalog identifier (v31 cross-match) |
Astrometry¶
Field |
Type |
Description |
|---|---|---|
|
FloatField |
Right ascension (degrees, J2000) |
|
FloatField |
Declination (degrees, J2000) |
|
FloatField |
Galactic longitude (degrees) |
|
FloatField |
Galactic latitude (degrees) |
|
FloatField |
Parallax (mas), from Gaia |
|
FloatField |
Parallax uncertainty (mas) |
|
FloatField |
Proper motion in RA (mas/yr) |
|
FloatField |
Proper motion in RA uncertainty (mas/yr) |
|
FloatField |
Proper motion in Dec (mas/yr) |
|
FloatField |
Proper motion in Dec uncertainty (mas/yr) |
|
FloatField |
Radial velocity from Gaia (km/s) |
|
FloatField |
Gaia radial velocity uncertainty (km/s) |
Photometry¶
The Source model stores photometry from several surveys:
Field |
Type |
Description |
|---|---|---|
|
FloatField |
Gaia G, BP, RP magnitudes |
|
FloatField |
2MASS J, H, K magnitudes |
|
FloatField |
2MASS magnitude uncertainties |
|
FloatField |
unWISE W1, W2 magnitudes |
|
FloatField |
unWISE magnitude uncertainties |
|
FloatField |
unWISE raw fluxes |
|
FloatField |
GLIMPSE (Spitzer 4.5 micron) magnitude |
Synthetic photometry from Gaia XP spectra:
Field |
Type |
Description |
|---|---|---|
|
FloatField |
Johnson-Kron-Cousins magnitudes |
|
FloatField |
SDSS magnitudes |
|
FloatField |
Pan-STARRS y-band magnitude |
Reddening¶
Field |
Type |
Description |
|---|---|---|
|
FloatField |
Adopted E(B-V) reddening |
|
FloatField |
Uncertainty on adopted E(B-V) |
|
BitField |
Provenance of adopted E(B-V) |
|
FloatField |
E(B-V) from Zhang (2023) |
|
FloatField |
E(B-V) from SFD |
|
FloatField |
E(B-V) from Bayestar (2019) |
|
FloatField |
E(B-V) from Edenhofer (2023) |
|
FloatField |
E(B-V) from RJCE (GLIMPSE) |
|
FloatField |
E(B-V) from RJCE (AllWISE) |
The ebv_flags bit field indicates the provenance of the adopted E(B-V): Zhang (2023), Edenhofer (2023), SFD, RJCE (GLIMPSE or AllWISE), or Bayestar (2019).
External Stellar Parameter Estimates¶
Field |
Type |
Description |
|---|---|---|
|
FloatField |
Effective temperature from Zhang, Green & Rix (2023) |
|
FloatField |
Surface gravity from ZGR (2023) |
|
FloatField |
Metallicity from ZGR (2023) |
|
FloatField |
Geometric distance from Bailer-Jones (EDR3, 2021) |
|
FloatField |
Photogeometric distance from Bailer-Jones (EDR3, 2021) |
Observations Summary¶
Field |
Type |
Description |
|---|---|---|
|
IntegerField |
Number of BOSS visits |
|
IntegerField |
Number of APOGEE visits |
|
IntegerField |
MJD range of BOSS observations |
|
IntegerField |
MJD range of APOGEE observations |
Targeting Flags¶
The Source model carries extensive targeting flags from both SDSS-IV (sdss4_apogee_target1_flags, sdss4_apogee2_target1_flags, etc.) and SDSS-V (sdss5_target_flags). These can be queried with the helper methods described below.
Methods and Properties¶
assigned_to_program(program)¶
Check whether this source is assigned to any carton in the given program. Can be used in queries.
# Find all sources in the "mwm_yso" program
sources = Source.select().where(Source.assigned_to_program("mwm_yso"))
assigned_to_carton_label(label)¶
Check whether this source is assigned to the given carton by label.
sources = Source.select().where(Source.assigned_to_carton_label("mwm_yso_disk_apogee"))
assigned_to_mapper(mapper)¶
Check whether this source is assigned to any carton in the given mapper.
sources = Source.select().where(Source.assigned_to_mapper("MWM"))
assigned_to_carton_pk(pk)¶
Check whether this source is assigned to the carton with the given primary key.
assigned_to_carton_with_name(name)¶
Check whether this source is assigned to any carton with the given name.
assigned_to_carton_with_alt_program(alt_program)¶
Check whether this source is assigned to any carton with the given alternate program.
assigned_to_carton_with_alt_name(alt_name)¶
Check whether this source is assigned to any carton with the given alternate name.
sdss5_cartons (property)¶
Returns the cartons that this source is assigned to, based on the sdss5_target_flags bit field.
sdss5_target_bits (property)¶
Returns a tuple of bit positions of targeting flags that are set for this source.
is_sdss5_target_bit_set(bit)¶
Check whether a specific carton bit position is set.
is_any_sdss5_target_bit_set(*bits)¶
Check whether any of the given carton bit positions are set.
spectra (property)¶
A generator that yields all spectra (across all spectrum types) associated with this source.
source = Source.get(Source.sdss_id == 12345)
for spectrum in source.spectra:
print(type(spectrum), spectrum.snr)