NAME

    gtmodel - Creates a model counts map based on a binned likelihood fit.


USAGE

    gtmodel srcmaps srcmdl outfile irfs expcube bexpmap


DESCRIPTION

    This tool is used to facilitate comparisons between the data and
    model predictions. It is recommended to read the gtlike help for
    more explanations. gtmodel creates a model map of a region based
    on the fit parameters. This map is effectively an
    infinite-statistics counts map of the region-of-interest based on
    your model fit. The gtmodel application reads in the fitted model,
    applies the proper scaling to the source maps, and adds them
    together to get the final map. Before running this tool you should
    run gtsrcmaps (see the gtsrcmaps help for more information).


PARAMETERS

    srcmaps [filename]
         FITS file containing the individual source model components
         that have been convolved through the instrument response
         using gtsrcmaps.

    srcmdl [filename]
         XML file containing the source model definitions. This is the
         same source model file used by gtlike (see the gtlike
         help). The source model can be generated by the "ModelEditor"
         utility or by following source model templates (see the
         "ModelEditor" help for further explanation).

    outfile [filename]
         Name of the output FITS file that will contain the generated
         counts map.

    irfs [string]
         Instrument response functions. 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 will
         usually survey the sky, a source will be observed at
         different inclination angles. Each count will therefore be
         characterized by a different instrument response function
         (IRF). The default value is “CALDB”.

     evtype [integer]
   	  The evtype to be used in generating the background data. The
   	  default is INDEF which will use the default in the input
   	  file. This can be overridden by entering the desired event
   	  type e.g. 3 for FRONT + BACK events.

    expcube [filename]
	 FITS file containing livetime as a function of sky position
	 and off-axis angle. This file can be generated by gtltcube or
	 obtained from the FSSC website. See the gtltcube help for
	 further explanation.

    bexpmap [filename]
         Binned exposure map for on-the-fly source map
         calculations. If the existing file is specified, that file
         will be used as the exposure map. Otherwise, a map with that
         name will be computed based on the energy bands in the
         srcmaps file. If "none" is given (default value), the map
         will be called "binned_exposure.fits".

    (convol) [boolean]
	 Perform the convolution of the model maps with the PSF. This
	 is applies only for on-the-fly source map
	 calculations. Default is "yes".

    (resample) [boolean]
	 Flag to indicate that the model counts map that is produced
	 should be resample for convolution. The parameter only apply
	 if gtmodel needs to generate a source map that is not in the
	 file given as the srcmaps parameter. Default is "yes".

    (rfactor) [integer]
	 Resampling factor to be specified if the "resample" parameter
	 is set to "yes". Default is "2".

    (outtype) [string]
         Enables gtmodel to write counts cube (ccube) or summed counts (cmap,
         the default value) maps with geometry and energy planes matching the
         input source file.

     (psfcorr) [boolean]
          Apply psf corrections for point source maps. Default is "yes".

     (phased_expmap) [string]
          Specify the exposure map filename if you want phase-selected exposure
          corrections. Default is "none".

     (edisp_bins) [integer]
         Number of extra bins to compute for energy dispersion purposes.
         Defaults to zero.  Note, any gtlike and pyLikehood analysis with
         edisp_bins > 0 using a source map file or exposure map file that does
         not include the at least as many extra energy bins will abort and give
         you a message explaining that you need to remake the offending file.

    (chatter) [integer]
         This parameter fixes the output verbosity: no screen output (0),
         nominal screen output (2), maximum verbosity (4). Default is "2".

    (clobber) [boolean]
         If true, an existing file of the same name will be overwritten.
         Default is "yes".

    (debug) [boolean]
         Activate debugging mode. Default is "no". When debug is "no",
         all exceptions that are not caught and handled by individual
         tool-specific code are caught by a top-level exception
         handler that displays information about the exception and
         then exits. When debug is "yes", such exceptions are not
         caught by the top level code. Instead the tool produces a
         segmentation violation, which is more useful for
         debugging. When debugging mode is enabled, the tool produces
         more verbose output describing any errors or exceptions that
         are encountered.

    (gui) [boolean]
         Graphical User Interface (GUI) mode is activated if set to
         "yes".  Default is "no".

    (mode) [string]
         Mode of automatic parameters: "h" for batch, "ql" for
         interactive.  Default is "ql".


EXAMPLES

    Parameters are passed following the FTOOLs model: They could be
    passed answering from a prompt, as a list in a command line, or by
    editing the parameter file.

    To run gtmodel simply type in the command line:

    > gtmodel

    The parameter values have to be provided. Not all parameter are
    prompted: some of them are "hidden". To change one of the "hidden"
    parameter, the user should specify the values in the command line
    or modify its mode by editing the parameter file. For example, to
    avoid overwriting the outfile, the following command line has to
    be typed:

    > gtmodel clobber=no

    An example of how to run the tool is given below:

    > gtmodel
    Source maps (or counts map) file[]  srcMaps.fits
    Source model file[] src_model.xml
    Output file[] model_map.fits
    Response functions[CALDB]
    Exposure cube[] expCube.fits
    Binned exposure map[none] bexposure.fits

    That last example could be also run in the command line as follows:

    > gtmodel srcmaps=srcMaps.fits srcmdl=src_model.xml outfile=model_map.fits
     irfs=CALDB expcube=expCube.fits bexpmap=bexposure.fits


SEE ALSO

    gtlike

    gtsrcmaps

    gtltcube
