Prerequisites

In order to run this sample code, you will need Python >= 3.5 on a Unix-like operating system (Linux or macOS) and a few third-party Python packages:

If you are on a Mac and use the MacPorts package manager, you can install all of the above with the following command:

$ sudo port install py37-gcn py37-healpy

Otherwise, the fastest way to install the dependencies is with pip, a package manager that comes with most Python distributions. To install these packages with pip, run the following command:

$ pip install pygcn healpy

Imports

Now we’ll write a GCN handler script. First, some imports:

import gcn
import gcn.handlers
import gcn.notice_types
import healpy as hp
import numpy as np