Skip to content

Commit

Permalink
add AEFF2D example file
Browse files Browse the repository at this point in the history
  • Loading branch information
joleroi committed Jan 15, 2016
1 parent f16d88c commit abeee47
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
Binary file added source/irfs/effective_area/aeff_2d_example.fits
Binary file not shown.
39 changes: 39 additions & 0 deletions source/irfs/effective_area/create_example_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""This script generates an example effective area
It complies to the specifications at http://gamma-astro-data-formats.readthedocs.org/en/latest/irfs/effective_area/index.html
"""

from astropy.io import fits
from astropy.table import Table
import numpy as np

e_bins = 20
o_bins = 5
e_axis = np.logspace(-1,2,e_bins+1)
o_axis = np.linspace(0,3,o_bins+1)
effarea = np.ones([e_bins, o_bins]) * 3e5

table = Table([[e_axis[:-1]],[e_axis[1:]],
[o_axis[:-1]],[o_axis[1:]],
[effarea]],
names=('ENERG_LO', 'ENERG_HI',
'THETA_LO', 'THETA_HI',
'EFFAREA'))

data = table.as_array()
header = fits.Header()
header['OBS_ID'] = 31415 , 'Observation ID'
header['LO_THRES'] = 0.1 , 'Low energy threshold [TeV]'
header['HI_THRES'] = 50 , 'High energy threshold [TeV]'
header['RAD_MAX'] = 0.1, 'On region radius for point-like observations'

tbhdu = fits.BinTableHDU(data, header, name='EFFECTIVE AREA')

for colname in table.colnames:
tbhdu.columns[colname].unit = str(table[colname].unit)

prihdu = fits.PrimaryHDU()

thdulist = fits.HDUList([prihdu, tbhdu])
thdulist.writeto('aeff_2d_example.fits', clobber=True)

2 changes: 2 additions & 0 deletions source/irfs/effective_area/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Columns:

Header keywords:

* ``OBS_ID`` type: int
* Observation ID, run number
* ``LO_THRES`` type: float, unit: TeV
* Low energy threshold
* ``HI_THRES`` type: float, unit: TeV
Expand Down

0 comments on commit abeee47

Please sign in to comment.