gbmeometry is a module with routines for handling GBM geometry. It performs a few tasks:
In [1]:
%pylab inline
from astropy.coordinates import SkyCoord
import astropy.coordinates as coord
import astropy.units as u
from gbmgeometry import *
In [6]:
data = GetGBMData("080916009")
data.set_destination("") # You can enter a folder here. If you want the CWD, you do not have to set
data.get_trigdat()
By default, GetGBMData will grad data from all detectors. However, one can set a subset to retrieve different data types
In [7]:
data.select_detectors('n1','n2','b0')
data.get_rsp_cspec()
In [2]:
interp = PositionInterpolator(trigdat="glg_trigdat_all_bn080916009_v02.fit")
In [3]:
# In trigger times
print "Quaternions"
print interp.quaternion(0)
print interp.quaternion(10)
print
print "SC XYZ"
print interp.sc_pos(0)
print interp.sc_pos(10)
In [4]:
na = NaIA(interp.quaternion(0))
print na.get_center()
print na.get_center().icrs #J2000
print na.get_center().galactic # Galactic
print
print "Changing in time"
na.set_quaternion(interp.quaternion(100))
print na.get_center()
print na.get_center().icrs #J2000
print na.get_center().galactic # Galactic
In [5]:
center_j2000 = na.get_center().icrs
center_j2000
Out[5]:
In [6]:
center_j2000.transform_to(GBMFrame(quaternion=interp.quaternion(100.)))
Out[6]:
In [7]:
na = NaIA(interp.quaternion(0),interp.sc_pos(0)*u.km)
na.get_center()
Out[7]:
In [8]:
myGBM = GBM(interp.quaternion(0),sc_pos=interp.sc_pos(0)*u.km)
myGBM.get_centers()
Out[8]:
In [9]:
[x.icrs for x in myGBM.get_centers()]
Out[9]:
In [10]:
myGBM.detector_plot(radius=60)
In [11]:
myGBM.detector_plot(radius=10,projection='ortho',lon_0=40)
myGBM.detector_plot(radius=10,projection='ortho',lon_0=0,lat_0=40,fignum=2)
In [12]:
myGBM.detector_plot(radius=60,fermi_frame=True)
In [13]:
myGBM.detector_plot(radius=10,projection='ortho',lon_0=20,fermi_frame=True)
myGBM.detector_plot(radius=10,projection='ortho',lon_0=200,fermi_frame=True,fignum=3)
myGBM.detector_plot(radius=10,projection='ortho',lon_0=0,lat_0=40,fignum=2,fermi_frame=True)
In [14]:
grb = SkyCoord(ra=130.,dec=-45 ,frame='icrs', unit='deg')
myGBM.detector_plot(radius=60,
projection='moll',
good=True, # only plot NaIs that see the GRB
point=grb,
lon_0=110,lat_0=-0)
myGBM.detector_plot(radius=60,
projection='ortho',
good=True, # only plot NaIs that see the GRB
point=grb,
lon_0=180,lat_0=-40,fignum=2)
In [20]:
myGBM.detector_plot(radius=10,show_earth=True,lon_0=90)
In [16]:
myGBM.detector_plot(radius=10,lon_0=100,show_earth=True,projection='ortho')
In [17]:
myGBM.detector_plot(radius=10,show_earth=True,lon_0=120,lat_0=-30,fermi_frame=True,projection='ortho')
In [14]:
seps = myGBM.get_separation(grb)
seps.sort("Separation")
seps
Out[14]:
In [13]:
get_legal_pairs()