Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First ingest wise_1810-1010 #427

Merged
merged 27 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8b81c66
First ingest wise_1810-1010
LishaRamon Dec 5, 2023
de5a8da
Changed tests
LishaRamon Dec 5, 2023
d126a81
Ingest of proper motions
LishaRamon Dec 6, 2023
fbaf3e3
Attempted ingest modeled parameters dictionary
LishaRamon Dec 7, 2023
4989015
ingest_publications not defined error
LishaRamon Dec 8, 2023
2f2c2be
Similar publication may exist
LishaRamon Dec 8, 2023
7da8101
Publications errors
LishaRamon Dec 8, 2023
4bae095
Attempting new push
LishaRamon Dec 8, 2023
e6af010
push attempt
LishaRamon Dec 8, 2023
0dbe028
push attempt
LishaRamon Dec 8, 2023
044d6fa
updated publications wise1810-1010
LishaRamon Dec 11, 2023
fbfef2f
update
LishaRamon Dec 11, 2023
9aa8527
modeled parameters ingested
LishaRamon Dec 11, 2023
8fb9304
modeled parameters ingested
LishaRamon Dec 11, 2023
776c6ad
Effective Temperature
LishaRamon Dec 11, 2023
c1cc6e3
updated temp, 1256, asymmetric uncertainty
LishaRamon Dec 11, 2023
50ae7f4
json unit change
LishaRamon Dec 11, 2023
25d4433
Update data/2mass_j12560183-1257276.json
kelle Dec 12, 2023
b6e5a08
Jsons updated / t eff edit needed
LishaRamon Dec 12, 2023
6220cd2
jsons updated/ t eff needs ingest
LishaRamon Dec 12, 2023
84f53f4
jsons updated/t eff needs ingest
LishaRamon Dec 12, 2023
8ea002e
jsons updated/ t eff need ingest
LishaRamon Dec 12, 2023
97c2632
Before t eff ingest pytest
LishaRamon Dec 12, 2023
41f562b
reverted 1256 json file to upstream/main version
kelle Dec 12, 2023
fb89728
Added t eff to json
LishaRamon Dec 13, 2023
2c97605
Added new tests to modeled parameters
LishaRamon Dec 13, 2023
df4ad0e
Merge branch 'main' into Ingest-Wise-1810
kelle Dec 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions data/2mass_j12560183-1257276.json
kelle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
{
"other_name": "VHS 1256-1257b"
},
{
"other_name": "VHS 1256b"
},
{
"other_name": "VHS J125601.92-125723.9 b"
},
Expand All @@ -38,9 +41,6 @@
},
{
"other_name": "WISEA J125601.66-125728.7"
},
{
"other_name": "VHS 1256b"
}
],
"Parallaxes": [
Expand Down Expand Up @@ -267,4 +267,4 @@
"reference": "Gauz15"
}
]
}
}
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"
}
]
2 changes: 1 addition & 1 deletion data/Versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@
"end_date": null,
"description": "Version in development"
}
]
]
43 changes: 43 additions & 0 deletions data/cwisep_j181006.00-101001.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"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
}
],
"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"
}
]
}
101 changes: 101 additions & 0 deletions scripts/ingests/ingest_wise_1810-1010.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# 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 = True # 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 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
ingest_publication(db, doi = "10.3847/1538-4357/ab9a40")

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

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')

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

# PROPER MOTIONS
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 in table 6 formatted for modeled parameters

#Lines 54 to 73 can be rewritten by hand

ingest_modeled_parameters_dict = [{
'Gravity':
{'value': [5.0],
LishaRamon marked this conversation as resolved.
Show resolved Hide resolved
'value_error': [0.25],
'parameter': "Radius", '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': [56], #Highest value error was picked between +56 & -12 listed
'parameter': "mass", 'unit': 'M_jup',
'reference': "Lodi22"}
}]




#Lines 98 - 106 needed after created own dict parameters
source = "CWISEP J181006.00-101001.1"
value_types = ['Gravity', 'Metallicity', 'Radius', 'Mass']
with db.engine.connect() as conn:
for row in ingest_modeled_parameters_dict:
row_dict = []
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': row['source'], 'reference': 'Lodi22', **row[value_type]}))
LishaRamon marked this conversation as resolved.
Show resolved Hide resolved

conn.commit()

#KeyError with 'source'
LishaRamon marked this conversation as resolved.
Show resolved Hide resolved


# WRITE THE JSON FILES
if SAVE_DB:
db.save_database(directory='data/')
4 changes: 2 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