{"action":"created","comment":{"url":"https://api.github.com/repos/gammapy/gammapy/pulls/comments/34843632","id":34843632,"diff_hunk":"@@ -71,3 +82,740 @@ def evaluate(self, x, y):\n         y = np.asanyarray(y, dtype=float)\n         parvals = self.parvals(x)\n         return self._evaluate_y(y, parvals)\n+\n+\n+def _make_bin_edges_array(lo, hi):\n+    \"\"\"Make bin edges array from a low values and a high values array.\n+\n+    TODO: move this function to somewhere else? (i.e. utils?)\n+\n+    Parameters\n+    ----------\n+    lo : `~numpy.array`\n+        lower boundaries\n+    hi : `~numpy.array`\n+        higher boundaries\n+\n+    Returns\n+    -------\n+    bin_edges : `~numpy.array`\n+        array of bin edges as [[low], [high]]\n+    \"\"\"\n+    return np.append(lo.flatten(), hi.flatten()[-1:])\n+\n+\n+def _table_to_fits_bin_table(table):\n+    \"\"\"Convert astropy table to binary table fits format.\n+\n+    This is a generic method to convert a `~astropy.table.Table`\n+    to a `~astropy.io.fits.BinTableHDU`.\n+    TODO: move to a more generic position (i.e. utils)?\n+\n+    Returns\n+    -------\n+    tbhdu : `~astropy.io.fits.BinTableHDU`\n+    fits bin table containing the astropy table columns\n+    \"\"\"\n+    # read name and drop it from the meta information, otherwise\n+    # it would be stored as a header keyword in the BinTableHDU\n+    name = table.meta.popitem('name')[1]\n+\n+    data = table.as_array()\n+\n+    header = fits.Header()\n+    header.update(table.meta)\n+\n+    tbhdu = fits.BinTableHDU(data, header, name=name)\n+\n+    # Copy over column meta-data\n+    for colname in table.colnames:\n+        tbhdu.columns[colname].unit = str(table[colname].unit)\n+\n+    # TODO: this method works fine but the order of keywords in the table\n+    # header is not logical: for instance, list of keywords with column\n+    # units (TUNITi) is appended after the list of column keywords\n+    # (TTYPEi, TFORMi), instead of in between.\n+    # As a matter of fact, the units aren't yet in the header, but\n+    # only when calling the write method and opening the output file.\n+    # https://github.com/gammapy/gammapy/issues/298\n+\n+    return tbhdu\n+\n+\n+def _parse_bg_units(background_unit):\n+    \"\"\"\n+    Utility function to parse the bg units correctly.\n+    \"\"\"\n+    # try 1st to parse them as astropy units\n+    try:\n+        u.Unit(background_unit)\n+    # if it fails, try to parse them manually\n+    except ValueError:\n+        tev_units = ['1/s/TeV/sr', 's-1 sr-1 TeV-1', '1 / (s sr TeV)',\n+                     '1 / (TeV s sr)']\n+        mev_units = ['1/s/MeV/sr', 'MeV-1 s-1 sr-1', '1 / (s sr MeV)',\n+                     '1 / (MeV s sr)']\n+        if background_unit in tev_units:\n+            background_unit = '1 / (s TeV sr)'\n+        elif background_unit in mev_units:\n+            background_unit = '1 / (s MeV sr)'\n+        # if it still fails, raise an exception\n+        else:\n+            raise ValueError(\"Cannot interpret units ({})\".format(background_unit))\n+\n+    return background_unit\n+\n+\n+class CubeBackgroundModel(object):\n+\n+    \"\"\"Cube background model.\n+\n+    Container class for cube background model (X, Y, energy).\n+    (X, Y) are detector coordinates (a.k.a. nominal system).\n+    The class hass methods for reading a model from a fits file,\n+    write a model to a fits file and plot the models.\n+\n+    Parameters\n+    ----------\n+    detx_bins : `~astropy.coordinates.Angle`\n+        Spatial bin edges vector (low and high). X coordinate.\n+    dety_bins : `~astropy.coordinates.Angle`\n+        Spatial bin edges vector (low and high). Y coordinate.\n+    energy_bins : `~astropy.units.Quantity`\n+        Energy bin edges vector (low and high).\n+    background : `~astropy.units.Quantity`\n+        Background cube in (energy, X, Y) format.\n+    \"\"\"\n+\n+    def __init__(self, detx_bins, dety_bins, energy_bins, background):\n+        self.detx_bins = detx_bins\n+        self.dety_bins = dety_bins\n+        self.energy_bins = energy_bins\n+\n+        self.background = background\n+\n+    @staticmethod\n+    def from_fits_bin_table(tbhdu):\n+        \"\"\"Read cube background model from a fits binary table.\n+\n+        Parameters\n+        ----------\n+        tbhdu : `~astropy.io.fits.BinTableHDU`\n+            HDU binary table for the bg cube\n+\n+        Returns\n+        -------\n+        bg_cube : `~gammapy.background.CubeBackgroundModel`\n+            bg model cube object\n+        \"\"\"\n+ \n+        header = tbhdu.header\n+        data = tbhdu.data\n+\n+        # check correct axis order: 1st X, 2nd Y, 3rd energy, 4th bg\n+        if (header['TTYPE1'] != 'DETX_LO') or (header['TTYPE2'] != 'DETX_HI'):\n+            raise ValueError(\"Expecting X axis in first 2 places, not ({0}, {1})\"\n+                             .format(header['TTYPE1'], header['TTYPE2']))\n+        if (header['TTYPE3'] != 'DETY_LO') or (header['TTYPE4'] != 'DETY_HI'):\n+            raise ValueError(\"Expecting Y axis in second 2 places, not ({0}, {1})\"\n+                             .format(header['TTYPE3'], header['TTYPE4']))\n+        if (header['TTYPE5'] != 'ENERG_LO') or (header['TTYPE6'] != 'ENERG_HI'):\n+            raise ValueError(\"Expecting E axis in third 2 places, not ({0}, {1})\"\n+                             .format(header['TTYPE5'], header['TTYPE6']))\n+        if (header['TTYPE7'] != 'Bgd'):\n+            raise ValueError(\"Expecting bg axis in fourth place, not ({})\"\n+                             .format(header['TTYPE7']))\n+\n+        # get det X, Y binning\n+        detx_bins = _make_bin_edges_array(data['DETX_LO'], data['DETX_HI'])\n+        dety_bins = _make_bin_edges_array(data['DETY_LO'], data['DETY_HI'])\n+        if header['TUNIT1'] == header['TUNIT2']:\n+            detx_unit = header['TUNIT1']\n+        else:\n+            raise ValueError(\"Detector X units not matching ({0}, {1})\"\n+                             .format(header['TUNIT1'], header['TUNIT2']))\n+        if header['TUNIT3'] == header['TUNIT4']:\n+            dety_unit = header['TUNIT3']\n+        else:\n+            raise ValueError(\"Detector Y units not matching ({0}, {1})\"\n+                             .format(header['TUNIT3'], header['TUNIT4']))\n+        if not detx_unit == dety_unit:\n+            ss_error = \"This is odd: detector X and Y units not matching\"\n+            ss_error += \"({0}, {1})\".format(detx_unit, dety_unit)\n+            raise ValueError(ss_error)\n+        detx_bins = Angle(detx_bins, detx_unit)\n+        dety_bins = Angle(dety_bins, dety_unit)\n+\n+        # get energy binning\n+        energy_bins = _make_bin_edges_array(data['ENERG_LO'], data['ENERG_HI'])\n+        if header['TUNIT5'] == header['TUNIT6']:\n+            energy_unit = header['TUNIT5']\n+        else:\n+            raise ValueError(\"Energy units not matching ({0}, {1})\"\n+                             .format(header['TUNIT5'], header['TUNIT6']))\n+        energy_bins = Quantity(energy_bins, energy_unit)\n+\n+        # get background data\n+        background = data['Bgd'][0]\n+        background_unit = _parse_bg_units(header['TUNIT7'])\n+        background = Quantity(background, background_unit)\n+\n+        return CubeBackgroundModel(detx_bins=detx_bins,\n+                                   dety_bins=dety_bins,\n+                                   energy_bins=energy_bins,\n+                                   background=background)\n+\n+    @staticmethod\n+    def from_fits_image(imhdu, enhdu):\n+        \"\"\"Read cube background model from a fits image.\n+\n+        Parameters\n+        ----------\n+        imhdu : `~astropy.io.fits.PrimaryHDU`\n+            image for the bg cube\n+        enhdu : `~astropy.io.fits.BinTableHDU`\n+             table for the energy binning\n+\n+        Returns\n+        -------\n+        bg_cube : `~gammapy.background.CubeBackgroundModel`\n+            bg model cube object\n+        \"\"\"\n+        im_header = imhdu.header\n+        en_header = enhdu.header\n+\n+        # check correct axis order: 1st X, 2nd Y, 3rd energy, 4th bg\n+        if (im_header['CTYPE1'] != 'DETX'):\n+            raise ValueError(\"Expecting X axis in first place, not ({})\"\n+                             .format(im_header['CTYPE1']))\n+        if (im_header['CTYPE2'] != 'DETY'):\n+            raise ValueError(\"Expecting Y axis in second place, not ({})\"\n+                             .format(im_header['CTYPE2']))\n+        if (im_header['CTYPE3'] != 'ENERGY'):\n+            raise ValueError(\"Expecting E axis in third place, not ({})\"\n+                             .format(im_header['CTYPE3']))\n+\n+        # check units\n+        if (im_header['CUNIT1'] != im_header['CUNIT2']):\n+            ss_error = \"This is odd: detector X and Y units not matching\"\n+            ss_error += \"({0}, {1})\".format(im_header['CUNIT1'], im_header['CUNIT2'])\n+            raise ValueError(ss_error)\n+        if (im_header['CUNIT3'] != en_header['TUNIT1']):\n+            ss_error = \"This is odd: energy units not matching\"\n+            ss_error += \"({0}, {1})\".format(im_header['CUNIT3'], en_header['TUNIT1'])\n+            raise ValueError(ss_error)\n+\n+        # get det X, Y binning\n+        wcs = WCS(im_header, naxis=2) # select only the (X, Y) axes\n+        detx_bins, dety_bins = linear_arrays_from_wcs(wcs,\n+                                                      im_header['NAXIS1'],\n+                                                      im_header['NAXIS2'])\n+\n+        # get energy binning\n+        energy_bins = Quantity(enhdu.data['ENERGY_BIN_EDGES'],\n+                               en_header['TUNIT1'])\n+\n+        # get background data\n+        background = imhdu.data\n+        background_unit = _parse_bg_units(im_header['BG_UNIT'])\n+        background = Quantity(background, background_unit)\n+\n+        return CubeBackgroundModel(detx_bins=detx_bins,\n+                                   dety_bins=dety_bins,\n+                                   energy_bins=energy_bins,\n+                                   background=background)\n+\n+    @staticmethod\n+    def read(filename, format='table'):\n+        \"\"\"Read cube background model from fits file.\n+\n+        Several input formats are accepted, depending on the value\n+        of the `format` parameter:\n+\n+        * bin_table (default and preferred format): `~astropy.io.fits.BinTableHDU`\n+\n+        * image (alternative format): `~astropy.io.fits.PrimaryHDU`,\n+          with the energy binning stored as `~astropy.io.fits.BinTableHDU`\n+\n+        Parameters\n+        ----------\n+        filename : `~str`\n+            name of file with the bg cube\n+        format : `~str`, optional\n+            format of the bg cube to read\n+\n+        Returns\n+        -------\n+        bg_cube : `~gammapy.background.CubeBackgroundModel`\n+            bg model cube object\n+        \"\"\"\n+        hdu = fits.open(filename)\n+        if format == 'table':\n+            return CubeBackgroundModel.from_fits_bin_table(hdu['BACKGROUND'])\n+        elif format == 'image':\n+            return CubeBackgroundModel.from_fits_image(hdu['PRIMARY'], hdu['ENERGY_BINS'])\n+        else:\n+            raise ValueError(\"Invalid format {}.\".format(format))\n+\n+    def to_table(self):\n+        \"\"\"Convert cube background model to astropy table format.\n+\n+        The name of the table is stored in the table meta information\n+        under the keyword 'name'.\n+\n+        Returns\n+        -------\n+        table : `~astropy.table.Table`\n+            table containing the bg cube\n+        \"\"\"\n+        # data arrays\n+        a_detx_lo = Quantity([self.detx_bins[:-1]])\n+        a_detx_hi = Quantity([self.detx_bins[1:]])\n+        a_dety_lo = Quantity([self.dety_bins[:-1]])\n+        a_dety_hi = Quantity([self.dety_bins[1:]])\n+        a_energy_lo = Quantity([self.energy_bins[:-1]])\n+        a_energy_hi = Quantity([self.energy_bins[1:]])\n+        a_bg = Quantity([self.background])\n+\n+        # table\n+        table = Table()\n+        table['DETX_LO'] = a_detx_lo\n+        table['DETX_HI'] = a_detx_hi\n+        table['DETY_LO'] = a_dety_lo\n+        table['DETY_HI'] = a_dety_hi\n+        table['ENERG_LO'] = a_energy_lo\n+        table['ENERG_HI'] = a_energy_hi\n+        table['Bgd'] = a_bg\n+\n+        table.meta['E_THRES'] = a_energy_lo.flatten()[0].value\n+\n+        table.meta['name'] = 'BACKGROUND'\n+\n+        return table\n+\n+    def to_fits_bin_table(self):\n+        \"\"\"Convert cube background model to binary table fits format.\n+\n+        Returns\n+        -------\n+        tbhdu : `~astropy.io.fits.BinTableHDU`\n+            table containing the bg cube\n+        \"\"\"\n+        return _table_to_fits_bin_table(self.to_table())\n+\n+    def to_fits_image(self):\n+        \"\"\"Convert cube background model to image fits format.\n+\n+        Returns\n+        -------\n+        hdu_list : `~astropy.io.fits.HDUList`\n+            HDU list with:\n+\n+            * one `~astropy.io.fits.PrimaryHDU` image for the bg cube\n+\n+            * one `~astropy.io.fits.BinTableHDU` table for the energy binning\n+        \"\"\"\n+        # data\n+        imhdu = fits.PrimaryHDU(data=self.background.value,\n+                                header=self.det_wcs.to_header())\n+        # add some important header information\n+        imhdu.header['BG_UNIT'] = '{0.unit:FITS}'.format(self.background)\n+        imhdu.header['CTYPE3'] = 'ENERGY'\n+        imhdu.header['CUNIT3'] = '{0.unit:FITS}'.format(self.energy_bins)\n+        imhdu.header['E_THRES'] = self.energy_bins[0].value\n+\n+        # get WCS object and write it out as a FITS header\n+        wcs_header = self.det_wcs.to_header()\n+\n+        # get energy values as a table HDU, via an astropy table\n+        energy_table = Table()\n+        energy_table['ENERGY_BIN_EDGES'] = self.energy_bins\n+        energy_table.meta['name'] = 'ENERGY_BINS'\n+\n+        enhdu = _table_to_fits_bin_table(energy_table)\n+\n+        hdu_list = fits.HDUList([imhdu, enhdu])\n+\n+        return hdu_list\n+\n+    def write(self, outfile, format='table', **kwargs):\n+        \"\"\"Write cube background model to fits file.\n+\n+        Several output formats are accepted, depending on the value\n+        of the `format` parameter:\n+\n+        * bin_table (default and preferred format): `~astropy.io.fits.BinTableHDU`\n+        * image (alternative format): `~astropy.io.fits.PrimaryHDU`,\n+          with the energy binning stored as `~astropy.io.fits.BinTableHDU`\n+\n+        Depending on the value of the `format` parameter, this\n+        method calls either `~astropy.io.fits.BinTableHDU.writeto` or\n+        `~astropy.io.fits.HDUList.writeto`, forwarding the\n+        `kwargs` arguments.\n+\n+        Parameters\n+        ----------\n+        outfile : `~str`","path":"gammapy/background/models.py","position":403,"original_position":403,"commit_id":"5cb803104e972f7418355bb869cc864d6f96a504","original_commit_id":"5cb803104e972f7418355bb869cc864d6f96a504","user":{"login":"cdeil","id":852409,"avatar_url":"https://avatars.githubusercontent.com/u/852409?v=3","gravatar_id":"","url":"https://api.github.com/users/cdeil","html_url":"https://github.com/cdeil","followers_url":"https://api.github.com/users/cdeil/followers","following_url":"https://api.github.com/users/cdeil/following{/other_user}","gists_url":"https://api.github.com/users/cdeil/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeil/subscriptions","organizations_url":"https://api.github.com/users/cdeil/orgs","repos_url":"https://api.github.com/users/cdeil/repos","events_url":"https://api.github.com/users/cdeil/events{/privacy}","received_events_url":"https://api.github.com/users/cdeil/received_events","type":"User","site_admin":false},"body":"For Python built-in types, let's not create intersphinx links everywhere, i.e. just type:\r\n```\r\noutfile : str\r\n    ...\r\n```\r\nPlease change this everywhere in this PR","created_at":"2015-07-16T22:09:06Z","updated_at":"2015-07-16T22:09:06Z","html_url":"https://github.com/gammapy/gammapy/pull/299#discussion_r34843632","pull_request_url":"https://api.github.com/repos/gammapy/gammapy/pulls/299","_links":{"self":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/comments/34843632"},"html":{"href":"https://github.com/gammapy/gammapy/pull/299#discussion_r34843632"},"pull_request":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/299"}}},"pull_request":{"url":"https://api.github.com/repos/gammapy/gammapy/pulls/299","id":39741190,"html_url":"https://github.com/gammapy/gammapy/pull/299","diff_url":"https://github.com/gammapy/gammapy/pull/299.diff","patch_url":"https://github.com/gammapy/gammapy/pull/299.patch","issue_url":"https://api.github.com/repos/gammapy/gammapy/issues/299","number":299,"state":"open","locked":false,"title":"Add cube background model class","user":{"login":"mapazarr","id":11326731,"avatar_url":"https://avatars.githubusercontent.com/u/11326731?v=3","gravatar_id":"","url":"https://api.github.com/users/mapazarr","html_url":"https://github.com/mapazarr","followers_url":"https://api.github.com/users/mapazarr/followers","following_url":"https://api.github.com/users/mapazarr/following{/other_user}","gists_url":"https://api.github.com/users/mapazarr/gists{/gist_id}","starred_url":"https://api.github.com/users/mapazarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapazarr/subscriptions","organizations_url":"https://api.github.com/users/mapazarr/orgs","repos_url":"https://api.github.com/users/mapazarr/repos","events_url":"https://api.github.com/users/mapazarr/events{/privacy}","received_events_url":"https://api.github.com/users/mapazarr/received_events","type":"User","site_admin":false},"body":"This PR is a continuation of PR #292.\r\nTask list:\r\n\r\n - [x] the write method (and a test for it)\r\n - [x] porting the test file to `~gammapy-extra`\r\n - [x] make the test that use external files work\r\n - [x] implement `read_image` and `write_image` with a `WCS` object and a HDU table for the energy bin edges; tests\r\n - [x] separate the plot functions into `do_one_plot` and `do_many_plots` functions\r\n - [x] clean the code and autopep it\r\n - [x] the sphinx doc; add link to `examples/plot_background_model.py`; add examples of many plots (mosaic of images, stack of spectra)\r\n - [x] code review and final revision of inline comments\r\n\r\nFurther methods like histograming of event lists or interpolation and smoothing of the model will come on a later PR.\r\n\r\nSorry for the mess, I renamed the branch, which automatically closes the pull request. I thought the PR would be transparent to the rename.","created_at":"2015-07-11T06:22:12Z","updated_at":"2015-07-16T22:09:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"039bb9bf72f980dc5245459c9656e91258060ecc","assignee":{"login":"cdeil","id":852409,"avatar_url":"https://avatars.githubusercontent.com/u/852409?v=3","gravatar_id":"","url":"https://api.github.com/users/cdeil","html_url":"https://github.com/cdeil","followers_url":"https://api.github.com/users/cdeil/followers","following_url":"https://api.github.com/users/cdeil/following{/other_user}","gists_url":"https://api.github.com/users/cdeil/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeil/subscriptions","organizations_url":"https://api.github.com/users/cdeil/orgs","repos_url":"https://api.github.com/users/cdeil/repos","events_url":"https://api.github.com/users/cdeil/events{/privacy}","received_events_url":"https://api.github.com/users/cdeil/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/gammapy/gammapy/milestones/2","html_url":"https://github.com/gammapy/gammapy/milestones/0.3","labels_url":"https://api.github.com/repos/gammapy/gammapy/milestones/2/labels","id":377787,"number":2,"title":"0.3","description":"","creator":{"login":"cdeil","id":852409,"avatar_url":"https://avatars.githubusercontent.com/u/852409?v=3","gravatar_id":"","url":"https://api.github.com/users/cdeil","html_url":"https://github.com/cdeil","followers_url":"https://api.github.com/users/cdeil/followers","following_url":"https://api.github.com/users/cdeil/following{/other_user}","gists_url":"https://api.github.com/users/cdeil/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeil/subscriptions","organizations_url":"https://api.github.com/users/cdeil/orgs","repos_url":"https://api.github.com/users/cdeil/repos","events_url":"https://api.github.com/users/cdeil/events{/privacy}","received_events_url":"https://api.github.com/users/cdeil/received_events","type":"User","site_admin":false},"open_issues":32,"closed_issues":26,"state":"open","created_at":"2013-07-14T16:38:18Z","updated_at":"2015-07-16T07:35:18Z","due_on":"2015-07-27T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/gammapy/gammapy/pulls/299/commits","review_comments_url":"https://api.github.com/repos/gammapy/gammapy/pulls/299/comments","review_comment_url":"https://api.github.com/repos/gammapy/gammapy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gammapy/gammapy/issues/299/comments","statuses_url":"https://api.github.com/repos/gammapy/gammapy/statuses/5cb803104e972f7418355bb869cc864d6f96a504","head":{"label":"mapazarr:cube-bg-container-class","ref":"cube-bg-container-class","sha":"5cb803104e972f7418355bb869cc864d6f96a504","user":{"login":"mapazarr","id":11326731,"avatar_url":"https://avatars.githubusercontent.com/u/11326731?v=3","gravatar_id":"","url":"https://api.github.com/users/mapazarr","html_url":"https://github.com/mapazarr","followers_url":"https://api.github.com/users/mapazarr/followers","following_url":"https://api.github.com/users/mapazarr/following{/other_user}","gists_url":"https://api.github.com/users/mapazarr/gists{/gist_id}","starred_url":"https://api.github.com/users/mapazarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapazarr/subscriptions","organizations_url":"https://api.github.com/users/mapazarr/orgs","repos_url":"https://api.github.com/users/mapazarr/repos","events_url":"https://api.github.com/users/mapazarr/events{/privacy}","received_events_url":"https://api.github.com/users/mapazarr/received_events","type":"User","site_admin":false},"repo":{"id":32351501,"name":"gammapy","full_name":"mapazarr/gammapy","owner":{"login":"mapazarr","id":11326731,"avatar_url":"https://avatars.githubusercontent.com/u/11326731?v=3","gravatar_id":"","url":"https://api.github.com/users/mapazarr","html_url":"https://github.com/mapazarr","followers_url":"https://api.github.com/users/mapazarr/followers","following_url":"https://api.github.com/users/mapazarr/following{/other_user}","gists_url":"https://api.github.com/users/mapazarr/gists{/gist_id}","starred_url":"https://api.github.com/users/mapazarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapazarr/subscriptions","organizations_url":"https://api.github.com/users/mapazarr/orgs","repos_url":"https://api.github.com/users/mapazarr/repos","events_url":"https://api.github.com/users/mapazarr/events{/privacy}","received_events_url":"https://api.github.com/users/mapazarr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mapazarr/gammapy","description":"A Python package for gamma-ray astronomy","fork":true,"url":"https://api.github.com/repos/mapazarr/gammapy","forks_url":"https://api.github.com/repos/mapazarr/gammapy/forks","keys_url":"https://api.github.com/repos/mapazarr/gammapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapazarr/gammapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapazarr/gammapy/teams","hooks_url":"https://api.github.com/repos/mapazarr/gammapy/hooks","issue_events_url":"https://api.github.com/repos/mapazarr/gammapy/issues/events{/number}","events_url":"https://api.github.com/repos/mapazarr/gammapy/events","assignees_url":"https://api.github.com/repos/mapazarr/gammapy/assignees{/user}","branches_url":"https://api.github.com/repos/mapazarr/gammapy/branches{/branch}","tags_url":"https://api.github.com/repos/mapazarr/gammapy/tags","blobs_url":"https://api.github.com/repos/mapazarr/gammapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapazarr/gammapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapazarr/gammapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapazarr/gammapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapazarr/gammapy/statuses/{sha}","languages_url":"https://api.github.com/repos/mapazarr/gammapy/languages","stargazers_url":"https://api.github.com/repos/mapazarr/gammapy/stargazers","contributors_url":"https://api.github.com/repos/mapazarr/gammapy/contributors","subscribers_url":"https://api.github.com/repos/mapazarr/gammapy/subscribers","subscription_url":"https://api.github.com/repos/mapazarr/gammapy/subscription","commits_url":"https://api.github.com/repos/mapazarr/gammapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapazarr/gammapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapazarr/gammapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapazarr/gammapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapazarr/gammapy/contents/{+path}","compare_url":"https://api.github.com/repos/mapazarr/gammapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapazarr/gammapy/merges","archive_url":"https://api.github.com/repos/mapazarr/gammapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapazarr/gammapy/downloads","issues_url":"https://api.github.com/repos/mapazarr/gammapy/issues{/number}","pulls_url":"https://api.github.com/repos/mapazarr/gammapy/pulls{/number}","milestones_url":"https://api.github.com/repos/mapazarr/gammapy/milestones{/number}","notifications_url":"https://api.github.com/repos/mapazarr/gammapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapazarr/gammapy/labels{/name}","releases_url":"https://api.github.com/repos/mapazarr/gammapy/releases{/id}","created_at":"2015-03-16T20:36:43Z","updated_at":"2015-04-09T23:35:39Z","pushed_at":"2015-07-16T21:18:00Z","git_url":"git://github.com/mapazarr/gammapy.git","ssh_url":"git@github.com:mapazarr/gammapy.git","clone_url":"https://github.com/mapazarr/gammapy.git","svn_url":"https://github.com/mapazarr/gammapy","homepage":"https://gammapy.readthedocs.org/","size":3088,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gammapy:master","ref":"master","sha":"8117644e466456a572ca09cd5650ba0167f77982","user":{"login":"gammapy","id":852764,"avatar_url":"https://avatars.githubusercontent.com/u/852764?v=3","gravatar_id":"","url":"https://api.github.com/users/gammapy","html_url":"https://github.com/gammapy","followers_url":"https://api.github.com/users/gammapy/followers","following_url":"https://api.github.com/users/gammapy/following{/other_user}","gists_url":"https://api.github.com/users/gammapy/gists{/gist_id}","starred_url":"https://api.github.com/users/gammapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gammapy/subscriptions","organizations_url":"https://api.github.com/users/gammapy/orgs","repos_url":"https://api.github.com/users/gammapy/repos","events_url":"https://api.github.com/users/gammapy/events{/privacy}","received_events_url":"https://api.github.com/users/gammapy/received_events","type":"Organization","site_admin":false},"repo":{"id":10073640,"name":"gammapy","full_name":"gammapy/gammapy","owner":{"login":"gammapy","id":852764,"avatar_url":"https://avatars.githubusercontent.com/u/852764?v=3","gravatar_id":"","url":"https://api.github.com/users/gammapy","html_url":"https://github.com/gammapy","followers_url":"https://api.github.com/users/gammapy/followers","following_url":"https://api.github.com/users/gammapy/following{/other_user}","gists_url":"https://api.github.com/users/gammapy/gists{/gist_id}","starred_url":"https://api.github.com/users/gammapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gammapy/subscriptions","organizations_url":"https://api.github.com/users/gammapy/orgs","repos_url":"https://api.github.com/users/gammapy/repos","events_url":"https://api.github.com/users/gammapy/events{/privacy}","received_events_url":"https://api.github.com/users/gammapy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gammapy/gammapy","description":"A Python package for gamma-ray astronomy","fork":false,"url":"https://api.github.com/repos/gammapy/gammapy","forks_url":"https://api.github.com/repos/gammapy/gammapy/forks","keys_url":"https://api.github.com/repos/gammapy/gammapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gammapy/gammapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gammapy/gammapy/teams","hooks_url":"https://api.github.com/repos/gammapy/gammapy/hooks","issue_events_url":"https://api.github.com/repos/gammapy/gammapy/issues/events{/number}","events_url":"https://api.github.com/repos/gammapy/gammapy/events","assignees_url":"https://api.github.com/repos/gammapy/gammapy/assignees{/user}","branches_url":"https://api.github.com/repos/gammapy/gammapy/branches{/branch}","tags_url":"https://api.github.com/repos/gammapy/gammapy/tags","blobs_url":"https://api.github.com/repos/gammapy/gammapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gammapy/gammapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gammapy/gammapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/gammapy/gammapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gammapy/gammapy/statuses/{sha}","languages_url":"https://api.github.com/repos/gammapy/gammapy/languages","stargazers_url":"https://api.github.com/repos/gammapy/gammapy/stargazers","contributors_url":"https://api.github.com/repos/gammapy/gammapy/contributors","subscribers_url":"https://api.github.com/repos/gammapy/gammapy/subscribers","subscription_url":"https://api.github.com/repos/gammapy/gammapy/subscription","commits_url":"https://api.github.com/repos/gammapy/gammapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/gammapy/gammapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/gammapy/gammapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/gammapy/gammapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/gammapy/gammapy/contents/{+path}","compare_url":"https://api.github.com/repos/gammapy/gammapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gammapy/gammapy/merges","archive_url":"https://api.github.com/repos/gammapy/gammapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gammapy/gammapy/downloads","issues_url":"https://api.github.com/repos/gammapy/gammapy/issues{/number}","pulls_url":"https://api.github.com/repos/gammapy/gammapy/pulls{/number}","milestones_url":"https://api.github.com/repos/gammapy/gammapy/milestones{/number}","notifications_url":"https://api.github.com/repos/gammapy/gammapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gammapy/gammapy/labels{/name}","releases_url":"https://api.github.com/repos/gammapy/gammapy/releases{/id}","created_at":"2013-05-15T07:50:40Z","updated_at":"2015-06-06T13:39:51Z","pushed_at":"2015-07-16T21:18:01Z","git_url":"git://github.com/gammapy/gammapy.git","ssh_url":"git@github.com:gammapy/gammapy.git","clone_url":"https://github.com/gammapy/gammapy.git","svn_url":"https://github.com/gammapy/gammapy","homepage":"https://gammapy.readthedocs.org/","size":5466,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":105,"forks":20,"open_issues":105,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/299"},"html":{"href":"https://github.com/gammapy/gammapy/pull/299"},"issue":{"href":"https://api.github.com/repos/gammapy/gammapy/issues/299"},"comments":{"href":"https://api.github.com/repos/gammapy/gammapy/issues/299/comments"},"review_comments":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/299/comments"},"review_comment":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/299/commits"},"statuses":{"href":"https://api.github.com/repos/gammapy/gammapy/statuses/5cb803104e972f7418355bb869cc864d6f96a504"}}}}