Skip to content

Latest commit

 

History

History
102 lines (83 loc) · 3.12 KB

README.md

File metadata and controls

102 lines (83 loc) · 3.12 KB

FermiLATGRBXMLTools

This module contains a collection of methods to manipulate the xml file containing the list of Fermi-LAT detected GRBs. The public Fermi-LAT GRB table can be viewed here:

http://fermi.gsfc.nasa.gov/ssc/observations/types/grbs/lat_grbs/

The associated xml file containing data from the table in a machine readable format can be downloaded here:

http://slac.stanford.edu/~glast/LATBA/PublicTableGRBs.xml

The new FermiLATGRBXMLTools python module allows uses to parse and extract information from this xml file.

Usage Examples:

import the module in ipython

    import FermiLATGRBXMLTools

Read in the xml file

    xml = FermiLATGRBXMLTools.xml('PublicTableGRBs.xml')

Convert the xml file into a space-delimited text file

    xml.xml2txt()

Return data for all GRBs in a single dictionary of numpy arrays

    Data = xml.ExtractData()

List all available data for all Fermi-LAT detected GRBs

    Data = xml.ExtractData()
    Data.keys()

List the names of all Fermi-LAT detected GRBs

    Data = xml.ExtractData()
    Data['GRBNAME']

List the best available position of all Fermi-LAT detected GRBs

    Data = xml.ExtractData()
    RA = Data['RA']
    DEC = Data['DEC']

Return data for all GRBs in a single dictionary of individual GRB objects

    GRBs = xml.ExtractGRBs()

Extract the location of an individial GRB

    GRBs = xml.ExtractGRBs()
    GRB = GRBs['130427324']
    print GRB.RA, GRB.DEC

Additional Examples:

Plot a histogram of the significance of the LAT detections (TS)

    import matplotlib.pyplot as plt
    import FermiLATGRBXMLTools
    xml = FermiLATGRBXMLTools.xml('PublicTableGRBs.xml')
    Data = xml.ExtractData()                               
    TS = Data['TS']                                    
    logTS = np.log10(TS)                                   
    logTS = logTS[np.isfinite(logTS)]                      
    plt.hist(logTS, bins=15                                
    plt.xlabel('log TS')                                   
    plt.ylabel('Number')                                   
    plt.show()

Plotting the sky distribution of Fermi-LAT detected GRBs

    import numpy as np                                     
    import matplotlib.pyplot as plt                        
    import FermiLATGRBXMLTools                             
    xml = FermiLATGRBXMLTools.xml('PublicTableGRBs.xml')
    Data = xml.ExtractData()                               
    RA = Data['RA']                                        
    Dec = Data['Dec']                                  
    fig = plt.figure(figsize=(10, 5))                          
    ax = fig.add_subplot(111, projection="mollweide", axisbg ='white')         
    ax.grid(True)                                      
    x = np.remainder(RA+360,360)                           
    ind = x>180                                    
    x[ind] -= 360                                  
    x=-x                                           
    ax.scatter(np.radians(x),np.radians(Dec))                      
    plt.show()