Skip to content

Instantly share code, notes, and snippets.

@davidwhogg
Created June 23, 2022 00:42
Show Gist options
  • Save davidwhogg/d16de5f03e30849ea97b36ab3b4a8895 to your computer and use it in GitHub Desktop.
Save davidwhogg/d16de5f03e30849ea97b36ab3b4a8895 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Play with metallicity in the nearby disk\n",
"## Authors\n",
"- **David W. Hogg** (NYU) (Flatiron)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import astropy.io.fits as fits\n",
"import numpy as np\n",
"import pylab as plt\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hdus = fits.open(\"highQ_kinematics.fits\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"data = hdus[1].data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hdus.close()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"data.__dict__"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"MG = data['phot_g_mean_mag'][:] + 5. * np.log10(data['parallax']) - 10.\n",
"BR = data['phot_bp_mean_mag'][:] - data['phot_rp_mean_mag'][:]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Check that the data are okay.\n",
"plt.figure(figsize=(7, 7))\n",
"plt.scatter(BR, MG,\n",
" c=data['astrophysical_parameters_mh_gspphot'][:],\n",
" s=1, alpha=0.5, vmin=-0.5, vmax=0.25)\n",
"plt.xlim(0.2, 2.5)\n",
"plt.ylim(8., -3.)\n",
"plt.xlabel(\"Gaia $B-R$ (mag)\")\n",
"plt.ylabel(\"Gaia $M_G$ (mag)\")\n",
"plt.colorbar()\n",
"plt.savefig(\"cmd.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment