Adding a spectral model¶
One of the most common changes to the underlying fermitools code is to add a new spectral model. To be able to use that model in fermipy will require a few changes, depending on how exactly you would like you use the model.
- At a minimum, the model, and default values and bounds for the parameters need to
be added to
- If you want to be able to use functions that free the source-shape
parameters, fit the SED, you will want to modify the
shape_parametersblocks at the top of the
fermipy/gtanalysis.pyfile to include the new spectral model.
- If you want to be able to include the spectral model in an xml
‘catalog’ of sources that you use to define an ROI, you will have
to update the
fermipy/roi_model.pyto include the spectral model.
- If the spectral model is included in a new source catalog, and you want to support that catalog, see the section below on supporting new catalogs.
- If you want to use the spectral to do more complicated things, like
vectorizing call to evalute the spectrum because you are using it
in sensitivity studies, then you will have to add it the the
fermipy/spectrum.pyfile. That is pretty much expert territory.
Supporting a new catalog¶
To support a new catalog will require some changes in the
fermipy/catalog.py file. In short
- Define a class to manage the catalog. This will have to handle
converting the parameters in the FITS file to the format that
fermipy expects. It should inherit from the
- Update the
Catalog.createfunction to have a hook to create a class of the correct type.
- For now we are also maintaining the catalog files in the
fermipy/data/catalogsarea, so the catalog files should be added to that area.
Creating a New Release¶
The following are steps for creating a new release:
- Update the Changelog page (in
docs/changelog.rst) with notes for the release and commit those changes.
- Update documentation tables by running
docssubdirectory and commit any resulting changes to the configuration table files under
masterand ensure that you have pulled all commits from origin.
- Create the release tag and push it to GitHub.
$ git tag -a XX.YY.ZZ -m "" $ git push --tags
- Upload the release to pypi.
$ python setup.py sdist upload -r pypi
- Create a new release on conda-forge by opening a PR on the
fermipy-feedstock repo. There
is a fork of
fermipy-feedstockin the fermipy organization that you can use for this purpose. Edit
recipe/meta.yamlby entering the new package version and updating the sha256 hash to the value copied from the pypi download page. Update the package dependencies as necessary in the
requirements. Verify that
entry_pointscontains the desired set of command-line scripts. Generally this section should match the contents
setup.py. Before merging the PR confirm that all tests have successfully passed.