v01r01 updates -- Modifies the package imports. Attempts to import pyfits (in the event that someone is using an older python) and if that fails imports from astropy. v01r00 updates -- include 'apply_edisp' flag in source entries with option to set to true for free souces, except diffuse background components; bug fix to allow for full path to output XML file to be specified with -o option and not have the ds9 region file generation fail; added option to use the naming scheme of make2FGLxml.py, i.e., _3FGLJxxxx.x+xxxx; and default paths and names for Galactic and isotropic diffuse components corrected/updated to pass 8 versions (but it is possible to switch to P7REP versions). make3FGLxml.py functions similarly to make1FGLxml.py and make2FGLxml.py with several new features and improvements. This tool reads in the 3FGL catalog and will output an XML model of the region for use with the Fermi ScienceTools, it will also, by default, produce a ds9-style region file for ease of displaying sources in your model on a counts map. It can be called in a python script as before or run directly from the command line. You can use either the FITS or XML version of the 3FGL catalog. The tool reads the ROI information from the input event file and adds all point and extended sources from the 3FGL catalog within the ROI radius plus an extra radial distance (10 degrees by default) to account for the large PSF (at lower energies) of the LAT. The tool will automatically get the correct spectral form and best-fit parameters for each source. For extended sources, it will find the correct spatial template but you must tell it where the 3FGL extended source templates are on your system; however, you can force all extended sources to be cast as point sources but this should only be done if you are sure that doing so will not affect your analysis. The tool will decide which sources will have free parameters (either all parameters or just normalizations) using the following criteria. --the source must be within a specified radius limit (defaults to ROI radius) and... --the source must have an average significance in the 4 year data set greater than the specified lower limit (default is 5 sigma). Note that when using the XML version of the catalog this becomes a cut on TS, not average significance, so you should adjust the lower limit accordingly. --the source is flagged as significantly variable in the 3FGL catalog if the variability option is set, however... --the source must be within a second radius limit (defaults to ROI radius) different than the first radius limit, this is useful when doing binned analysis where one has to remember that the region will be a square --if the source does not pass the first radius limit and average significance cuts, only the normalization parameter will be set free even if the norms only parameter was not set --the parameters of five sources were kept fixed in the 3FGL catalog analysis, using values from other papers in which detailed fits were done in complicated/crowded regions, these sources are flagged and always kept fixed in the output of make3FGLxml.py, if you decide to let these source parameters be free, do so with caution Make sure the file make3FGLxml.py is executable and in your PATH, and that your default python is either the ScienceTools version. command line usage is: make3FGLxml.py catalog ev --optional_arguments catalog is the path to the FITS or XML version of the 3FGL catalog ev is the path to the event file describing your ROI optional arguments are: -o, name of output xml file, defaults to mymodel.xml if making the ds9 region file, the code simply appends "ROI_" to the XML file name and gives it the proper extension -G, path to Galactic diffuse model FITS file, the default should be such that the user won't need to change this if using the FSSC STs -g, name of Galactic diffuse component in output XML file, if using recommended P7REP model then will not need to be changed -I, path to isotropic diffuse template file, the default should be such that the user won't need to change this if using the FSSC STs -i, name of isotropic diffuse component in output XML file, if using recommended P7REP template then will not need to be changed -N, flag to only have normalization parameters free for sources passing radius, significance, and variability cuts -e, path to directory with extended source templates, need to figure out how to make this the FSSC STs default... -r, radius in degrees from ROI center beyond which sources will be fixed (though they may be freed if allowing variable sources to be free), defaults to selection radius in event file -R, absolutely the maximum radius from ROI center beyond which all source parameters will be fixed, even for variable sources, this avoids issues with binned analysis where the event file has to be larger than the square region you're later going to use, defaults to the -r value. -ER, this is the extra radius beyond the ROI radius out to which sources will be included (sources outside the ROI will be fixed of course), default is 10 degrees, but that may be too much for an analysis above a few GeV (for instance), thus the flexibility -s, this is the average significance below which all source parameters are fixed (if using the 3FGL XML file, this is actually a cut on TS) unless the source is highly variable and you've allowed those to be free (see next option) -v, flag to free the normalizations of variable sources that don't make the -r or -s cuts (but won't free sources that don't make the -R cut), default is True -p, flag to force extended sources to be cast as point sources, default is False -m, flag to make the ds9 region file, default is True -GIF, flag to modify the Galactic diffuse model spectrum by a power law with a free index, default is False -ED, flag to turn on energy dispersion for free sources -wd, directory to write the output ds9 region file to if not the current working directory -ON, flag to use the naming convention of make2FGLxml.py, preceed name with an underscore and remove all spaces -P7, flag to note make a model for use with P7REP data, all this does is change the default diffuse files and names. For the optional arguments that are "flags", the value can be specified from the following choices: True, False, T, F, t, f, TRUE, FALSE, true, false, 1, or 0. For the -N, -p, and -GIF options since the default is False, instead of specifying the value you can just turn the option on, e.g., make3FGLxml.py catalog.fits events.fits -p (the -p bit is enough to tell the code to cast extended sources as point sources, no need to do "-p True" or similar) For calling the functions directly in a python script, the usage is very simliar to make2FGLxml.py but with added options.