{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "raw", "source": [ "---\n", "date: 2024-05-20\n", "toc: true\n", "format: \n", " html: default\n", " ipynb: default\n", "categories:\n", " - cosmology\n", " - healpy\n", "---" ], "metadata": { "id": "amJGRE8uxNHb" } }, { "cell_type": "markdown", "source": [ "# HEALPix in Megapixels\n", "\n", "How many megapixels is a HEALPix map?" ], "metadata": { "id": "ySEK3AO_usIL" } }, { "cell_type": "code", "execution_count": 1, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Oy9E_3j5ukaR", "outputId": "3c7f621d-dd7f-41b2-c1a9-f83f6ddffdc2" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Collecting healpy\n", " Downloading healpy-1.16.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (24.5 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m24.5/24.5 MB\u001b[0m \u001b[31m16.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from healpy) (3.7.1)\n", "Requirement already satisfied: numpy>=1.19 in /usr/local/lib/python3.10/dist-packages (from healpy) (1.25.2)\n", "Requirement already satisfied: astropy in /usr/local/lib/python3.10/dist-packages (from healpy) (5.3.4)\n", "Requirement already satisfied: scipy in /usr/local/lib/python3.10/dist-packages (from healpy) (1.11.4)\n", "Requirement already satisfied: pyerfa>=2.0 in /usr/local/lib/python3.10/dist-packages (from astropy->healpy) (2.0.1.4)\n", "Requirement already satisfied: PyYAML>=3.13 in /usr/local/lib/python3.10/dist-packages (from astropy->healpy) (6.0.1)\n", "Requirement already satisfied: packaging>=19.0 in /usr/local/lib/python3.10/dist-packages (from astropy->healpy) (24.0)\n", "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->healpy) (1.2.1)\n", "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->healpy) (0.12.1)\n", "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->healpy) (4.51.0)\n", "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->healpy) (1.4.5)\n", "Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->healpy) (9.4.0)\n", "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->healpy) (3.1.2)\n", "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->healpy) (2.8.2)\n", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->healpy) (1.16.0)\n", "Installing collected packages: healpy\n", "Successfully installed healpy-1.16.6\n" ] } ], "source": [ "!pip install healpy" ] }, { "cell_type": "code", "source": [ "import healpy as hp" ], "metadata": { "id": "ZQKIgPhpvUnz" }, "execution_count": 2, "outputs": [] }, { "cell_type": "code", "source": [ "megapixels = []\n", "for nside_power in range(8, 15):\n", " nside = 2**nside_power\n", " megapixels.append((nside, hp.nside2npix(nside)/1e6))" ], "metadata": { "id": "tCOTEQDUulw3" }, "execution_count": 10, "outputs": [] }, { "cell_type": "code", "source": [ "megapixels" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ALfTBVV_vWgE", "outputId": "8b97dac5-fd44-48da-8956-3d6c4f479c10" }, "execution_count": 11, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "[(256, 0.786432),\n", " (512, 3.145728),\n", " (1024, 12.582912),\n", " (2048, 50.331648),\n", " (4096, 201.326592),\n", " (8192, 805.306368),\n", " (16384, 3221.225472)]" ] }, "metadata": {}, "execution_count": 11 } ] } ] }