Difference between revisions of "Fermi-LAT"
Line 55: | Line 55: | ||
== Fermi-LAT analysis with the pipeline scripts == | == Fermi-LAT analysis with the pipeline scripts == | ||
The scripts available at $FERMITOOLS are written to perform a standard analysis on a point source, i.e. a blazar. Please note that these analysis scripts might not provide correct results if you are analysing energies below 100 MeV. The scripts have only been tested for blazar analyses.<br/> | The scripts available at $FERMITOOLS are written to perform a standard analysis on a point source, i.e. a blazar. Please note that these analysis scripts might not provide correct results if you are analysing energies below 100 MeV. The scripts have only been tested for blazar analyses.<br/> | ||
− | |||
=== Creating a spectrum === | === Creating a spectrum === | ||
+ | If you are interested in the gamma-ray spectrum of a source, the corresponding script is called ''make_spectrum.sl'' and can be called via | ||
+ | <pre> | ||
+ | $FERMITOOLS/make_spectrum.sl SOURCENAME TMIN TMAX | ||
+ | </pre> | ||
+ | As you can see, the script needs at least three arguments, the name of the source, and both a start time and an end time, for which an average gamma-ray spectrum should be computed. There are several options you can choose from regarding the specifics of the analysis, which you can call via '''$FERMITOOLS/make_spectrum.sl --help'''. | ||
+ | The full help output looks like this: | ||
+ | <pre> | ||
+ | $FERMITOOLS/make_spectrum.sl --help | ||
+ | ** General script to compute Fermi spectra ** | ||
+ | [Make sure you have loaded the Fermitools and Fermipy (see README file/wiki entry)] | ||
+ | Usage: make_spectrum.sl [options] [src] [tmin] [tmax] | ||
+ | Mandatory inputs: | ||
+ | src: Name of source without any blanks, either a 4FGL name or a different name if corresponding catalog is defined in options | ||
+ | tmin: in MJD, start of time range for which SED will be computed | ||
+ | tmax: in MJD, nd of time range | ||
+ | |||
+ | Options for analysis: | ||
+ | --known=yes/no Is source a known Fermi source (in the 4FGL)? Important to set correctly, otherwise | ||
+ | the analysis will fail! Default: YES | ||
+ | |||
+ | --ra=degrees RAJ2000 position of source, only needed if source is NOT in 4FGL and no other | ||
+ | alternative catalog is provided with the '--cat option'! | ||
+ | |||
+ | --dec=degrees DEJ2000 position of source, only needed if source is NOT in 4FGL and no other | ||
+ | alternative catalog is provided with the '--cat option'! | ||
+ | |||
+ | --cat=catalog.fits Catalog to query for source coordinates, must have columns named Source_Name, | ||
+ | RAJ2000, and DEJ2000 for name and coordinates. If '--ra' and '--dec' are also given, | ||
+ | the coordinates from the catalog will be ignored. Default: 4FGL | ||
+ | |||
+ | --roi=degrees Size of ROI in degrees. Default: 10 [deg] | ||
+ | |||
+ | --emin=energy Minimum energy in MeV. Default: 100 [MeV] | ||
+ | |||
+ | --emax=energy Maximum energy in MeV. Default: 300000 [MeV] | ||
+ | |||
+ | --ebin=number number of energy bins per energy decade. Default: 10 | ||
+ | |||
+ | Options for setup: | ||
+ | --expath=path Path where analysis should be saved. Default: location where script is started | ||
+ | |||
+ | </pre> | ||
=== Creating a light curve === | === Creating a light curve === |
Revision as of 21:46, 15 May 2021
The Fermi Large Area Telescope (LAT) observes the gamma-ray sky from 20 MeV up to 1 TeV. It does so by scanning the entire sky three times a day, hence, there is gamma-ray data available for each day for every position on the sky. For more information on the spacecraft, please check out the official Fermi webpage at https://fermi.gsfc.nasa.gov.
Before you use the script, make sure you know what you're doing. If you are analysing gamma-ray data for the first time, please read the online documentation at https://fermi.gsfc.nasa.gov/ssc/data/analysis/LAT_essentials.html. Because the Fermi-LAT data can be accessed by everyone for free, there is an extensive documentation available online.
Installation & preparation
To analyse data from Fermi-LAT, the Fermitools are needed. Additionally, there is a python package, called fermipy, such that one can do the data analysis from within a python environment. There are analysis scripts, written with fermipy, available to create either a spectrum or a light curve. Those are globally available at $FERMITOOLS, which links to /software/Science/satscripts/fermiscripts.
To run those scripts, it is necessary to have both the Fermitools and fermipy installed, ideally in a conda environment. There are two options for the user to do so: calling a currently existing conda environment, or creating the corresponding conda environment yourself. The first version is, at the current moment, the recommended choice, also because the pipeline scripts are written for python 2.7, while for the latter one needs to make sure the correct versions of the Fermitools and fermipy are installed.
Option 1 - Using the existing conda environment (Fermitools 1.2.23 & fermipy version 0.20.0)
The pipeline scripts for a standard Fermi-LAT analysis (spectrum or light curve) are optimized to run with the version of this conda environment. In order to envoke it, it is necessary to source the conda installation, where the environment for a Fermi-LAT analysis has been created, before activating the environment. In order to simplify this, you can copy the following in your .cshrc file.
#!/bin/tcsh source /userdata/data/gokus/conda/miniconda2/etc/profile.d/conda.csh alias fermipy "conda activate fermipy"
If you already have your own conda installation, which you regularly use, make sure that you create an alias instead of sourcing that conda installtion by default! In case you're using a bash shell, the addition in your .bashrc file should look something like this:
#!/bin/bash alias fermipy='conda activate /userdata/data/gokus/conda/miniconda2/envs/fermipy'
Using the command fermipy, you can now change into the conda environment, in which the necessary tools for using the pipeline scripts are installed. Now you're ready to do some Science!
Option 2 - Installing and creating a conda environment yourself
Both the Fermitools and fermipy are managed via GitHub and the full code, documentation and installation can be found at
Fermitools: https://github.com/fermi-lat/Fermitools-conda
fermipy: https://github.com/fermiPy/fermipy (Github), https://fermipy.readthedocs.io/en/latest/ (Documentation)
Please make sure you are installing the right versions of each (as in between versions there was a change in the use of python2.7 and python3). It is recommended to read the full installation instructions provided in the documentations.
The LAT data
The data downlinked from the Fermi satellite contains information about the events/photons measured by the LAT, and information about status of the spacecraft itself at each time. Those information are needed for an analysis, as they are the main input. These files are called photon and spacecraft files. One can acquire the data needed for a specific analysis via the online data query at https://fermi.gsfc.nasa.gov/cgi-bin/ssc/LAT/LATDataQuery.cgi, or download weekly data products for the entire sky from https://fermi.gsfc.nasa.gov/ssc/data/access/.
However, all data acquired by Fermi-LAT during its mission are also stored at the servers of the observatory, hence, it is not necessary to download a specific dataset. If you are using the provided analysis scripts, it automatically looks through all the data that is available at the observatory.
All photon files are linked at /satdata/X-ray/Fermi/photon_ft1_files.list, while all of the spacecraft data is merged in /satdata/X-ray/Fermi/spacecraft_ft2_files.fits.
In the early steps of your analysis, a region of interest (ROI) around your desired source or source coordinates will be created, which contains all the sources that are included in the 10-year Fourth Point Source Catalog (4FGL). In addition, extended sources, which are mostly present in the galactic plane and the magellanic clouds (e.g. features of the LMC, the Centaurus A lobes, supernova remnants), can be part of that ROI, too. In order to run the pipeline scripts properly, two environment variables need to be added to your .cshrc file:
#!/bin/tcsh setenv FERMI_DIR /satdata/X-ray/Fermi/catalogs setenv LATEXTDIR $FERMI_DIR/4FGL_extended_sources
Alternatively for the bash shell, add the following to your .bashrc file:
#!/bin/bash export FERMI_DIR=/satdata/X-ray/Fermi/catalogs/ export LATEXTDIR=$FERMI_DIR/4FGL_extended_sources
In the $FERMI_DIR, you can find the current catalog as well as the templates for all extended sources.
In addition, the LAT background models, needed to model the galactic and isotropic diffuse emission, can be found at /satdata/X-ray/Fermi/LAT_background_models. Those are provided and regularly updated by the Fermi-LAT collaboration and help to improve your analysis results, as background, especially at lower energies (< 1 GeV), can have quite an impact on your results.
Fermi-LAT analysis with the pipeline scripts
The scripts available at $FERMITOOLS are written to perform a standard analysis on a point source, i.e. a blazar. Please note that these analysis scripts might not provide correct results if you are analysing energies below 100 MeV. The scripts have only been tested for blazar analyses.
Creating a spectrum
If you are interested in the gamma-ray spectrum of a source, the corresponding script is called make_spectrum.sl and can be called via
$FERMITOOLS/make_spectrum.sl SOURCENAME TMIN TMAX
As you can see, the script needs at least three arguments, the name of the source, and both a start time and an end time, for which an average gamma-ray spectrum should be computed. There are several options you can choose from regarding the specifics of the analysis, which you can call via $FERMITOOLS/make_spectrum.sl --help. The full help output looks like this:
$FERMITOOLS/make_spectrum.sl --help ** General script to compute Fermi spectra ** [Make sure you have loaded the Fermitools and Fermipy (see README file/wiki entry)] Usage: make_spectrum.sl [options] [src] [tmin] [tmax] Mandatory inputs: src: Name of source without any blanks, either a 4FGL name or a different name if corresponding catalog is defined in options tmin: in MJD, start of time range for which SED will be computed tmax: in MJD, nd of time range Options for analysis: --known=yes/no Is source a known Fermi source (in the 4FGL)? Important to set correctly, otherwise the analysis will fail! Default: YES --ra=degrees RAJ2000 position of source, only needed if source is NOT in 4FGL and no other alternative catalog is provided with the '--cat option'! --dec=degrees DEJ2000 position of source, only needed if source is NOT in 4FGL and no other alternative catalog is provided with the '--cat option'! --cat=catalog.fits Catalog to query for source coordinates, must have columns named Source_Name, RAJ2000, and DEJ2000 for name and coordinates. If '--ra' and '--dec' are also given, the coordinates from the catalog will be ignored. Default: 4FGL --roi=degrees Size of ROI in degrees. Default: 10 [deg] --emin=energy Minimum energy in MeV. Default: 100 [MeV] --emax=energy Maximum energy in MeV. Default: 300000 [MeV] --ebin=number number of energy bins per energy decade. Default: 10 Options for setup: --expath=path Path where analysis should be saved. Default: location where script is started
Creating a light curve
Performing Fermi-LAT analysis using slurm
Troubleshooting
Contact person
The scripts and this wiki entry has been written by Andrea Gokus. She is also currently the maintainer of the LAT dataset on the Remeis server. In case of any further questions or problems, please contact her via andrea.gokus[at]fau.de.
Last status update on this wiki page: Mai 16, 2021