pyLikelihood Unbinned and Binned Analyses
The pyLikelihood package enables you to write a python script that, in its simplest form, reads in a source model and the event and spacecraft data files, then determines the goodness of fit, i.e., how well the model fits the data. The package is an interface to underlying code written in C or C++ that enables you to perform either an unbinned or a binned analysis by running gtlike, thereby making it an interface to the gtlike tool as well. The UnbinnedAnalysis.py and BinnedAnalysis.py modules each contain two classes: UnbinnedObs and UnbinnedAnalysis in the former, and BinnedObs and BinnedAnalysis in the latter. Since the respective analyses require different sets of input data, the "Obs" classes differ in how they are constructed. Notes:
Comparison of Unbinned and
Binned
|
>>> analysis1 = UnbinnedAnalysis(unbinnedObs, "model1.xml") |
Even though the two UnbinnedAnalysis instances access the same data in memory, distinct source models may be fit concurrently to those data without interfering with one another. This is useful in comparing, via a likelihood ratio test, for example, how well one model compares to another.
Parameters: UnbinnedAnalysis observation – An instance of the UnbinnedObs class. srcModel – Name of the XML file containing the source model definition. optimizer – Optimizer package to use: DRMNFB, DRMNGB, MINUIT, NEWMINUIT, LGFGS. (See Model Fitting.) |
Parameters: binnedData – An instance of the BinnedObs class. srcModel – Name of the XML file containing the source model definition. optimizer – Optimizer package to use: DRMNFB, DRMNGB, MINUIT, NEWMINUIT, LGFGS (see Model Fitting in gtlike Help file.) |
UnbinnedObs(object) eventfile – Event data; can be:
scFile – Spacecraft data; can be:
expCube – created using gtltcube expMap – created using gtexpmap; required input includes expCube (created using gtltcube, see above) irfs – e.g., P6_V3_DIFFUSE checkCuts – Debugging flag; set to True for a standard analysis. |
BinnedObs(object) expCube.fits - created using gtltcube binned-expMap.fits - created using gtexpcube2; required input:
srcMap.fits - created using gtsrcmaps; required inputs:
irfs – e.g., P6_V3_DIFFUSE |
Note: The instrument response (PSF, effective area, energy resolution) is currently a function of energy, inclination angle (the angle between the source and the LAT normal), and photon category. Since the LAT usually surveys the sky, a source will be observed at different inclination angles. Each count will therefore be characterized by a different IRF. (See the Instrument response functions page in Confluence. ) |
Owned by: Jim Chiang |
Last updated by: Chuck Patterson 04/01/2011 |