{
“cells”: [
{

“cell_type”: “markdown”, “id”: “51e9a0e5”, “metadata”: {}, “source”: [

“# Point sources #n”, “n”, “In astromodels, a point source is described by its position in the skyn”, “and its spectral features.n”, “n”, “n”, “## Creating a point sourcen”, “n”, “A simple source with a power law spectrum can be created like this, using J2000 R.A. and Dec (ICRS), which is the default coordinate system:”

]

}, {

“cell_type”: “code”, “execution_count”: 1, “id”: “255e44f9”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:10.219061Z”, “iopub.status.busy”: “2021-08-17T08:10:10.217924Z”, “iopub.status.idle”: “2021-08-17T08:10:12.715861Z”, “shell.execute_reply”: “2021-08-17T08:10:12.718073Z”

}

}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“[u001b[35mWARNING u001b[0m]u001b[35m The naima package is not available. Models that depend on it will not be availableu001b[0mn”

]

}, {

“name”: “stdout”, “output_type”: “stream”, “text”: [

“[u001b[35mWARNING u001b[0m]u001b[35m The GSL library or the pygsl wrapper cannot be loaded. Models that depend on it will not be available.u001b[0mn”

]

}, {

“name”: “stdout”, “output_type”: “stream”, “text”: [

“[u001b[35mWARNING u001b[0m]u001b[35m The ebltable package is not available. Models that depend on it will not be availableu001b[0mn”

]

}

], “source”: [

“from astromodels import *n”, “simple_source_icrs = PointSource(‘simple_source’, ra=123.2, dec=-13.2, spectral_shape=Powerlaw())”

]

}, {

“cell_type”: “markdown”, “id”: “49d5f216”, “metadata”: {}, “source”: [

“We can also use Galactic coordinates:”

]

}, {

“cell_type”: “code”, “execution_count”: 2, “id”: “0ecf7d59”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.725684Z”, “iopub.status.busy”: “2021-08-17T08:10:12.724730Z”, “iopub.status.idle”: “2021-08-17T08:10:12.731465Z”, “shell.execute_reply”: “2021-08-17T08:10:12.732088Z”

}

}, “outputs”: [], “source”: [

“simple_source_gal = PointSource(‘simple_source’, l=234.320573, b=11.365142, spectral_shape=Powerlaw())”

]

}, {

“cell_type”: “markdown”, “id”: “7820fd6c”, “metadata”: {}, “source”: [

“As spectral shape we can use any function or any composite function (seen”, “"Creating and modifying functions")”

]

}, {

“cell_type”: “markdown”, “id”: “b70dbceb”, “metadata”: {}, “source”: [

“## Getting info about a point sourcen”, “n”, “Info about a point source can be obtained with then”, “.display() method (which will use the richest representation available),n”, “or by printing it which will display a text-only representation:n”

]

}, {

“cell_type”: “code”, “execution_count”: 3, “id”: “f11b09fc”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.749955Z”, “iopub.status.busy”: “2021-08-17T08:10:12.748857Z”, “iopub.status.idle”: “2021-08-17T08:10:12.754259Z”, “shell.execute_reply”: “2021-08-17T08:10:12.754903Z”

}

}, “outputs”: [

{
“data”: {
“text/html”: [

“<ul>n”, “n”, “<li>simple_source (point source): n”, “<ul>n”, “n”, “<li>position: n”, “<ul>n”, “n”, “<li>ra: n”, “<ul>n”, “n”, “<li>value: 123.2</li>n”, “n”, “<li>desc: Right Ascension</li>n”, “n”, “<li>min_value: 0.0</li>n”, “n”, “<li>max_value: 360.0</li>n”, “n”, “<li>unit: deg</li>n”, “n”, “<li>is_normalization: False</li>n”, “n”, “</ul>n”, “n”, “</li>n”, “n”, “<li>dec: n”, “<ul>n”, “n”, “<li>value: -13.2</li>n”, “n”, “<li>desc: Declination</li>n”, “n”, “<li>min_value: -90.0</li>n”, “n”, “<li>max_value: 90.0</li>n”, “n”, “<li>unit: deg</li>n”, “n”, “<li>is_normalization: False</li>n”, “n”, “</ul>n”, “n”, “</li>n”, “n”, “<li>equinox: J2000</li>n”, “n”, “</ul>n”, “n”, “</li>n”, “n”, “<li>spectrum: n”, “<ul>n”, “n”, “<li>main: n”, “<ul>n”, “n”, “<li>Powerlaw: n”, “<ul>n”, “n”, “<li>K: n”, “<ul>n”, “n”, “<li>value: 1.0</li>n”, “n”, “<li>desc: Normalization (differential flux at the pivot value)</li>n”, “n”, “<li>min_value: 1e-30</li>n”, “n”, “<li>max_value: 1000.0</li>n”, “n”, “<li>unit: keV-1 s-1 cm-2</li>n”, “n”, “<li>is_normalization: True</li>n”, “n”, “</ul>n”, “n”, “</li>n”, “n”, “<li>piv: n”, “<ul>n”, “n”, “<li>value: 1.0</li>n”, “n”, “<li>desc: Pivot value</li>n”, “n”, “<li>min_value: None</li>n”, “n”, “<li>max_value: None</li>n”, “n”, “<li>unit: keV</li>n”, “n”, “<li>is_normalization: False</li>n”, “n”, “</ul>n”, “n”, “</li>n”, “n”, “<li>index: n”, “<ul>n”, “n”, “<li>value: -2.01</li>n”, “n”, “<li>desc: Photon index</li>n”, “n”, “<li>min_value: -10.0</li>n”, “n”, “<li>max_value: 10.0</li>n”, “n”, “<li>unit: </li>n”, “n”, “<li>is_normalization: False</li>n”, “n”, “</ul>n”, “n”, “</li>n”, “n”, “</ul>n”, “n”, “</li>n”, “n”, “</ul>n”, “n”, “</li>n”, “n”, “</ul>n”, “n”, “</li>n”, “n”, “</ul>n”, “n”, “</li>n”, “n”, “</ul>n”

], “text/plain”: [

” * simple_source (point source):n”, ” * position:n”, ” * ra:n”, ” * value: 123.2n”, ” * desc: Right Ascensionn”, ” * min_value: 0.0n”, ” * max_value: 360.0n”, ” * unit: degn”, ” * is_normalization: falsen”, ” * dec:n”, ” * value: -13.2n”, ” * desc: Declinationn”, ” * min_value: -90.0n”, ” * max_value: 90.0n”, ” * unit: degn”, ” * is_normalization: falsen”, ” * equinox: J2000n”, ” * spectrum:n”, ” * main:n”, ” * Powerlaw:n”, ” * K:n”, ” * value: 1.0n”, ” * desc: Normalization (differential flux at the pivot value)n”, ” * min_value: 1.0e-30n”, ” * max_value: 1000.0n”, ” * unit: keV-1 s-1 cm-2n”, ” * is_normalization: truen”, ” * piv:n”, ” * value: 1.0n”, ” * desc: Pivot valuen”, ” * min_value: nulln”, ” * max_value: nulln”, ” * unit: keVn”, ” * is_normalization: falsen”, ” * index:n”, ” * value: -2.01n”, ” * desc: Photon indexn”, ” * min_value: -10.0n”, ” * max_value: 10.0n”, ” * unit: ‘’n”, ” * is_normalization: falsen”, ” * polarization: {}”

]

}, “metadata”: {}, “output_type”: “display_data”

}

], “source”: [

“simple_source_icrs.display()”

]

}, {

“cell_type”: “code”, “execution_count”: 4, “id”: “c2717473”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.763985Z”, “iopub.status.busy”: “2021-08-17T08:10:12.763026Z”, “iopub.status.idle”: “2021-08-17T08:10:12.770245Z”, “shell.execute_reply”: “2021-08-17T08:10:12.771035Z”

}

}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

” * simple_source (point source):n”, ” * position:n”, ” * ra:n”, ” * value: 123.2n”, ” * desc: Right Ascensionn”, ” * min_value: 0.0n”, ” * max_value: 360.0n”, ” * unit: degn”, ” * is_normalization: falsen”, ” * dec:n”, ” * value: -13.2n”, ” * desc: Declinationn”, ” * min_value: -90.0n”, ” * max_value: 90.0n”, ” * unit: degn”, ” * is_normalization: falsen”, ” * equinox: J2000n”, ” * spectrum:n”, ” * main:n”, ” * Powerlaw:n”, ” * K:n”, ” * value: 1.0n”, ” * desc: Normalization (differential flux at the pivot value)n”, ” * min_value: 1.0e-30n”, ” * max_value: 1000.0n”, ” * unit: keV-1 s-1 cm-2n”, ” * is_normalization: truen”, ” * piv:n”, ” * value: 1.0n”, ” * desc: Pivot valuen”, ” * min_value: nulln”, ” * max_value: nulln”, ” * unit: keVn”, ” * is_normalization: falsen”, ” * index:n”, ” * value: -2.01n”, ” * desc: Photon indexn”, ” * min_value: -10.0n”, ” * max_value: 10.0n”, ” * unit: ‘’n”, ” * is_normalization: falsen”, ” * polarization: {}n”, “n”

]

}

], “source”: [

“print(simple_source_icrs)”

]

}, {

“cell_type”: “markdown”, “id”: “e895bdf7”, “metadata”: {}, “source”: [

“As you can see we have created a point source with one component automatically named "main", with a power law spectrum, at then”, “specified position.”

]

}, {

“cell_type”: “markdown”, “id”: “a6f687a0”, “metadata”: {}, “source”: [

“## Converting between coordinate systemsn”, “n”, “By default the coordinates of the point source are displayed in the samen”, “system used during creation. However, you can always obtain R.A, Dec orn”, “L,B like this:”

]

}, {

“cell_type”: “code”, “execution_count”: 5, “id”: “35a0e6b5”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.778217Z”, “iopub.status.busy”: “2021-08-17T08:10:12.777305Z”, “iopub.status.idle”: “2021-08-17T08:10:12.819438Z”, “shell.execute_reply”: “2021-08-17T08:10:12.820282Z”

}

}, “outputs”: [

{
“data”: {
“text/html”: [

“Sky direction (R.A., Dec.) = (123.20000, -13.20000) (J2000)”

], “text/plain”: [

“Sky direction (R.A., Dec.) = (123.20000, -13.20000) (J2000)”

]

}, “metadata”: {}, “output_type”: “display_data”

}, {

“name”: “stdout”, “output_type”: “stream”, “text”: [

“234.32058209778674 11.365144109043952n”

]

}, {

“data”: {
“text/html”: [

“Sky direction (l, b) = (234.32057, 11.36514) (J2000)”

], “text/plain”: [

“Sky direction (l, b) = (234.32057, 11.36514) (J2000)”

]

}, “metadata”: {}, “output_type”: “display_data”

}, {

“name”: “stdout”, “output_type”: “stream”, “text”: [

“123.19999334752814 -13.199993514950465n”

]

}

], “source”: [

“simple_source_icrs.position.display()n”, “l = simple_source_icrs.position.get_l()n”, “b = simple_source_icrs.position.get_b()n”, “print(l,b)n”, “n”, “simple_source_gal.position.display()n”, “ra = simple_source_gal.position.get_ra()n”, “dec = simple_source_gal.position.get_dec()n”, “print(ra,dec)”

]

}, {

“cell_type”: “markdown”, “id”: “6eefa12f”, “metadata”: {}, “source”: [

“For more control on the output and many more options, such as transformn”, “to local frames or other equinoxes, you can obtain an instance ofn”, “[astropy.coordinates.SkyCoord](http://docs.astropy.org/en/stable/api/astropy.coordinates.SkyCoord.html) by using the sky_coord property of then”, “position object:”

]

}, {

“cell_type”: “code”, “execution_count”: 6, “id”: “8617dee2”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.837989Z”, “iopub.status.busy”: “2021-08-17T08:10:12.836786Z”, “iopub.status.idle”: “2021-08-17T08:10:12.844331Z”, “shell.execute_reply”: “2021-08-17T08:10:12.845192Z”

}

}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“123.2n”

]

}

], “source”: [

“sky_coord_instance = simple_source_icrs.position.sky_coordn”, “ra = sky_coord_instance.transform_to(‘icrs’).ran”, “dec = sky_coord_instance.transform_to(‘icrs’).decn”, “print(ra.deg)”

]

}, {

“cell_type”: “markdown”, “id”: “5d335ceb”, “metadata”: {}, “source”: [

“## Gotcha while accessing coordinatesn”, “n”, “Please note that using get_ra() and .ra (or the equivalent methods forn”, “the other coordinates) is not the same. While get_ra() will alwaysn”, “return a single float value corresponding to the R.A. of the source, then”, “.ra property will exist only if the source has been created using R.A,n”, “Dec as input coordinates and will return a Parameter instance:”

]

}, {

“cell_type”: “code”, “execution_count”: 7, “id”: “2d42dbe4”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.852249Z”, “iopub.status.busy”: “2021-08-17T08:10:12.851216Z”, “iopub.status.idle”: “2021-08-17T08:10:12.857744Z”, “shell.execute_reply”: “2021-08-17T08:10:12.858695Z”

}

}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“<class ‘astromodels.core.parameter.Parameter’>n”

]

}, {

“data”: {
“text/html”: [

“Parameter ra = 123.2 [deg]n”, “(min_value = 0.0, max_value = 360.0, delta = 12.32, free = False)”

], “text/plain”: [

“Parameter ra = 123.2 [deg]n”, “(min_value = 0.0, max_value = 360.0, delta = 12.32, free = False)”

]

}, “metadata”: {}, “output_type”: “display_data”

}, {

“data”: {
“text/html”: [

“Parameter dec = -13.2 [deg]n”, “(min_value = -90.0, max_value = 90.0, delta = 1.32, free = False)”

], “text/plain”: [

“Parameter dec = -13.2 [deg]n”, “(min_value = -90.0, max_value = 90.0, delta = 1.32, free = False)”

]

}, “metadata”: {}, “output_type”: “display_data”

}

], “source”: [

“parameter_ra = simple_source_icrs.position.ran”, “parameter_dec = simple_source_icrs.position.decn”, “n”, “print( type(parameter_ra) )n”, “parameter_ra.display()n”, “parameter_dec.display()”

]

}, {

“cell_type”: “markdown”, “id”: “50244ab8”, “metadata”: {}, “source”: [

“The following would instead throw AttributeError, since simple_source_icrs was instanced using R.A. and Dec. and hence does not have the l, b parameters:”

]

}, {

“cell_type”: “code”, “execution_count”: 8, “id”: “88bd2df4”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.864981Z”, “iopub.status.busy”: “2021-08-17T08:10:12.863997Z”, “iopub.status.idle”: “2021-08-17T08:10:12.871263Z”, “shell.execute_reply”: “2021-08-17T08:10:12.871886Z”

}

}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“‘SkyDirection’ object has no attribute ‘l’n”

]

}

], “source”: [

“try:n”, ” print( simple_source_icrs.position.l)n”, “except Exception as e:n”, ” print(e)”

]

}, {

“cell_type”: “markdown”, “id”: “acc38e8e”, “metadata”: {}, “source”: [

“In all cases, independently on how the source was instanced, you can obtain the values of coordinates in degreesn”, “as floating point numbers using get_ra(), get_dec(), get_l(), get_b(). However, you can only directly assign coordinates in the same system that the source direction was originally created, e.g.:n”

]

}, {

“cell_type”: “code”, “execution_count”: 9, “id”: “9378ff0c”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.879311Z”, “iopub.status.busy”: “2021-08-17T08:10:12.878226Z”, “iopub.status.idle”: “2021-08-17T08:10:12.888165Z”, “shell.execute_reply”: “2021-08-17T08:10:12.888806Z”

}

}, “outputs”: [

{
“data”: {
“text/html”: [

“Sky direction (R.A., Dec.) = (123.20000, -13.20000) (J2000)”

], “text/plain”: [

“Sky direction (R.A., Dec.) = (123.20000, -13.20000) (J2000)”

]

}, “metadata”: {}, “output_type”: “display_data”

}, {

“data”: {
“text/html”: [

“Sky direction (R.A., Dec.) = (124.20000, -14.20000) (J2000)”

], “text/plain”: [

“Sky direction (R.A., Dec.) = (124.20000, -14.20000) (J2000)”

]

}, “metadata”: {}, “output_type”: “display_data”

}

], “source”: [

“simple_source_icrs.position.display()n”, “simple_source_icrs.position.ra = simple_source_icrs.position.ra.value + 1.0n”, “simple_source_icrs.position.dec = simple_source_icrs.position.dec.value - 1.0n”, “simple_source_icrs.position.display()”

]

}, {

“cell_type”: “markdown”, “id”: “c1180b5d”, “metadata”: {}, “source”: [

“## Fitting the source positionn”, “n”, “Source coordinates, like any parameters, can be set to be free or fixed during the fit. By default, coordinates are set to be fixed. If you would like to fit them as free parameters during the likelihood fit, they can be freed as any other parameter. Note that param.free = True and param.fix = False are equivalent. “

]

}, {

“cell_type”: “code”, “execution_count”: 10, “id”: “38e3907c”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.895924Z”, “iopub.status.busy”: “2021-08-17T08:10:12.894883Z”, “iopub.status.idle”: “2021-08-17T08:10:12.898086Z”, “shell.execute_reply”: “2021-08-17T08:10:12.901030Z”

}

}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Free parameters (before freeing position): odict_keys([‘simple_source.spectrum.main.Powerlaw.K’, ‘simple_source.spectrum.main.Powerlaw.index’])n”, “Free parameters (after freeing position): odict_keys([‘simple_source.spectrum.main.Powerlaw.K’, ‘simple_source.spectrum.main.Powerlaw.index’, ‘simple_source.position.ra’, ‘simple_source.position.dec’])n”

]

}

], “source”: [

“print("Free parameters (before freeing position):", simple_source_icrs.free_parameters.keys())n”, “simple_source_icrs.position.ra.free = Truen”, “simple_source_icrs.position.dec.fix = Falsen”, “print("Free parameters (after freeing position):", simple_source_icrs.free_parameters.keys())n”

]

}, {

“cell_type”: “markdown”, “id”: “50236947”, “metadata”: {}, “source”: [

“For a source created in Galactic coordinates, instead use the following:”

]

}, {

“cell_type”: “code”, “execution_count”: 11, “id”: “67be72c4”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.910926Z”, “iopub.status.busy”: “2021-08-17T08:10:12.909929Z”, “iopub.status.idle”: “2021-08-17T08:10:12.916784Z”, “shell.execute_reply”: “2021-08-17T08:10:12.917788Z”

}

}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Free parameters (before freeing position): odict_keys([‘simple_source.spectrum.main.Powerlaw.K’, ‘simple_source.spectrum.main.Powerlaw.index’])n”, “Free parameters (after freeing position): odict_keys([‘simple_source.spectrum.main.Powerlaw.K’, ‘simple_source.spectrum.main.Powerlaw.index’, ‘simple_source.position.l’, ‘simple_source.position.b’])n”

]

}

], “source”: [

“print("Free parameters (before freeing position):", simple_source_gal.free_parameters.keys())n”, “simple_source_gal.position.l.free = Truen”, “simple_source_gal.position.b.fix = Falsen”, “print("Free parameters (after freeing position):", simple_source_gal.free_parameters.keys())n”

]

}, {

“cell_type”: “markdown”, “id”: “1b389ff1”, “metadata”: {}, “source”: [

“By default, the allowed range for the Right Ascension is from 0˚ to 360˚ and allowed declination values range from -90˚ to 90˚. If fitting the source position, it is strongly recommended to restrict the coordinates to be inside the region of interest (ROI) at all times. The source moving far enough from the ROI during the fit can lead to issues such as the minimizer getting "stuck" due to the likelihood surface being flat. For example:”

]

}, {

“cell_type”: “code”, “execution_count”: 12, “id”: “a79f71a3”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.926201Z”, “iopub.status.busy”: “2021-08-17T08:10:12.925220Z”, “iopub.status.idle”: “2021-08-17T08:10:12.935227Z”, “shell.execute_reply”: “2021-08-17T08:10:12.935847Z”

}

}, “outputs”: [

{
“data”: {
“text/html”: [

“Parameter ra = 124.2 [deg]n”, “(min_value = 119.2, max_value = 129.2, delta = 12.32, free = True)”

], “text/plain”: [

“Parameter ra = 124.2 [deg]n”, “(min_value = 119.2, max_value = 129.2, delta = 12.32, free = True)”

]

}, “metadata”: {}, “output_type”: “display_data”

}, {

“data”: {
“text/html”: [

“Parameter dec = -14.2 [deg]n”, “(min_value = -19.2, max_value = -9.2, delta = 1.32, free = True)”

], “text/plain”: [

“Parameter dec = -14.2 [deg]n”, “(min_value = -19.2, max_value = -9.2, delta = 1.32, free = True)”

]

}, “metadata”: {}, “output_type”: “display_data”

}

], “source”: [

“simple_source_icrs.position.ra.bounds = ( simple_source_icrs.position.ra.value - 5.0, simple_source_icrs.position.ra.value + 5.0 )n”, “simple_source_icrs.position.dec.bounds = ( simple_source_icrs.position.dec.value - 5.0, simple_source_icrs.position.dec.value + 5.0 )n”, “simple_source_icrs.position.ra.display()n”, “simple_source_icrs.position.dec.display()n”

]

}, {

“cell_type”: “markdown”, “id”: “9035dd31”, “metadata”: {}, “source”: [

“## "Calling" a point sourcen”, “n”, “Both the point source object itself as well as the compontents are callable functions who take as argument(s) an array of energies and return the differential flux dN/dE at those energies. Energies can be provided with or without units. If no units are provided, energies are assumed to be in keV and fluxes are returned in 1/(cm2 keV s).

]

}, {

“cell_type”: “code”, “execution_count”: 13, “id”: “b2edb0e7”, “metadata”: {

“execution”: {

“iopub.execute_input”: “2021-08-17T08:10:12.945191Z”, “iopub.status.busy”: “2021-08-17T08:10:12.944145Z”, “iopub.status.idle”: “2021-08-17T08:10:14.065026Z”, “shell.execute_reply”: “2021-08-17T08:10:14.066036Z”

}

}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Energy in keV:n”

]

}, {

“name”: “stdout”, “output_type”: “stream”, “text”: [

“With units: [1.00000000e+00 9.77237221e-03 9.54992586e-05] 1 / (cm2 keV s)n”

]

}, {

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Without units: [1.00000000e+00 9.77237221e-03 9.54992586e-05]n”, “With units: [1.00000000e+00 9.77237221e-03 9.54992586e-05] 1 / (cm2 keV s)n”, “Without units: [1.00000000e+00 9.77237221e-03 9.54992586e-05]n”, “n”, “Energy in TeV:n”, “With units: [1.00000000e+00 9.77237221e-03 9.54992586e-05] 1 / (cm2 keV s)n”, “With units: [1.00000000e+09 9.77237221e+06 9.54992586e+04] 1 / (cm2 s TeV)n”, “Without units: [1.23026877e+18 1.20226443e+16 1.17489755e+14]n”

]

}

], “source”: [

“from astropy import units as un”, “E = [1, 10, 100]*u.keVn”, “n”, “print("Energy in keV:")n”, “print( "With units:", simple_source_icrs(E) )n”, “print( "Without units:", simple_source_icrs(E.value) )n”, “n”, “print( "With units:", simple_source_icrs.spectrum.main.shape(E) )n”, “print( "Without units:", simple_source_icrs.spectrum.main.shape(E.value) )n”, “n”, “print("")n”, “print("Energy in TeV:")n”, “E_TeV = E.to(u.TeV)n”, “print( "With units:", simple_source_icrs(E_TeV) )n”, “print( "With units:", simple_source_icrs(E_TeV).to(1/u.cm**2/u.TeV/u.s) )n”, “print( "Without units:", simple_source_icrs(E_TeV.value) )n”, “n”, “n”

]

}, {

“cell_type”: “code”, “execution_count”: null, “id”: “d1209b05”, “metadata”: {}, “outputs”: [], “source”: []

}

], “metadata”: {

“jupytext”: {

“formats”: “ipynb,md”

}, “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.11”

}

}, “nbformat”: 4, “nbformat_minor”: 5

}