{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Working with XSPEC models\n", "\n", "One of the most powerful aspects of **XSPEC** is a huge modeling community. While in 3ML, we are focused on building a powerful and modular data analysis tool, we cannot neglect the need for many of the models thahat already exist in **XSPEC** and thus provide support for them via **astromodels** directly in 3ML. \n", "\n", "For details on installing **astromodels** with **XSPEC** support, visit the 3ML or **astromodels** installation page. \n", "\n", "\n", "Let's explore how we can use **XSPEC** spectral models in 3ML. " ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2018-01-04T13:10:51.894290Z", "start_time": "2018-01-04T13:10:51.883115Z" } }, "outputs": [], "source": [ "%matplotlib notebook\n", "import matplotlib.pyplot as plt\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We do not load the models by default as this takes some time and 3ML should load quickly. However, if you need the **XSPEC** models, they are imported from astromodels like this:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2018-01-04T13:06:22.923013Z", "start_time": "2018-01-04T13:06:16.023150Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Loading xspec models...done\n" ] } ], "source": [ "from astromodels.xspec.factory import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The models are indexed with *XS_* before the typical **XSPEC** model names." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2018-01-04T13:07:08.921540Z", "start_time": "2018-01-04T13:07:08.891013Z" } }, "outputs": [ { "data": { "text/html": [ "