{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Forecasting" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "\n", "import pysm3\n", "from fgbuster import get_instrument, get_sky, get_observation\n", "import healpy as hp\n", "import numpy as np\n", "from fgbuster import xForecast, CMB, Dust, Synchrotron\n", "\n", "nside = 64\n", "# define sky and foregrounds simulations\n", "sky = get_sky(nside, 'd0s0')\n", "# define instrument\n", "instrument = get_instrument('SO_SAT')\n", "# get noiseless frequency maps\n", "freq_maps = get_observation(instrument, sky)\n", "# take only the Q and U maps\n", "freq_maps = freq_maps[:,1:]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# create 3% circular sky mask\n", "RA = 2*np.pi-70.*np.pi/180\n", "DEC = np.pi/2+70.*np.pi/180\n", "radius = 34*np.pi/180\n", "mask_circular = np.zeros(12*nside**2)\n", "for ipix in range(12*nside**2):\n", " theta, phi = hp.pix2ang(nside, ipix)\n", " if (((phi - RA)**2 + (theta - DEC)**2 <= radius**2)):\n", " mask_circular[ipix] = 1.0\n", " if (((phi - RA+2*np.pi)**2 + (theta - DEC)**2 <= radius**2)):\n", " mask_circular[ipix] = 1.0\n", "# applying mask to observed frequency maps\n", "freq_maps[...,mask_circular==0] = 0.0" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# define components used in the modeling\n", "components = [CMB(), Dust(150.), Synchrotron(150.)]" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "# call for xForecast\n", "# with lmin=2, lmax=2*nside-1, and Alens=0.1\n", "# you can try with make_figure=True if you want to output angular power spectra and profile likelihood on r\n", "res = xForecast(components, instrument, freq_maps, 2, 2*nside-1, Alens=0.1, r=0.001, make_figure=True)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.7" } }, "nbformat": 4, "nbformat_minor": 4 }