Skip to content

Commit

Permalink
Ingest wise_1810-1010 (#427)
Browse files Browse the repository at this point in the history
* First ingest wise_1810-1010

* Changed tests

* Ingest of proper motions

* modeled parameters ingested

* Effective Temperature

* updated temp, 1256, asymmetric uncertainty

* json unit change

* reverted 1256 json file to upstream/main version

* Added t eff to json

* Added new tests to modeled parameters

---------

Co-authored-by: Kelle Cruz <[email protected]>
  • Loading branch information
LishaRamon and kelle authored Dec 13, 2023
1 parent 58f96e9 commit 9f0aff0
Show file tree
Hide file tree
Showing 5 changed files with 258 additions and 5 deletions.
12 changes: 12 additions & 0 deletions data/Publications.json
Original file line number Diff line number Diff line change
Expand Up @@ -6928,5 +6928,17 @@
"bibcode": "2020ApJ...903L..33V",
"doi": "10.3847/2041-8213/abc256",
"description": "Direct Radio Discovery of a Cold Brown Dwarf"
},
{
"reference": "Schn20",
"bibcode": "2020ApJ...898...77S",
"doi": "10.3847/1538-4357/ab9a40",
"description": "WISEA J041451.67-585456.7 and WISEA J181006.18-101000.5: The First Extreme T-type Subdwarfs?"
},
{
"reference": "Lodi22",
"bibcode": "2022A&A...663A..84L",
"doi": "10.1051/0004-6361/202243516",
"description": "Physical properties and trigonometric distance of the peculiar dwarf WISE J181005.5\u2212101002.3"
}
]
12 changes: 9 additions & 3 deletions data/Versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@
"description": "Companions table, fixed IRS spectra"
},
{
"version": "latest",
"version": "2023.4",
"start_date": "2023-10-18",
"end_date": "2023-12-12",
"description": "Added two sources"
},
{
"version": "latest",
"start_date": "2023-12-12",
"end_date": null,
"description": "Version in development"
"description": "Version in development"
}
]
]
85 changes: 85 additions & 0 deletions data/cwisep_j181006.00-101001.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"Sources": [
{
"source": "CWISEP J181006.00-101001.1",
"ra": 272.52574999999996,
"dec": -10.166805555555555,
"epoch": null,
"equinox": null,
"shortname": null,
"reference": "Schn20",
"other_references": null,
"comments": null
}
],
"ModeledParameters": [
{
"parameter": "T eff",
"value": 800.0,
"value_error": 100.0,
"unit": "K",
"comments": null,
"reference": "Lodi22"
},
{
"parameter": "log g",
"value": 5.0,
"value_error": 0.25,
"unit": "dex",
"comments": null,
"reference": "Lodi22"
},
{
"parameter": "mass",
"value": 17.0,
"value_error": null,
"unit": "M_jup",
"comments": "17[+56, -12]",
"reference": "Lodi22"
},
{
"parameter": "metallicity",
"value": -1.5,
"value_error": 0.5,
"unit": "dex",
"comments": null,
"reference": "Lodi22"
},
{
"parameter": "radius",
"value": 0.067,
"value_error": 0.032,
"unit": "R_sun",
"comments": null,
"reference": "Lodi22"
}
],
"Names": [
{
"other_name": "CWISEP J181006.00-101001.1"
},
{
"other_name": "Wise 1810-1010"
}
],
"Parallaxes": [
{
"parallax": 112.5,
"parallax_error": 8.1,
"adopted": true,
"comments": null,
"reference": "Lodi22"
}
],
"ProperMotions": [
{
"mu_ra": -1027.0,
"mu_ra_error": 3.5,
"mu_dec": -246.4,
"mu_dec_error": 3.6,
"adopted": true,
"comments": null,
"reference": "Schn20"
}
]
}
120 changes: 120 additions & 0 deletions scripts/ingests/ingest_wise_1810-1010.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# 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 # True: save the data files(json) 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 wise_1810-1010 and its reference
#doi- 10.3847/1538-4357/ab9a40 and 10.1051/0004-6361/202243516
#bibcode of coordinates reference- 2020ApJ...898...77S and 2022A&A...663A..84L
def add_publication(db):

ingest_publication(db, doi = "10.3847/1538-4357/ab9a40")

ingest_publication(db, doi = "10.1051/0004-6361/202243516")

def add_sources(db):

ra_1810= Angle("18 10 06.18", u.hour).degree
dec_1010=Angle("-10 10 00.5", u.degree).degree

ingest_sources(db, ["CWISEP J181006.00-101001.1"], references=["Schn20"],
ras= [ra_1810],
decs=[dec_1010],
search_db=False)


# Ingest other name for Wise 1810-1010 (one used in SIMBAD)
# code from deprecated utils does not work
ingest_names(db, 'CWISEP J181006.00-101001.1', 'Wise 1810-1010')

def add_parallaxes(db):
ingest_parallaxes(db,
sources = ["CWISEP J181006.00-101001.1"],
plxs = [112.5],
plx_errs = [8.1],
plx_refs = "Lodi22",
comments=None)

def add_proper_motions(db):
ingest_proper_motions(db, sources = ["CWISEP J181006.00-101001.1"],
pm_ras = [-1027],
pm_ra_errs = [3.5],
pm_decs = [-246.4],
pm_dec_errs = [3.6],
pm_references = "Schn20")


#Ingest Functions for Modeled Parameters (Gravity, Metallicity, Radius, Mass)
#Creating list of dictionaries for each value formatted for modeled parameters
def add_modeled_parameters_dict(db):
ingest_modeled_parameters = [{
'Gravity':
{'value': 5.0,
'value_error': 0.25,
'parameter': "log g",
'unit': 'dex',
'reference': "Lodi22"},

'Metallicity':
{'value': -1.5,
'value_error': 0.5,
'parameter': "metallicity",
'unit': 'dex',
'reference': "Lodi22"},

'Radius':
{'value': 0.067,
'value_error': 0.032, #Highest value error was picked between +0.032 & -0.020 listed
'parameter': "radius",
'unit': 'R_jup',
'reference': "Lodi22"},

'Mass':
{'value': 17,
'value_error': null, #Highest value error was picked between +56 & -12 listed
'parameter': "mass",
'unit': 'M_jup',
'comments': "17[+56, -12]",
'reference': "Lodi22"},

'Effective temperature':
{'value': 800,
'value_error': 100,
'parameter': "T eff",
'unit': 'K',
'reference': "Lodi22"}
}]

source = "CWISEP J181006.00-101001.1"
#value_types = ['Gravity', 'Metallicity', 'Radius', 'Mass', 'Effective temperature']
value_types = ['Effective temperature']
with db.engine.connect() as conn:
for row in ingest_modeled_parameters:

for value_type in value_types:
if row[value_type]['value'] is not None: # Checking that there's a value
conn.execute(db.ModeledParameters.insert().values({'source': source, 'reference': 'Lodi22', **row[value_type]}))

conn.commit()

#Call functions/ Comment out when not needed
#add_publication(db)
#add_sources(db)
#add_parallaxes(db)
#add_proper_motions(db)
add_modeled_parameters_dict(db)
db.inventory('CWISEP J181006.00-101001.1', pretty_print=True)

# WRITE THE JSON FILES
if SAVE_DB:
db.save_database(directory='data/')
34 changes: 32 additions & 2 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def test_proper_motion_refs(db):
def test_parallax_refs(db):
# Test total odopted measuruments
t = db.query(db.Parallaxes).filter(db.Parallaxes.c.adopted == 1).astropy()
assert len(t) == 1442, f'found {len(t)} adopted parallax measuruments.'
assert len(t) == 1443, f'found {len(t)} adopted parallax measuruments.'

ref = 'GaiaDR3'
t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy()
Expand Down Expand Up @@ -266,7 +266,7 @@ def test_missions(db):
stm = except_(select(db.Names.c.source).where(db.Names.c.other_name.like("WISE%")),
select(db.Photometry.c.source).where(db.Photometry.c.band.like("WISE%")))
s = db.session.scalars(stm).all()
assert len(s) == 479, f'found {len(s)} sources with WISE designation that have no WISE photometry'
assert len(s) == 480, f'found {len(s)} sources with WISE designation that have no WISE photometry'

# If Wise photometry, Wise designation should be in Names
stm = except_(select(db.Photometry.c.source).where(db.Photometry.c.band.like("WISE%")),
Expand Down Expand Up @@ -557,6 +557,36 @@ def test_modeledparameters(db):
t = db.query(db.ModeledParameters).filter(db.ModeledParameters.c.reference == ref).astropy()
assert len(t) == 696, f'found {len(t)} modeled parameters with {ref} reference'

#Test to verify log g counts
param = 'log g'
t = db.query(db.ModeledParameters).filter(db.ModeledParameters.c.parameter == param).astropy()
assert len(t) == 175, f'found {len(t)} modeled parameters with {param} parameter'

#Test to verify metallicity counts
param = 'metallicity'
t = db.query(db.ModeledParameters).filter(db.ModeledParameters.c.parameter == param).astropy()
assert len(t) == 1, f'found {len(t)} modeled parameters with {param} parameter'

#Test to verify radius counts
param = 'radius'
t = db.query(db.ModeledParameters).filter(db.ModeledParameters.c.parameter == param).astropy()
assert len(t) == 175, f'found {len(t)} modeled parameters with {param} parameter'

#Test to verify mass counts
param = 'mass'
t = db.query(db.ModeledParameters).filter(db.ModeledParameters.c.parameter == param).astropy()
assert len(t) == 175, f'found {len(t)} modeled parameters with {param} parameter'

#Test to verify T eff counts
param = 'T eff'
t = db.query(db.ModeledParameters).filter(db.ModeledParameters.c.parameter == param).astropy()
assert len(t) == 175, f'found {len(t)} modeled parameters with {param} parameter'

#Test to verify Lodi22 reference counts
ref = 'Lodi22'
t = db.query(db.ModeledParameters).filter(db.ModeledParameters.c.reference == ref).astropy()
assert len(t) == 5, f'found {len(t)} modeled parameters with {ref} reference'


def test_photometrymko_y(db):
# Test for Y photometry entries added for references
Expand Down

0 comments on commit 9f0aff0

Please sign in to comment.