Commit ea7f03e92aaa0af657465c6e0dcf9188de7b90e0
1 parent
e6c67ef2
Add zenith and azimuth angles to CALDB information.
The zenith and azimuth angles are now parameters for csroot2caldb and these parameters are written into the CALDB. The calibration boundaries that existed before in the CALDB have been removed as they are not really useful.
Showing
4 changed files
with
37 additions
and
25 deletions
ChangeLog
| 1 | -2016-09-26 | 1 | +2016-10-04 |
| 2 | 2 | ||
| 3 | * Version 1.2.0 released | 3 | * Version 1.2.0 released |
| 4 | ======================== | 4 | ======================== |
| 5 | 5 | ||
| 6 | + Add zenith and azimuth angle information to IRF caldb (#1853) | ||
| 6 | Fix ctbin segfault bug for varying energy thresholds (#1850) | 7 | Fix ctbin segfault bug for varying energy thresholds (#1850) |
| 7 | Make csresmap enumbins parameter hidden (#1844) | 8 | Make csresmap enumbins parameter hidden (#1844) |
| 8 | Rename ctskymap::map() to ctskymap::skymap() (#1828) | 9 | Rename ctskymap::map() to ctskymap::skymap() (#1828) |
NEWS
| 1 | New Features and Important Changes in ctools 1.2.0 | 1 | New Features and Important Changes in ctools 1.2.0 |
| 2 | 2 | ||
| 3 | -26 September 2016 | 3 | +4 October 2016 |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | Introduction | 6 | Introduction |
| @@ -188,9 +188,12 @@ The class now derives from ctlikelihood (#1828). | @@ -188,9 +188,12 @@ The class now derives from ctlikelihood (#1828). | ||
| 188 | 188 | ||
| 189 | cscripts | 189 | cscripts |
| 190 | -------- | 190 | -------- |
| 191 | -Added the support modules "modutils" and "ioutils" to the cscripts module | ||
| 192 | -and removed the obsolete functions fit(), cterror(), cntmap() and modmap() | ||
| 193 | -from the "obsutils" module (#1830). | 191 | +Added the support modules "modutils" and "ioutils" to the cscripts module and |
| 192 | +removed the obsolete functions fit(), cterror(), cntmap() and modmap() from the | ||
| 193 | +"obsutils" module (#1830). | ||
| 194 | + | ||
| 195 | +The csroot2caldb script now takes the zenith and azimuth angles as parameters | ||
| 196 | +and writes them into the calibration database. | ||
| 194 | 197 | ||
| 195 | 198 | ||
| 196 | Examples | 199 | Examples |
cscripts/csroot2caldb.par
| @@ -23,6 +23,8 @@ inst, s, a, prod3,,, "Instrument name" | @@ -23,6 +23,8 @@ inst, s, a, prod3,,, "Instrument name" | ||
| 23 | id, s, a, South_50h,,, "Instrument Response Function identifier" | 23 | id, s, a, South_50h,,, "Instrument Response Function identifier" |
| 24 | version, s, a, prod3,,, "Instrument Response Function version" | 24 | version, s, a, prod3,,, "Instrument Response Function version" |
| 25 | analysis, s, a, DESY,,, "Instrument Response Function analysis" | 25 | analysis, s, a, DESY,,, "Instrument Response Function analysis" |
| 26 | +zenith, r, a, 20.0,0.0,90.0, "Zenith Angle (deg)" | ||
| 27 | +azimuth, r, a, 0.0,0.0,360.0, "Azimuth Angle (deg)" | ||
| 26 | psftype, s, h, Gauss,Gauss|King,, "Point spread function type" | 28 | psftype, s, h, Gauss,Gauss|King,, "Point spread function type" |
| 27 | split, b, h, no,,, "Split IRF components into different files" | 29 | split, b, h, no,,, "Split IRF components into different files" |
| 28 | norm1d, b, h, no,,, "Normalize on 1D histograms" | 30 | norm1d, b, h, no,,, "Normalize on 1D histograms" |
cscripts/csroot2caldb.py
| @@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
| 21 | import os | 21 | import os |
| 22 | import sys | 22 | import sys |
| 23 | import math | 23 | import math |
| 24 | +import copy | ||
| 24 | from datetime import datetime | 25 | from datetime import datetime |
| 25 | import gammalib | 26 | import gammalib |
| 26 | import ctools | 27 | import ctools |
| @@ -69,6 +70,8 @@ class csroot2caldb(ctools.cscript): | @@ -69,6 +70,8 @@ class csroot2caldb(ctools.cscript): | ||
| 69 | self['inst'].string() | 70 | self['inst'].string() |
| 70 | self['id'].string() | 71 | self['id'].string() |
| 71 | self['analysis'].string() | 72 | self['analysis'].string() |
| 73 | + self['zenith'].real() | ||
| 74 | + self['azimuth'].real() | ||
| 72 | self['version'].string() | 75 | self['version'].string() |
| 73 | self['psftype'].string() | 76 | self['psftype'].string() |
| 74 | self['split'].boolean() | 77 | self['split'].boolean() |
| @@ -102,6 +105,10 @@ class csroot2caldb(ctools.cscript): | @@ -102,6 +105,10 @@ class csroot2caldb(ctools.cscript): | ||
| 102 | cal_version = 'VERSION('+self['version'].string()+')' | 105 | cal_version = 'VERSION('+self['version'].string()+')' |
| 103 | cal_cut = 'CLASS(BEST)' | 106 | cal_cut = 'CLASS(BEST)' |
| 104 | cal_analysis = 'ANALYSIS('+self['analysis'].string()+')' | 107 | cal_analysis = 'ANALYSIS('+self['analysis'].string()+')' |
| 108 | + cal_zenith = 'ZENITH(%.3f)deg' % self['zenith'].real() | ||
| 109 | + cal_azimuth = 'AZIMUTH(%.3f)deg' % self['azimuth'].real() | ||
| 110 | + cal_bounds = [cal_name, cal_version, cal_cut, cal_analysis, \ | ||
| 111 | + cal_zenith, cal_azimuth] | ||
| 105 | 112 | ||
| 106 | # Set IRF information | 113 | # Set IRF information |
| 107 | irf['CAL_TEL'] = 'CTA' | 114 | irf['CAL_TEL'] = 'CTA' |
| @@ -118,19 +125,19 @@ class csroot2caldb(ctools.cscript): | @@ -118,19 +125,19 @@ class csroot2caldb(ctools.cscript): | ||
| 118 | irf['REF_TIME'] = 51544.0 | 125 | irf['REF_TIME'] = 51544.0 |
| 119 | irf['EA_NAME'] = 'EFF_AREA' | 126 | irf['EA_NAME'] = 'EFF_AREA' |
| 120 | irf['EA_DOC'] = 'CAL/GEN/92-019' | 127 | irf['EA_DOC'] = 'CAL/GEN/92-019' |
| 121 | - irf['EA_BOUNDS'] = [cal_name, cal_version, cal_cut, cal_analysis] | 128 | + irf['EA_BOUNDS'] = copy.deepcopy(cal_bounds) |
| 122 | irf['EA_DESC'] = 'CTA effective area' | 129 | irf['EA_DESC'] = 'CTA effective area' |
| 123 | irf['PSF_NAME'] = 'RPSF' | 130 | irf['PSF_NAME'] = 'RPSF' |
| 124 | irf['PSF_DOC'] = 'CAL/GEN/92-020' | 131 | irf['PSF_DOC'] = 'CAL/GEN/92-020' |
| 125 | - irf['PSF_BOUNDS'] = [cal_name, cal_version, cal_cut, cal_analysis] | 132 | + irf['PSF_BOUNDS'] = copy.deepcopy(cal_bounds) |
| 126 | irf['PSF_DESC'] = 'CTA point spread function' | 133 | irf['PSF_DESC'] = 'CTA point spread function' |
| 127 | irf['EDISP_NAME'] = 'EDISP' | 134 | irf['EDISP_NAME'] = 'EDISP' |
| 128 | irf['EDISP_DOC'] = '???' | 135 | irf['EDISP_DOC'] = '???' |
| 129 | - irf['EDISP_BOUNDS'] = [cal_name, cal_version, cal_cut, cal_analysis] | 136 | + irf['EDISP_BOUNDS'] = copy.deepcopy(cal_bounds) |
| 130 | irf['EDISP_DESC'] = 'CTA energy dispersion' | 137 | irf['EDISP_DESC'] = 'CTA energy dispersion' |
| 131 | irf['BGD_NAME'] = 'BGD' | 138 | irf['BGD_NAME'] = 'BGD' |
| 132 | irf['BGD_DOC'] = '???' | 139 | irf['BGD_DOC'] = '???' |
| 133 | - irf['BGD_BOUNDS'] = [cal_name, cal_version, cal_cut, cal_analysis] | 140 | + irf['BGD_BOUNDS'] = copy.deepcopy(cal_bounds) |
| 134 | irf['BGD_DESC'] = 'CTA background' | 141 | irf['BGD_DESC'] = 'CTA background' |
| 135 | 142 | ||
| 136 | # Return metadata | 143 | # Return metadata |
| @@ -590,9 +597,9 @@ class csroot2caldb(ctools.cscript): | @@ -590,9 +597,9 @@ class csroot2caldb(ctools.cscript): | ||
| 590 | ereco.SetBinContent(ieng+1,ioff+1,value) | 597 | ereco.SetBinContent(ieng+1,ioff+1,value) |
| 591 | 598 | ||
| 592 | # Set boundaries (use Ereco boundaries) | 599 | # Set boundaries (use Ereco boundaries) |
| 593 | - bounds = self._make_2D(ereco, ds['HDU_EA'], None, 'm2') | ||
| 594 | - for b in bounds: | ||
| 595 | - irf['EA_BOUNDS'].append(b) | 600 | + #bounds = self._make_2D(ereco, ds['HDU_EA'], None, 'm2') |
| 601 | + #for b in bounds: | ||
| 602 | + # irf['EA_BOUNDS'].append(b) | ||
| 596 | 603 | ||
| 597 | # Write boundary keywords | 604 | # Write boundary keywords |
| 598 | self._set_cif_keywords(ds['HDU_EA'], irf['EA_NAME'], | 605 | self._set_cif_keywords(ds['HDU_EA'], irf['EA_NAME'], |
| @@ -689,9 +696,9 @@ class csroot2caldb(ctools.cscript): | @@ -689,9 +696,9 @@ class csroot2caldb(ctools.cscript): | ||
| 689 | zero.SetBinContent(ieng+1,ioff+1,0.0) | 696 | zero.SetBinContent(ieng+1,ioff+1,0.0) |
| 690 | 697 | ||
| 691 | # Set boundaries | 698 | # Set boundaries |
| 692 | - bounds = self._make_2D(r68, ds['HDU_PSF'], None, 'deg') | ||
| 693 | - for b in bounds: | ||
| 694 | - irf['PSF_BOUNDS'].append(b) | 699 | + #bounds = self._make_2D(r68, ds['HDU_PSF'], None, 'deg') |
| 700 | + #for b in bounds: | ||
| 701 | + # irf['PSF_BOUNDS'].append(b) | ||
| 695 | irf['PSF_BOUNDS'].append('PSF(GAUSS)') | 702 | irf['PSF_BOUNDS'].append('PSF(GAUSS)') |
| 696 | 703 | ||
| 697 | # Write boundary keywords | 704 | # Write boundary keywords |
| @@ -825,9 +832,9 @@ class csroot2caldb(ctools.cscript): | @@ -825,9 +832,9 @@ class csroot2caldb(ctools.cscript): | ||
| 825 | sigma2D.SetBinContent(ieng+1,ioff+1,sigma) | 832 | sigma2D.SetBinContent(ieng+1,ioff+1,sigma) |
| 826 | 833 | ||
| 827 | # Set boundaries | 834 | # Set boundaries |
| 828 | - bounds = self._make_2D(r68, ds['HDU_PSF'], None, 'deg') | ||
| 829 | - for b in bounds: | ||
| 830 | - irf['PSF_BOUNDS'].append(b) | 835 | + #bounds = self._make_2D(r68, ds['HDU_PSF'], None, 'deg') |
| 836 | + #for b in bounds: | ||
| 837 | + # irf['PSF_BOUNDS'].append(b) | ||
| 831 | irf['PSF_BOUNDS'].append('PSF(KING)') | 838 | irf['PSF_BOUNDS'].append('PSF(KING)') |
| 832 | 839 | ||
| 833 | # Write boundary keywords | 840 | # Write boundary keywords |
| @@ -868,9 +875,9 @@ class csroot2caldb(ctools.cscript): | @@ -868,9 +875,9 @@ class csroot2caldb(ctools.cscript): | ||
| 868 | matrix = tfile.Get('EestOverEtrue_offaxis') | 875 | matrix = tfile.Get('EestOverEtrue_offaxis') |
| 869 | 876 | ||
| 870 | # Set boundaries | 877 | # Set boundaries |
| 871 | - bounds = self._make_3D_migra(matrix, ds['HDU_EDISP'], None, '') | ||
| 872 | - for b in bounds: | ||
| 873 | - irf['EDISP_BOUNDS'].append(b) | 878 | + #bounds = self._make_3D_migra(matrix, ds['HDU_EDISP'], None, '') |
| 879 | + #for b in bounds: | ||
| 880 | + # irf['EDISP_BOUNDS'].append(b) | ||
| 874 | 881 | ||
| 875 | # Write boundary keywords | 882 | # Write boundary keywords |
| 876 | self._set_cif_keywords(ds['HDU_EDISP'], irf['EDISP_NAME'], | 883 | self._set_cif_keywords(ds['HDU_EDISP'], irf['EDISP_NAME'], |
| @@ -921,9 +928,9 @@ class csroot2caldb(ctools.cscript): | @@ -921,9 +928,9 @@ class csroot2caldb(ctools.cscript): | ||
| 921 | self._renorm_onaxis(array, array_1D) | 928 | self._renorm_onaxis(array, array_1D) |
| 922 | 929 | ||
| 923 | # Set boundaries | 930 | # Set boundaries |
| 924 | - bounds = self._make_3D(array, ds['HDU_BGD'], None, 'deg') | ||
| 925 | - for b in bounds: | ||
| 926 | - irf['BGD_BOUNDS'].append(b) | 931 | + #bounds = self._make_3D(array, ds['HDU_BGD'], None, 'deg') |
| 932 | + #for b in bounds: | ||
| 933 | + # irf['BGD_BOUNDS'].append(b) | ||
| 927 | 934 | ||
| 928 | # Write boundary keywords | 935 | # Write boundary keywords |
| 929 | self._set_cif_keywords(ds['HDU_BGD'], irf['BGD_NAME'], | 936 | self._set_cif_keywords(ds['HDU_BGD'], irf['BGD_NAME'], |
| @@ -1013,7 +1020,6 @@ class csroot2caldb(ctools.cscript): | @@ -1013,7 +1020,6 @@ class csroot2caldb(ctools.cscript): | ||
| 1013 | # Return | 1020 | # Return |
| 1014 | return | 1021 | return |
| 1015 | 1022 | ||
| 1016 | - | ||
| 1017 | def _renorm_onaxis(self, hist2D, hist1D): | 1023 | def _renorm_onaxis(self, hist2D, hist1D): |
| 1018 | """ | 1024 | """ |
| 1019 | Renormalise 2D histogram (energy,offset) on 1D histogram (energy) | 1025 | Renormalise 2D histogram (energy,offset) on 1D histogram (energy) |