1
0
Fork 0

Add gaia query

pull/1/head
Tammo Jan Dijkema 2019-03-04 22:48:07 +01:00
parent e0531d9d8c
commit 224ffe1a92
1 changed files with 387 additions and 25 deletions

View File

@ -7,26 +7,6 @@
"# Notebook basics"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"3"
]
},
{
"cell_type": "markdown",
"metadata": {},
@ -507,6 +487,13 @@
"ax2.plot(np.cosh(np.linspace(0,5,100)));"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As recommended by the authors, if you repeat plots it can be useful to make a function that does the plotting for you, given some input parameter that you want to change."
]
},
{
"cell_type": "markdown",
"metadata": {},
@ -1228,7 +1215,7 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 238,
"metadata": {},
"outputs": [
{
@ -1237,7 +1224,7 @@
"58555.479166666664"
]
},
"execution_count": 55,
"execution_count": 238,
"metadata": {},
"output_type": "execute_result"
}
@ -1246,6 +1233,84 @@
"t.mjd"
]
},
{
"cell_type": "code",
"execution_count": 239,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1552476600.0000002"
]
},
"execution_count": 239,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t.unix"
]
},
{
"cell_type": "code",
"execution_count": 240,
"metadata": {},
"outputs": [],
"source": [
"t = Time.now()"
]
},
{
"cell_type": "code",
"execution_count": 241,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1551733900.643913"
]
},
"execution_count": 241,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t.unix"
]
},
{
"cell_type": "code",
"execution_count": 242,
"metadata": {},
"outputs": [],
"source": [
"t = Time(1551733900, format='unix')"
]
},
{
"cell_type": "code",
"execution_count": 243,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'2019-03-04T21:11:40.000'"
]
},
"execution_count": 243,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t.isot"
]
},
{
"cell_type": "markdown",
"metadata": {},
@ -2262,7 +2327,7 @@
},
{
"cell_type": "code",
"execution_count": 392,
"execution_count": 231,
"metadata": {},
"outputs": [],
"source": [
@ -2271,13 +2336,13 @@
},
{
"cell_type": "code",
"execution_count": 393,
"execution_count": 232,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d8b7db8073f04a3cbefa1bf0cad026c7",
"model_id": "ed2e85050c7b40e4841ada755c953da6",
"version_major": 2,
"version_minor": 0
},
@ -2363,6 +2428,303 @@
"Note: Barnard's star simbad astroquery example at https://astroquery.readthedocs.io/en/latest/simbad/simbad.html"
]
},
{
"cell_type": "code",
"execution_count": 246,
"metadata": {},
"outputs": [],
"source": [
"star=SkyCoord.from_name(\"Barnard's star\")"
]
},
{
"cell_type": "code",
"execution_count": 245,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Created TAP+ (v1.0.1) - Connection:\n",
"\tHost: gea.esac.esa.int\n",
"\tUse HTTPS: False\n",
"\tPort: 80\n",
"\tSSL Port: 443\n"
]
}
],
"source": [
"from astroquery.gaia import Gaia"
]
},
{
"cell_type": "code",
"execution_count": 250,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: W35: None:5:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n",
"WARNING: W35: None:6:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n",
"WARNING: W35: None:7:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n",
"WARNING: W35: None:8:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n",
"WARNING: W35: None:10:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n",
"WARNING: W27: None:11:0: W27: COOSYS deprecated in VOTable 1.2 [astropy.io.votable.tree]\n",
"WARNING: W06: None:48:0: W06: Invalid UCD 'arith.ratio': Secondary word 'arith.ratio' is not valid as a primary word [astropy.io.votable.tree]\n",
"WARNING: W50: None:51:0: W50: Invalid unit string 'mas.yr**-1' [astropy.io.votable.tree]\n",
"WARNING: W50: None:54:0: W50: Invalid unit string 'mas.yr**-1' [astropy.io.votable.tree]\n",
"WARNING: W50: None:57:0: W50: Invalid unit string 'mas.yr**-1' [astropy.io.votable.tree]\n",
"WARNING: W50: None:60:0: W50: Invalid unit string 'mas.yr**-1' [astropy.io.votable.tree]\n",
"WARNING: W50: None:123:0: W50: Invalid unit string 'mas**-2' [astropy.io.votable.tree]\n",
"WARNING: W50: None:126:0: W50: Invalid unit string 'um**-1' [astropy.io.votable.tree]\n",
"WARNING: W06: None:129:0: W06: Invalid UCD 'em.wavenumber;stat.error': Primary word 'stat.error' is not valid as a secondary word [astropy.io.votable.tree]\n",
"WARNING: W50: None:129:0: W50: Invalid unit string 'um**-1' [astropy.io.votable.tree]\n",
"WARNING: W06: None:141:0: W06: Invalid UCD 'pos.errorEllipse;stat.max': Secondary word 'pos.errorEllipse' is not valid as a primary word [astropy.io.votable.tree]\n",
"WARNING: W50: None:156:0: W50: Invalid unit string ''electron'.s**-1' [astropy.io.votable.tree]\n",
"WARNING: W50: None:159:0: W50: Invalid unit string ''electron'.s**-1' [astropy.io.votable.tree]\n",
"WARNING: W06: None:162:0: W06: Invalid UCD 'arith.ratio': Secondary word 'arith.ratio' is not valid as a primary word [astropy.io.votable.tree]\n",
"WARNING: W50: None:171:0: W50: Invalid unit string ''electron'.s**-1' (suppressing further warnings of this type...) [astropy.io.votable.tree]\n",
"WARNING: W06: None:177:0: W06: Invalid UCD 'arith.ratio': Secondary word 'arith.ratio' is not valid as a primary word [astropy.io.votable.tree]\n",
"WARNING: W06: None:192:0: W06: Invalid UCD 'arith.ratio': Secondary word 'arith.ratio' is not valid as a primary word [astropy.io.votable.tree]\n",
"WARNING: W06: None:204:0: W06: Invalid UCD 'phot.color': Unknown word 'phot.color' [astropy.io.votable.tree]\n",
"WARNING: W06: None:207:0: W06: Invalid UCD 'phot.color': Unknown word 'phot.color' [astropy.io.votable.tree]\n",
"WARNING: W06: None:210:0: W06: Invalid UCD 'phot.color': Unknown word 'phot.color' [astropy.io.votable.tree]\n",
"WARNING: W06: None:282:0: W06: Invalid UCD 'phys.size.radius;stat.error': Primary word 'stat.error' is not valid as a secondary word (suppressing further warnings of this type...) [astropy.io.votable.tree]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Query finished.\n"
]
}
],
"source": [
"res = Gaia.query_object_async(coordinate=star, width=0.1*u.deg, height=0.1*u.deg)"
]
},
{
"cell_type": "code",
"execution_count": 260,
"metadata": {},
"outputs": [],
"source": [
"res.sort(\"pmra\")"
]
},
{
"cell_type": "code",
"execution_count": 263,
"metadata": {},
"outputs": [],
"source": [
"stardata = res[0]"
]
},
{
"cell_type": "code",
"execution_count": 315,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dist 0.04474516448573007 None\n",
"solution_id 1635721458409799680 None\n",
"designation b'Gaia DR2 4472832130942575872' None\n",
"source_id 4472832130942575872 None\n",
"random_index 533956466 None\n",
"ref_epoch 2015.5 yr\n",
"ra 269.4486143580427 deg\n",
"ra_error 0.2228992191335898 mas\n",
"dec 4.737980765585507 deg\n",
"dec_error 0.3041988228146539 mas\n",
"parallax 547.4506196448664 mas\n",
"parallax_error 0.2899012145732713 mas\n",
"parallax_over_error 1888.404 None\n",
"pmra -802.802647878488 mas.yr**-1\n",
"pmra_error 0.6378680351986493 mas.yr**-1\n",
"pmdec 10362.542163273869 mas.yr**-1\n",
"pmdec_error 0.3596168573247809 mas.yr**-1\n",
"ra_dec_corr -0.75674546 None\n",
"ra_parallax_corr 0.7358516 None\n",
"ra_pmra_corr -0.9222494 None\n",
"ra_pmdec_corr 0.7776804 None\n",
"dec_parallax_corr -0.941183 None\n",
"dec_pmra_corr 0.88051504 None\n",
"dec_pmdec_corr -0.92702585 None\n",
"parallax_pmra_corr -0.8647782 None\n",
"parallax_pmdec_corr 0.8366835 None\n",
"pmra_pmdec_corr -0.8657498 None\n",
"astrometric_n_obs_al 80 None\n",
"astrometric_n_obs_ac 80 None\n",
"astrometric_n_good_obs_al 78 None\n",
"astrometric_n_bad_obs_al 2 None\n",
"astrometric_gof_al 11.204291 None\n",
"astrometric_chi2_al 307.5757 None\n",
"astrometric_excess_noise 0.13814884838845484 mas\n",
"astrometric_excess_noise_sig 4.04820577977616 None\n",
"astrometric_params_solved 31 None\n",
"astrometric_primary_flag True None\n",
"astrometric_weight_al 27.652666 mas**-2\n",
"astrometric_pseudo_colour 1.2482400209573905 um**-1\n",
"astrometric_pseudo_colour_error 0.031582565659274885 um**-1\n",
"mean_varpi_factor_al -0.082077704 None\n",
"astrometric_matched_observations 9 None\n",
"visibility_periods_used 6 None\n",
"astrometric_sigma5d_max 0.4152302 mas\n",
"frame_rotator_object_type 0 None\n",
"matched_observations 10 None\n",
"duplicated_source False None\n",
"phot_g_n_obs 80 None\n",
"phot_g_mean_flux 9938112.844575606 'electron'.s**-1\n",
"phot_g_mean_flux_error 18292.003707963897 'electron'.s**-1\n",
"phot_g_mean_flux_over_error 543.30365 None\n",
"phot_g_mean_mag 8.195106 mag\n",
"phot_bp_n_obs 8 None\n",
"phot_bp_mean_flux 1645887.1906748712 'electron'.s**-1\n",
"phot_bp_mean_flux_error 4685.221151147555 'electron'.s**-1\n",
"phot_bp_mean_flux_over_error 351.2934 None\n",
"phot_bp_mean_mag 9.810388 mag\n",
"phot_rp_n_obs 9 None\n",
"phot_rp_mean_flux 13086427.844073331 'electron'.s**-1\n",
"phot_rp_mean_flux_error 22496.555096104148 'electron'.s**-1\n",
"phot_rp_mean_flux_over_error 581.70807 None\n",
"phot_rp_mean_mag 6.969867 mag\n",
"phot_bp_rp_excess_factor 1.4824057 None\n",
"phot_proc_mode 1 None\n",
"bp_rp 2.8405204 mag\n",
"bp_g 1.615282 mag\n",
"g_rp 1.2252383 mag\n",
"radial_velocity -- km.s**-1\n",
"radial_velocity_error -- km.s**-1\n",
"rv_nb_transits 0 None\n",
"rv_template_teff -- K\n",
"rv_template_logg -- log(cm.s**-2)\n",
"rv_template_fe_h -- 'dex'\n",
"phot_variable_flag b'NOT_AVAILABLE' None\n",
"l 31.048145299980042 deg\n",
"b 14.085855172346392 deg\n",
"ecl_lon 269.37664432873515 deg\n",
"ecl_lat 28.176068535639537 deg\n",
"priam_flags 100002 None\n",
"teff_val 3699.35 K\n",
"teff_percentile_lower 3316.327 K\n",
"teff_percentile_upper 4086.9048 K\n",
"a_g_val 0.301 mag\n",
"a_g_percentile_lower 0.0354 mag\n",
"a_g_percentile_upper 0.515 mag\n",
"e_bp_min_rp_val 0.183 mag\n",
"e_bp_min_rp_percentile_lower 0.0349 mag\n",
"e_bp_min_rp_percentile_upper 0.2841 mag\n",
"flame_flags -- None\n",
"radius_val -- Rsun\n",
"radius_percentile_lower -- Rsun\n",
"radius_percentile_upper -- Rsun\n",
"lum_val -- Lsun\n",
"lum_percentile_lower -- Lsun\n",
"lum_percentile_upper -- Lsun\n",
"datalink_url b'http://geadata.esac.esa.int/data-server/datalink/links?ID=4472832130942575872' None\n",
"epoch_photometry_url -- None\n"
]
}
],
"source": [
"for colname in stardata.colnames:\n",
" #if not stardata.columns[colname].unit:\n",
" print(colname, stardata[colname], stardata.columns[colname].unit)"
]
},
{
"cell_type": "code",
"execution_count": 345,
"metadata": {},
"outputs": [],
"source": [
"gaiastar = SkyCoord(stardata['ra']*stardata.columns['ra'].unit,\n",
" stardata['dec']*stardata.columns['ra'].unit,\n",
" stardata['parallax']*stardata.columns['ra'].unit,\n",
" pm_dec=stardata['pmdec']*u.Unit(str(stardata.columns['pmdec'].unit)),\n",
" pm_ra_cosdec=stardata['pmra']*u.Unit(str(stardata.columns['pmra'].unit)),\n",
" obstime=Time(\"2015-01-01T00:00\"),\n",
" radial_velocity=-110.6*u.km/u.s # Not in GAIA, found on wikipedia\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 346,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, pc)\n",
" (269.44861536, 4.73796786, 0.00294181)\n",
" (pm_ra, pm_dec, radial_velocity) in (mas / yr, mas / yr, km / s)\n",
" (-2.39647138e-05, 0.00030828, -110.6)>"
]
},
"execution_count": 346,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gaiastar.apply_space_motion(Time(\"1989-01-01T00:00\"))"
]
},
{
"cell_type": "code",
"execution_count": 347,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, deg)\n",
" (269.44861436, 4.73798077, 547.45061964)\n",
" (pm_ra_cosdec, pm_dec, radial_velocity) in (mas / yr, mas / yr, km / s)\n",
" (-802.80264788, 10362.54216327, -110.6)>"
]
},
"execution_count": 347,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gaiastar"
]
},
{
"cell_type": "code",
"execution_count": 348,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, pc)\n",
" (269.44861436, 4.73798077, 5.07402436e-07)\n",
" (pm_ra, pm_dec, radial_velocity) in (mas / yr, mas / yr, km / s)\n",
" (-805.55535001, 10362.54216311, -110.6)>"
]
},
"execution_count": 348,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gaiastar.apply_space_motion(Time(\"2015-01-01T00:00\"))"
]
},
{
"cell_type": "code",
"execution_count": null,