Skip to content

Commit

Permalink
Merge branch 'main' into new-data-template
Browse files Browse the repository at this point in the history
  • Loading branch information
Will-Cooper authored Dec 13, 2023
2 parents df7e5f8 + 578ba1e commit 4a3c972
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 4 deletions.
6 changes: 6 additions & 0 deletions data/Publications.json
Original file line number Diff line number Diff line change
Expand Up @@ -6922,5 +6922,11 @@
"bibcode": "",
"doi": "",
"description": "Rothermich in prep."
},
{
"reference": "Veda20",
"bibcode": "2020ApJ...903L..33V",
"doi": "10.3847/2041-8213/abc256",
"description": "Direct Radio Discovery of a Cold Brown Dwarf"
}
]
45 changes: 45 additions & 0 deletions data/[vcs2020]_bdr_j1750+3809.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"Sources": [
{
"source": "[VCS2020] BDR J1750+3809",
"ra": 267.5047083333333,
"dec": 38.15541666666667,
"epoch": null,
"equinox": null,
"shortname": null,
"reference": "Veda20",
"other_references": null,
"comments": null
}
],
"Names": [
{
"other_name": "BDR J1750+3809"
},
{
"other_name": "[VCS2020] BDR J1750+3809"
}
],
"ProperMotions": [
{
"mu_ra": -120.0,
"mu_ra_error": 30.0,
"mu_dec": 200.0,
"mu_dec_error": 30.0,
"adopted": true,
"comments": null,
"reference": "Veda20"
}
],
"SpectralTypes": [
{
"spectral_type_string": "T6.5",
"spectral_type_code": 86.5,
"spectral_type_error": 1.0,
"regime": "nir",
"adopted": null,
"comments": null,
"reference": "Veda20"
}
]
}
57 changes: 57 additions & 0 deletions scripts/ingests/ingest_BDR_J1750+3809.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#script ingest first data into companion tables

from scripts.ingests.ingest_utils import *
from scripts.ingests.utils import *
from astropy.table import Table
import astropy.units as u
from astropy.coordinates import Angle

SAVE_DB = False # save the data files in addition to modifying the .db file
RECREATE_DB = True # recreates the .db file from the data files

# LOAD THE DATABASE
db = load_simpledb('SIMPLE.db', recreatedb=RECREATE_DB)


# Ingest 2MASS J01415823-4633574 and its reference
#doi- 10.3847/2041-8213/abc256
#bibcode of coordinates reference- 2020ApJ...903L..33V
ingest_publication(db, doi = '10.3847/2041-8213/abc256',
description = "Direct radio discovery of a cold brown dwarf.",
ignore_ads = False)


ra_1750= Angle("17 50 01.13", u.hour).degree
dec_3809=Angle("+38 09 19.5", u.degree).degree

ingest_sources(db, ["[VCS2020] BDR J1750+3809"], references="Veda20",
ras= [ra_1750],
decs=[dec_3809],
search_db=False)

# Ingest other name for BDR J1750+3809 (one used in SIMBAD)
# code from deprecated utils does not work
ingest_names(db, '[VCS2020] BDR J1750+3809', 'BDR J1750+3809')


# SPECTRAL TYPES
# The spectral type of T6.5 is based on data in the nir regime
ingest_spectral_types(db, sources = ["[VCS2020] BDR J1750+3809"],
spectral_types = "T6.5",
references = "Veda20",
regimes = "nir",
spectral_type_error="1",
comments=None)

# PROPER MOTIONS
ingest_proper_motions(db, sources = ["[VCS2020] BDR J1750+3809"],
pm_ras = [-120],
pm_ra_errs = [30],
pm_decs = [200],
pm_dec_errs = [30],
pm_references = "Veda20")

# WRITE THE JSON FILES
if SAVE_DB:
db.save_database(directory='data/')

8 changes: 4 additions & 4 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def test_spectral_types(db):

regime = 'nir'
t = db.query(db.SpectralTypes).filter(db.SpectralTypes.c.regime == regime).astropy()
assert len(t) == 380, f'found {len(t)} spectral types in the {regime} regime'
assert len(t) == 381, f'found {len(t)} spectral types in the {regime} regime'

regime = 'nir_UCD'
t = db.query(db.SpectralTypes).filter(db.SpectralTypes.c.regime == regime).astropy()
Expand All @@ -386,16 +386,16 @@ def test_spectral_types(db):
l_dwarfs = db.query(db.SpectralTypes).filter(
and_(db.SpectralTypes.c.spectral_type_code >= 70,
db.SpectralTypes.c.spectral_type_code < 80)).astropy()
assert len(l_dwarfs) == 1963, f'found {len(t)} L spectral types'
assert len(l_dwarfs) == 1963, f'found {len(l_dwarfs)} L spectral types'

t_dwarfs = db.query(db.SpectralTypes).filter(
and_(db.SpectralTypes.c.spectral_type_code >= 80,
db.SpectralTypes.c.spectral_type_code < 90)).astropy()
assert len(t_dwarfs) == 998, f'found {len(t)} T spectral types'
assert len(t_dwarfs) == 999, f'found {len(t_dwarfs)} T spectral types'

y_dwarfs = db.query(db.SpectralTypes).filter(
and_(db.SpectralTypes.c.spectral_type_code >= 90)).astropy()
assert len(y_dwarfs) == 79, f'found {len(t)} Y spectral types'
assert len(y_dwarfs) == 79, f'found {len(y_dwarfs)} Y spectral types'

n_spectral_types = db.query(db.SpectralTypes).count()
assert len(m_dwarfs) + len(l_dwarfs) + len(t_dwarfs) + len(y_dwarfs) == n_spectral_types
Expand Down

0 comments on commit 4a3c972

Please sign in to comment.