Skip to content

Commit

Permalink
Update cone search notebook (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
camposandro authored Oct 31, 2024
1 parent db910af commit 7783fbf
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions docs/notebooks/cone_search.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"outputs": [],
"source": [
"import hats\n",
"import healpy as hp\n",
"import numpy as np\n",
"\n",
"## Fill in these variables with what's relevant in your use case:\n",
Expand Down Expand Up @@ -58,16 +57,20 @@
"metadata": {},
"outputs": [],
"source": [
"## Plot the cone using healpy for demonstration\n",
"import astropy.units as u\n",
"from astropy.coordinates import SkyCoord\n",
"from astropy.visualization.wcsaxes import SphericalCircle\n",
"\n",
"NSIDE = 256\n",
"NPIX = hp.nside2npix(NSIDE)\n",
"m = np.zeros(NPIX)\n",
"center_vec = hp.ang2vec(ra, dec, lonlat=True)\n",
"radius_radians = np.radians(radius_degrees)\n",
"cone_pixels = hp.query_disc(NSIDE, center_vec, radius_radians)\n",
"m[cone_pixels] = 1\n",
"hp.mollview(m, title=\"Cone to search\")"
"fig, ax = hats.inspection.plot_pixels(catalog)\n",
"cone_center = SkyCoord(ra=ra * u.deg, dec=dec * u.deg)\n",
"s = SphericalCircle(\n",
" cone_center,\n",
" radius_degrees * u.degree,\n",
" edgecolor=\"purple\",\n",
" facecolor=\"none\",\n",
" transform=ax.get_transform(\"icrs\"),\n",
")\n",
"ax.add_patch(s)"
]
},
{
Expand All @@ -86,8 +89,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "lsdb",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 7783fbf

Please sign in to comment.