{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Astrophysical source population modeling with Gammapy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Introduction\n", "\n", "The [gammapy.astro.population](http://docs.gammapy.org/0.7/astro/population/index.html) package contains some simple Galactic source population models.\n", "\n", "Here we provide some Python code to compute observable parameter distributions for Galactic gamma-ray source populations.\n", "\n", "* Observables: Flux, GLON, GLAT\n", "* Source classes: Pulsar (PSR), Supernova remnant (SNR), pulsar wind nebula (PWN)\n", "\n", "References:\n", "\n", "* Section 6.2 in the Fermi-LAT collaboration paper [\"The First Fermi-LAT Catalog of Sources Above 10 GeV\"](http://adsabs.harvard.edu/abs/2013arXiv1306.6772T)\n", "* Axel Donath's bachelor thesis [\"Modelling Galactic gamma-ray source populations\"](http://pubman.mpdl.mpg.de/pubman/item/escidoc:912132:1/component/escidoc:912131/BScThesis_ddonath.pdf), specifically Chapter 4.\n", "* Casanova & Dingus (2008), [\"Constraints on the TeV source population and its contribution to the galactic diffuse TeV emission\"](http://adsabs.harvard.edu/abs/2008APh....29...63C)\n", "* Strong (2007), [\"Source population synthesis and the Galactic diffuse gamma-ray emission\"](http://adsabs.harvard.edu/abs/2007Ap%26SS.309...35S)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import numpy as np\n", "import astropy.units as u\n", "from gammapy.utils.random import sample_powerlaw\n", "from gammapy.astro import population" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Simulate positions" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Spatial distribution using Lorimer (2006) model\n", "n_sources = int(1e5)\n", "\n", "table = population.make_base_catalog_galactic(\n", " n_sources=n_sources,\n", " rad_dis='L06',\n", " vel_dis='F06B',\n", " max_age=1e6 * u.yr,\n", " spiralarms=True,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Simulate luminosities" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Several source population models, e.g. the 1FHL paper or Strong (2007), use power-law luminosity functions.\n", "\n", "Here we implement the \"reference model\" from the 1FHL catalog paper section 6.2." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Source luminosity (ph s^-1)\n", "\n", "luminosity = sample_powerlaw(\n", " x_min=1e34,\n", " x_max=1e37,\n", " gamma=1.5,\n", " size=n_sources,\n", ")\n", "table['luminosity'] = luminosity" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Compute observable parameters" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "