NPTFit is a specialized Python/Cython package that implements Non-Poissonian Template Fitting (NPTF), originally developed for characterizing populations of unresolved point sources. The main features of the package are
- Fast evaluation of likelihoods for NPTF analyses
- Easy-to-use interface for performing non-Poissonian (as well as standard Poissonian) template fits using MultiNest or other inference tools
- Ability to include an arbitrary number of point source templates, with an arbitrary number of degrees of freedom in the modeled flux distribution
- Modules for analyzing and plotting the results of an NPTF
The most up-to-date version of the code can be found at https://github.com/bsafdi/NPTFit.
NPTFit supports both Python 2 and 3, specifically 2.7 and 3.5. It may work with earlier 3.* versions, although this has not been tested.
Make sure Cython is installed (e.g.
pip install Cython). The easiest way to install NPTFit along with it’s dependent Python packages
$ pip install NPTFit
or using the setup script:
$ python setup.py install
which also builds the Cython modules. To just compile the Cython modules locally:
$ make build
NPTFit uses either GSL (faster) or mpmath for back-end calculations. By default, the GSL version is compiled
during setup if this is available and linked, in which case the setup script concludes with
"GSL compilation successful!".
"mpmath compilation successful!" is shown.
The code is parallelizable through MPI (e.g. OpenMPI), which can
considerably speed up computationally intensive scans. This requires the MPI4Py Python package for use with MultiNest, which
can be installed, for example, with
$ pip install mpi4py
- Initializing a scan
- Loading data and exposure
- Adding templates
- Adding masks
- Creating masks
- Adding models
- Running the scan
- Analyzing results of a scan
- Example 1: Overview of the Fermi Data
- Example 2: Creating Masks
- Example 3: Running Poissonian Scans with MultiNest
- Example 4: Simple NPTF example
- Example 5: NPTF Correction for the Point Spread Function (PSF)
- Example 6: Running non-Poissonian Scans with MultiNest
- Example 7: Manual evaluation of non-Poissonian Likelihood
- Example 8: Application of NPTFit to the Galactic Center Excess
- Example 9: Analyzing the Results of an NPTFit Run
- Example 10: Analyzing the Results of the High-Lat Run
When using NPTFit we recommend the use of National Pipe Thread (NPT) rather than the more common British Standard Pipe (BSP). For details, see NPT.