Commit de021e7961228254d91c44a6b252f3206ab0fef3

Authored by Jürgen Knödlseder
1 parent fa36033b

Add units to CTA event list columns (fixes #1616).

ChangeLog
1   -2016-01-05 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
  1 +2016-01-13 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2  
3 3 * Bug fix version 1.0.1 released
4 4 ================================
5 5  
  6 + Add units to CTA event list columns (#1616)
6 7 Allow usage of numbers in FITS extension names (#1611)
7 8 Solve compatibility issues with Anaconda on Mac OS X (#1607)
8 9  
... ...
... ... @@ -2,7 +2,7 @@ New Features and Important Changes in GammaLib 1.0.1
2 2  
3 3 Author(s) : Juergen Knoedlseder
4 4  
5   -5 January 2016
  5 +13 January 2016
6 6  
7 7  
8 8 1. Introduction
... ... @@ -108,7 +108,7 @@ None
108 108  
109 109 20. CTA interface
110 110 -----------------
111   -None
  111 +Add table column units to the CTA event list columns (fixes #1616).
112 112  
113 113  
114 114 21. COMPTEL interface
... ...
1 1 GammaLib information
2 2 ====================
3   -Version: 1.0.1 (5 January 2016)
  3 +Version: 1.0.1 (13 January 2016)
4 4 Author: Juergen Knoedlseder (jurgen.knodlseder@irap.omp.eu)
5 5  
6 6  
... ...
inst/cta/src/GCTAEventList.cpp
1 1 /***************************************************************************
2 2 * GCTAEventList.cpp - CTA event atom container class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -797,6 +797,13 @@ void GCTAEventList::write_events(GFitsBinTable&amp; hdu) const
797 797 GFitsTableFloatCol col_dec = GFitsTableFloatCol("DEC", size());
798 798 GFitsTableFloatCol col_energy = GFitsTableFloatCol("ENERGY", size());
799 799  
  800 + // Set units of columns
  801 + // (see http://fits.gsfc.nasa.gov/standard30/fits_standard30aa.pdf)
  802 + col_time.unit("s");
  803 + col_ra.unit("deg");
  804 + col_dec.unit("deg");
  805 + col_energy.unit("TeV");
  806 +
800 807 // Fill mandatory columns
801 808 for (int i = 0; i < size(); ++i) {
802 809 col_eid(i) = m_events[i].m_event_id;
... ... @@ -815,23 +822,42 @@ void GCTAEventList::write_events(GFitsBinTable&amp; hdu) const
815 822  
816 823 // If available, add detector coordinates in degrees
817 824 if (m_has_detxy) {
  825 +
  826 + // Allocate columns
818 827 GFitsTableFloatCol col_detx = GFitsTableFloatCol("DETX", size());
819 828 GFitsTableFloatCol col_dety = GFitsTableFloatCol("DETY", size());
  829 +
  830 + // Set units of columns
  831 + // (see http://fits.gsfc.nasa.gov/standard30/fits_standard30aa.pdf)
  832 + col_detx.unit("deg");
  833 + col_dety.unit("deg");
  834 +
  835 + // Fill columns
820 836 for (int i = 0; i < size(); ++i) {
821 837 col_detx(i) = m_events[i].dir().detx() * gammalib::rad2deg;
822 838 col_dety(i) = m_events[i].dir().dety() * gammalib::rad2deg;
823 839 }
  840 +
  841 + // Append columns to table
824 842 hdu.append(col_detx);
825 843 hdu.append(col_dety);
  844 +
826 845 }
827 846  
828 847 // If available, add event phase
829 848 if (m_has_phase) {
  849 +
  850 + // Allocate columns
830 851 GFitsTableFloatCol col_phase = GFitsTableFloatCol("PHASE", size());
  852 +
  853 + // Fill columns
831 854 for (int i = 0; i < size(); ++i) {
832 855 col_phase(i) = m_events[i].m_phase;
833 856 }
  857 +
  858 + // Append columns to table
834 859 hdu.append(col_phase);
  860 +
835 861 }
836 862  
837 863 // Append other columns to table
... ...