Commit f048c13b3916d7f939e141b10de112206dea1cc4
1 parent
c99698b4
Add support for power-law binning to several tools (#2881)
Showing
38 changed files
with
287 additions
and
222 deletions
ChangeLog
| 1 | -2020-04-08 | |
| 1 | +2020-07-02 | |
| 2 | 2 | |
| 3 | 3 | * Version 1.7.0 released |
| 4 | 4 | ======================== |
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | Add csscs script for spectral component separation (#2961) |
| 13 | 13 | Add support for Castro plots to csspec (#2938) |
| 14 | 14 | Enabling running of example scripts from objects in memory (#2925) |
| 15 | + Add support for power-law binning to several tools (#2881) | |
| 15 | 16 | Allow using spectral models without "Prefactor" parameter in cssens |
| 16 | 17 | and cstsdist (#1889) |
| 17 | 18 | ... | ... |
NEWS
| 1 | 1 | New Features and Important Changes in ctools 1.7.0 |
| 2 | 2 | |
| 3 | -8 April 2020 | |
| 3 | +2 July 2020 | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | Introduction |
| ... | ... | @@ -41,7 +41,7 @@ be called for that. And the header is only written once in the log file (#3066). |
| 41 | 41 | |
| 42 | 42 | ctbin - CTA event binning |
| 43 | 43 | ------------------------- |
| 44 | -None | |
| 44 | +Add ebingamma parameter and support for POW binning (#2881). | |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | ctbkgcube - CTA background cube generation |
| ... | ... | @@ -61,7 +61,7 @@ None |
| 61 | 61 | |
| 62 | 62 | ctedispcube - CTA energy dispersion cube generation |
| 63 | 63 | --------------------------------------------------- |
| 64 | -None | |
| 64 | +Add ebingamma parameter and support for POW binning (#2881). | |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | cterror - Likelihood profile error computation |
| ... | ... | @@ -71,7 +71,7 @@ None |
| 71 | 71 | |
| 72 | 72 | ctexpcube - CTA exposure cube generation |
| 73 | 73 | ---------------------------------------- |
| 74 | -None | |
| 74 | +Add ebingamma parameter and support for POW binning (#2881). | |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | ctfindvar - Variability search |
| ... | ... | @@ -86,12 +86,12 @@ None |
| 86 | 86 | |
| 87 | 87 | ctmapcube - CTA map cube generation |
| 88 | 88 | ----------------------------------- |
| 89 | -None | |
| 89 | +Add ebingamma parameter and support for POW binning (#2881). | |
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | ctmodel - CTA counts cube modelling |
| 93 | 93 | ----------------------------------- |
| 94 | -None | |
| 94 | +Add ebingamma parameter and support for POW binning (#2881). | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | ctobssim - CTA observation simulation |
| ... | ... | @@ -111,7 +111,7 @@ None |
| 111 | 111 | |
| 112 | 112 | ctpsfcube - CTA point spread function cube generation |
| 113 | 113 | ----------------------------------------------------- |
| 114 | -None | |
| 114 | +Add ebingamma parameter and support for POW binning (#2881). | |
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | ctselect - CTA event selection |
| ... | ... | @@ -235,6 +235,8 @@ parameter after setting the map with csphagen.exclusion_map() you should first |
| 235 | 235 | call csphagen.exclusion_map(object=gammalib.GSkyRegionMap()). This makes the |
| 236 | 236 | map empty and csphagen then checks the "inexclusion" "parameter (#2925). |
| 237 | 237 | |
| 238 | +Add ebingamma parameter and support for POW binning (#2881). | |
| 239 | + | |
| 238 | 240 | |
| 239 | 241 | csphasecrv - Generate phase curve |
| 240 | 242 | --------------------------------- |
| ... | ... | @@ -248,12 +250,12 @@ None |
| 248 | 250 | |
| 249 | 251 | csresmap - Generate residual map |
| 250 | 252 | -------------------------------- |
| 251 | -None | |
| 253 | +Add ebingamma parameter and support for POW binning (#2881). | |
| 252 | 254 | |
| 253 | 255 | |
| 254 | 256 | csresspec - Generate residual spectrum |
| 255 | 257 | -------------------------------------- |
| 256 | -None | |
| 258 | +Add ebingamma parameter and support for POW binning (#2881). | |
| 257 | 259 | |
| 258 | 260 | |
| 259 | 261 | csroot2caldb - Generates calibration database from ROOT file |
| ... | ... | @@ -279,6 +281,8 @@ csspec - Generates Spectral Energy Distribution |
| 279 | 281 | Support to generate Castro plots was added and the relevant information is |
| 280 | 282 | now sorted in the output FITS file (#2938). |
| 281 | 283 | |
| 284 | +Add ebingamma parameter and support for POW binning (#2881). | |
| 285 | + | |
| 282 | 286 | |
| 283 | 287 | cssrcdetect - Detects sources in sky map |
| 284 | 288 | ---------------------------------------- | ... | ... |
cscripts/csiactobs.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Generates an IACT observation definition XML file |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2015-2018 Michael Mayer | |
| 5 | +# Copyright (C) 2015-2020 Michael Mayer | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -316,7 +316,7 @@ class csiactobs(ctools.cscript): |
| 316 | 316 | # Create logarithmic energy nodes |
| 317 | 317 | bounds = gammalib.GEbounds(self._bkgpars, |
| 318 | 318 | gammalib.GEnergy(emin,'TeV'), |
| 319 | - gammalib.GEnergy(emax,'TeV'), True) | |
| 319 | + gammalib.GEnergy(emax,'TeV')) | |
| 320 | 320 | |
| 321 | 321 | # Loop over bounds and set intensity value |
| 322 | 322 | for i in range(bounds.size()): | ... | ... |
cscripts/csphagen.par
| ... | ... | @@ -29,11 +29,12 @@ prefix, s, h, onoff,,, "Prefix for output files" |
| 29 | 29 | # |
| 30 | 30 | # Script parameters |
| 31 | 31 | #================== |
| 32 | -ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins" | |
| 32 | +ebinalg, s, a, LOG,FILE|LIN|LOG|POW,, "Algorithm for defining energy bins" | |
| 33 | 33 | emin, r, a, 0.1,,, "Start value for first energy bin in TeV" |
| 34 | 34 | emax, r, a, 100.0,,, "Stop value for last energy bin in TeV" |
| 35 | 35 | enumbins, i, a, 120,,, "Number of energy bins" |
| 36 | 36 | ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" |
| 37 | +ebingamma, r, a, 1.0,,, "Exponent for POW energy node definition" | |
| 37 | 38 | srcshape, s, h, CIRCLE,CIRCLE,, "Shape of the source region" |
| 38 | 39 | coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)" |
| 39 | 40 | ra, r, a, 83.63,0,360, "Right Ascension of source region centre (deg)" | ... | ... |
cscripts/csresmap.par
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | #============================ |
| 19 | 19 | inobs, f, a, events.fits,,, "Input event list, counts cube, or observation definition XML file" |
| 20 | 20 | inmodel, f, a, $CTOOLS/share/models/crab.xml,,, "Input model definition XML file" |
| 21 | -modcube, f, a, NONE,,, "Input model cube file (generated with ctmodel)" | |
| 21 | +modcube, f, a, NONE,,, "Input model cube file (generated with ctmodel)" | |
| 22 | 22 | expcube, f, a, NONE,,, "Input exposure cube file" |
| 23 | 23 | psfcube, f, a, NONE,,, "Input PSF cube file" |
| 24 | 24 | edispcube, f, a, NONE,,, "Input energy dispersion cube file" |
| ... | ... | @@ -31,11 +31,12 @@ outmap, f, a, resmap.fits,,, "Output residual map file" |
| 31 | 31 | # |
| 32 | 32 | # Script parameters |
| 33 | 33 | #================== |
| 34 | -ebinalg, s, h, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins" | |
| 34 | +ebinalg, s, h, LOG,FILE|LIN|LOG|POW,, "Algorithm for defining energy bins" | |
| 35 | 35 | emin, r, a, 0.1,,, "Lower energy limit (TeV)" |
| 36 | 36 | emax, r, a, 100.0,,, "Upper energy limit (TeV)" |
| 37 | 37 | enumbins, i, h, 20,,, "Number of model cube energy bins" |
| 38 | -ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" | |
| 38 | +ebinfile, f, h, NONE,,, "Name of the file containing the energy bin definition" | |
| 39 | +ebingamma, r, h, 1.0,,, "Exponent for POW energy node definition" | |
| 39 | 40 | coordsys, s, a, CEL,CEL|GAL,, "Coordinate System" |
| 40 | 41 | proj, s, a, CAR,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method" |
| 41 | 42 | xref, r, a, 83.63,0,360, "First coordinate of image center in degrees (RA or galactic l)" | ... | ... |
cscripts/csresmap.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Generates a residual map. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2014-2019 Michael Mayer | |
| 5 | +# Copyright (C) 2014-2020 Michael Mayer | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -111,6 +111,8 @@ class csresmap(ctools.csobservation): |
| 111 | 111 | self['emin'].real() |
| 112 | 112 | self['emax'].real() |
| 113 | 113 | self['enumbins'].integer() |
| 114 | + if self['ebinalg'].string() == 'POW': | |
| 115 | + self['ebingamma'].real() | |
| 114 | 116 | |
| 115 | 117 | # Query parameters |
| 116 | 118 | self['edisp'].boolean() | ... | ... |
cscripts/csresspec.par
| ... | ... | @@ -33,11 +33,12 @@ outfile, f, a, resspec.fits,,, "Output residual spectrum file" |
| 33 | 33 | #================== |
| 34 | 34 | statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" |
| 35 | 35 | components,b, h, no,,, "Calculate model for individual components?" |
| 36 | -ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins" | |
| 36 | +ebinalg, s, a, LOG,FILE|LIN|LOG|POW,, "Algorithm for defining energy bins" | |
| 37 | 37 | emin, r, a, 0.1,,, "Start value for first energy bin in TeV" |
| 38 | 38 | emax, r, a, 100.0,,, "Stop value for last energy bin in TeV" |
| 39 | 39 | enumbins, i, a, 20,1,200, "Number of energy bins" |
| 40 | 40 | ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" |
| 41 | +ebingamma, r, a, 1.0,,, "Exponent for POW energy node definition" | |
| 41 | 42 | stack, b, a, no,,, "Stack observations?" |
| 42 | 43 | coordsys, s, a, CEL,CEL|GAL,, "Coordinate System" |
| 43 | 44 | proj, s, a, CAR,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method" | ... | ... |
cscripts/csresspec.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Generates a residual spectrum. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2017-2019 Luigi Tibaldo | |
| 5 | +# Copyright (C) 2017-2020 Luigi Tibaldo | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -95,6 +95,8 @@ class csresspec(ctools.csobservation): |
| 95 | 95 | self['emin'].real() |
| 96 | 96 | self['emax'].real() |
| 97 | 97 | self['enumbins'].integer() |
| 98 | + if self['ebinalg'].string() == 'POW': | |
| 99 | + self['ebingamma'].real() | |
| 98 | 100 | if n_cta > n_unbinned: |
| 99 | 101 | n_notunbin = n_cta - n_unbinned |
| 100 | 102 | |
| ... | ... | @@ -218,9 +220,11 @@ class csresspec(ctools.csobservation): |
| 218 | 220 | if self['ebinalg'].string() == 'FILE': |
| 219 | 221 | cntcube['ebinfile'] = self['ebinfile'].filename() |
| 220 | 222 | else: |
| 221 | - cntcube['enumbins'] = self['enumbins'].integer() | |
| 222 | - cntcube['emin'] = self['emin'].real() | |
| 223 | - cntcube['emax'] = self['emax'].real() | |
| 223 | + cntcube['enumbins'] = self['enumbins'].integer() | |
| 224 | + cntcube['emin'] = self['emin'].real() | |
| 225 | + cntcube['emax'] = self['emax'].real() | |
| 226 | + if self['ebinalg'].string() == 'POW': | |
| 227 | + cntcube['ebingamma'] = self['ebingamma'].real() | |
| 224 | 228 | cntcube.run() |
| 225 | 229 | |
| 226 | 230 | # Retrieve the binned observation container | ... | ... |
cscripts/csspec.par
| ... | ... | @@ -32,11 +32,12 @@ outfile, f, a, spectrum.fits,,, "Output spectrum file" |
| 32 | 32 | # Script parameters |
| 33 | 33 | #================== |
| 34 | 34 | method, s, a, AUTO,SLICE|NODES|AUTO,, "Spectrum generation method" |
| 35 | -ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins" | |
| 35 | +ebinalg, s, a, LOG,FILE|LIN|LOG|POW,, "Algorithm for defining energy bins" | |
| 36 | 36 | emin, r, a, 0.1,,, "Start value for first energy bin in TeV" |
| 37 | 37 | emax, r, a, 100.0,,, "Stop value for last energy bin in TeV" |
| 38 | 38 | enumbins, i, a, 20,1,200, "Number of energy bins" |
| 39 | 39 | ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" |
| 40 | +ebingamma, r, a, 1.0,,, "Exponent for POW energy node definition" | |
| 40 | 41 | statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" |
| 41 | 42 | calc_ts, b, h, yes,,, "Compute TS value in each bin" |
| 42 | 43 | calc_ulim, b, h, yes,,, "Compute upper limit in each bin" | ... | ... |
cscripts/obsutils.py
| 1 | 1 | # ========================================================================== |
| 2 | 2 | # Utility functions for observation handling |
| 3 | 3 | # |
| 4 | -# Copyright (C) 2011-2019 Juergen Knoedlseder | |
| 4 | +# Copyright (C) 2011-2020 Juergen Knoedlseder | |
| 5 | 5 | # |
| 6 | 6 | # This program is free software: you can redistribute it and/or modify |
| 7 | 7 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -1007,6 +1007,8 @@ def create_counts_cube(cls, obs): |
| 1007 | 1007 | ctbin['enumbins'] = cls['enumbins'].integer() |
| 1008 | 1008 | ctbin['emin'] = cls['emin'].real() |
| 1009 | 1009 | ctbin['emax'] = cls['emax'].real() |
| 1010 | + if cls['ebinalg'].string() == 'POW': | |
| 1011 | + ctbin['ebingamma'] = cls['ebingamma'].real() | |
| 1010 | 1012 | ctbin['chatter'] = cls['chatter'].integer() |
| 1011 | 1013 | ctbin['clobber'] = cls['clobber'].boolean() |
| 1012 | 1014 | ctbin['debug'] = cls['debug'].boolean() | ... | ... |
doc/source/admin/release_history/1.7.rst
| ... | ... | @@ -37,6 +37,10 @@ Improvements |
| 37 | 37 | Add support for Castro plots to :ref:`csspec` |
| 38 | 38 | * [`2925 <https://cta-redmine.irap.omp.eu/issues/2925>`_] - |
| 39 | 39 | Enabling running of example scripts from objects in memory |
| 40 | +* [`2881 <https://cta-redmine.irap.omp.eu/issues/2881>`_] - | |
| 41 | + Add support for power-law binning to :ref:`ctbin`, :ref:`ctedispcube`, | |
| 42 | + :ref:`ctexpcube`, :ref:`ctmapcube`, :ref:`ctmodel`, :ref:`ctpsfcube`, | |
| 43 | + :ref:`csphagen`, :ref:`csresmap`, :ref:`csresspec`, and :ref:`csspec` | |
| 40 | 44 | * [`1889 <https://cta-redmine.irap.omp.eu/issues/1889>`_] - |
| 41 | 45 | Allow using spectral models without ``Prefactor`` parameter in :ref:`cssens` and :ref:`cstsdist` |
| 42 | 46 | ... | ... |
doc/source/users/reference_manual/csphagen.rst
| ... | ... | @@ -103,11 +103,13 @@ General parameters |
| 103 | 103 | ``(prefix = onoff) [string]`` |
| 104 | 104 | Prefix of the file name for output PHA, ARF, RMF, XML, and DS9 region files. |
| 105 | 105 | |
| 106 | -``ebinalg <FILE|LIN|LOG> [string]`` | |
| 106 | +``ebinalg <FILE|LIN|LOG|POW> [string]`` | |
| 107 | 107 | Algorithm for defining energy bins. For ``FILE``, the energy bins are defined |
| 108 | 108 | in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN`` |
| 109 | - and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or | |
| 110 | - logarithmically between ``emin`` and ``emax``, respectively. | |
| 109 | + ``LOG`` and ``POW`` there will be ``enumbins`` energy bins spaced linearly, | |
| 110 | + logarithmically, or following a power law between ``emin`` and ``emax``, | |
| 111 | + respectively. For ``POW``, the parameter ``ebingamma`` specifies the slope | |
| 112 | + of the power law. | |
| 111 | 113 | |
| 112 | 114 | ``emin [real]`` |
| 113 | 115 | Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG`` |
| ... | ... | @@ -126,6 +128,10 @@ General parameters |
| 126 | 128 | Name of the file containing the energy binning definition if ``ebinalg=FILE``. |
| 127 | 129 | You may use :ref:`csebins` to generate a file with appropriate energy binning. |
| 128 | 130 | |
| 131 | +``ebingamma [real]`` | |
| 132 | + Exponent of the power law for ``POW`` energy binning. An exponent of 1.0 | |
| 133 | + corresponds to a logarithmic energy binning. | |
| 134 | + | |
| 129 | 135 | ``(srcshape = CIRCLE) <CIRCLE> [string]`` |
| 130 | 136 | Shape of the source region. So far only ``CIRCLE`` exists which defines a |
| 131 | 137 | circular region around given position. | ... | ... |
doc/source/users/reference_manual/csresmap.rst
| ... | ... | @@ -66,8 +66,13 @@ General parameters |
| 66 | 66 | ``outmap [file]`` |
| 67 | 67 | Output residual counts map file. |
| 68 | 68 | |
| 69 | -``(ebinalg = LOG) <FILE|LIN|LOG> [string]`` | |
| 70 | - Algorithm for defining energy bins for internal residual map computation. | |
| 69 | +``(ebinalg = LOG) <FILE|LIN|LOG|POW> [string]`` | |
| 70 | + Algorithm for defining energy bins. For ``FILE``, the energy bins are defined | |
| 71 | + in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN`` | |
| 72 | + ``LOG`` and ``POW`` there will be ``enumbins`` energy bins spaced linearly, | |
| 73 | + logarithmically, or following a power law between ``emin`` and ``emax``, | |
| 74 | + respectively. For ``POW``, the parameter ``ebingamma`` specifies the slope | |
| 75 | + of the power law. | |
| 71 | 76 | |
| 72 | 77 | ``emin [real]`` |
| 73 | 78 | Lower energy value for residual map (in TeV). |
| ... | ... | @@ -78,9 +83,13 @@ General parameters |
| 78 | 83 | ``(enumbins = 20) [integer]`` |
| 79 | 84 | Number of model cube energy bins for internal residual map computation. |
| 80 | 85 | |
| 81 | -``ebinfile [file]`` | |
| 82 | - Name of the file containing the energy bin definition for internal residual | |
| 83 | - map computation. | |
| 86 | +``(ebinfile = NONE) [file]`` | |
| 87 | + Name of the file containing the energy binning definition if ``ebinalg=FILE``. | |
| 88 | + You may use :ref:`csebins` to generate a file with appropriate energy binning. | |
| 89 | + | |
| 90 | +``(ebingamma = 1.0) [real]`` | |
| 91 | + Exponent of the power law for ``POW`` energy binning. An exponent of 1.0 | |
| 92 | + corresponds to a logarithmic energy binning. | |
| 84 | 93 | |
| 85 | 94 | ``coordsys <CEL|GAL> [string]`` |
| 86 | 95 | Coordinate system (CEL - celestial, GAL - galactic). | ... | ... |
doc/source/users/reference_manual/csresspec.rst
| ... | ... | @@ -91,11 +91,13 @@ General parameters |
| 91 | 91 | ``(components = no) [boolean]`` |
| 92 | 92 | Calculate model for individual components? |
| 93 | 93 | |
| 94 | -``ebinalg <FILE|LIN|LOG> [string]`` | |
| 94 | +``ebinalg <FILE|LIN|LOG|POW> [string]`` | |
| 95 | 95 | Algorithm for defining energy bins. For ``FILE``, the energy bins are defined |
| 96 | 96 | in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN`` |
| 97 | - and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or | |
| 98 | - logarithmically between ``emin`` and ``emax``, respectively. | |
| 97 | + ``LOG`` and ``POW`` there will be ``enumbins`` energy bins spaced linearly, | |
| 98 | + logarithmically, or following a power law between ``emin`` and ``emax``, | |
| 99 | + respectively. For ``POW``, the parameter ``ebingamma`` specifies the slope | |
| 100 | + of the power law. | |
| 99 | 101 | |
| 100 | 102 | ``emin [real]`` |
| 101 | 103 | Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG`` |
| ... | ... | @@ -113,6 +115,10 @@ General parameters |
| 113 | 115 | Name of the file containing the energy binning definition if ``ebinalg=FILE``. |
| 114 | 116 | You may use :ref:`csebins` to generate a file with appropriate energy binning. |
| 115 | 117 | |
| 118 | +``ebingamma [real]`` | |
| 119 | + Exponent of the power law for ``POW`` energy binning. An exponent of 1.0 | |
| 120 | + corresponds to a logarithmic energy binning. | |
| 121 | + | |
| 116 | 122 | ``stack [boolean]`` |
| 117 | 123 | Stack multiple observations for residual calculation? |
| 118 | 124 | ... | ... |
doc/source/users/reference_manual/csspec.rst
| ... | ... | @@ -103,11 +103,13 @@ General parameters |
| 103 | 103 | data. For CTA-only observations ``SLICE`` will be used, otherwise ``NODES`` |
| 104 | 104 | will be used. |
| 105 | 105 | |
| 106 | -``ebinalg <FILE|LIN|LOG> [string]`` | |
| 106 | +``ebinalg <FILE|LIN|LOG|POW> [string]`` | |
| 107 | 107 | Algorithm for defining energy bins. For ``FILE``, the energy bins are defined |
| 108 | 108 | in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN`` |
| 109 | - and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or | |
| 110 | - logarithmically between ``emin`` and ``emax``, respectively. | |
| 109 | + ``LOG`` and ``POW`` there will be ``enumbins`` energy bins spaced linearly, | |
| 110 | + logarithmically, or following a power law between ``emin`` and ``emax``, | |
| 111 | + respectively. For ``POW``, the parameter ``ebingamma`` specifies the slope | |
| 112 | + of the power law. | |
| 111 | 113 | |
| 112 | 114 | ``emin [real]`` |
| 113 | 115 | Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG`` |
| ... | ... | @@ -125,6 +127,10 @@ General parameters |
| 125 | 127 | Name of the file containing the energy binning definition if ``ebinalg=FILE``. |
| 126 | 128 | You may use :ref:`csebins` to generate a file with appropriate energy binning. |
| 127 | 129 | |
| 130 | +``ebingamma [real]`` | |
| 131 | + Exponent of the power law for ``POW`` energy binning. An exponent of 1.0 | |
| 132 | + corresponds to a logarithmic energy binning. | |
| 133 | + | |
| 128 | 134 | ``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]`` |
| 129 | 135 | Optimization statistic. ``DEFAULT`` uses the default statistic for all |
| 130 | 136 | observations, which is ``CSTAT`` or the statistic specified in the | ... | ... |
doc/source/users/reference_manual/ctbin.rst
| ... | ... | @@ -55,11 +55,13 @@ General parameters |
| 55 | 55 | ``(prefix = cntcube_) [string]`` |
| 56 | 56 | Prefix for output counts cube in observation definition XML file. |
| 57 | 57 | |
| 58 | -``ebinalg <FILE|LIN|LOG> [string]`` | |
| 58 | +``ebinalg <FILE|LIN|LOG|POW> [string]`` | |
| 59 | 59 | Algorithm for defining energy bins. For ``FILE``, the energy bins are defined |
| 60 | 60 | in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN`` |
| 61 | - and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or | |
| 62 | - logarithmically between ``emin`` and ``emax``, respectively. | |
| 61 | + ``LOG`` and ``POW`` there will be ``enumbins`` energy bins spaced linearly, | |
| 62 | + logarithmically, or following a power law between ``emin`` and ``emax``, | |
| 63 | + respectively. For ``POW``, the parameter ``ebingamma`` specifies the slope | |
| 64 | + of the power law. | |
| 63 | 65 | |
| 64 | 66 | ``emin [real]`` |
| 65 | 67 | Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG`` |
| ... | ... | @@ -77,6 +79,10 @@ General parameters |
| 77 | 79 | Name of the file containing the energy binning definition if ``ebinalg=FILE``. |
| 78 | 80 | You may use :ref:`csebins` to generate a file with appropriate energy binning. |
| 79 | 81 | |
| 82 | +``ebingamma [real]`` | |
| 83 | + Exponent of the power law for ``POW`` energy binning. An exponent of 1.0 | |
| 84 | + corresponds to a logarithmic energy binning. | |
| 85 | + | |
| 80 | 86 | ``(usepnt = no) [boolean]`` |
| 81 | 87 | Use CTA pointing direction for cube centre instead of xref/yref parameters? |
| 82 | 88 | ... | ... |
doc/source/users/reference_manual/ctedispcube.rst
| ... | ... | @@ -55,11 +55,13 @@ General parameters |
| 55 | 55 | ``outcube [file]`` |
| 56 | 56 | Output energy dispersion cube file. |
| 57 | 57 | |
| 58 | -``ebinalg <FILE|LIN|LOG> [string]`` | |
| 58 | +``ebinalg <FILE|LIN|LOG|POW> [string]`` | |
| 59 | 59 | Algorithm for defining energy bins. For ``FILE``, the energy bins are defined |
| 60 | 60 | in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN`` |
| 61 | - and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or | |
| 62 | - logarithmically between ``emin`` and ``emax``, respectively. | |
| 61 | + ``LOG`` and ``POW`` there will be ``enumbins`` energy bins spaced linearly, | |
| 62 | + logarithmically, or following a power law between ``emin`` and ``emax``, | |
| 63 | + respectively. For ``POW``, the parameter ``ebingamma`` specifies the slope | |
| 64 | + of the power law. | |
| 63 | 65 | |
| 64 | 66 | ``emin [real]`` |
| 65 | 67 | Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG`` |
| ... | ... | @@ -77,6 +79,10 @@ General parameters |
| 77 | 79 | Name of the file containing the energy binning definition if ``ebinalg=FILE``. |
| 78 | 80 | You may use :ref:`csebins` to generate a file with appropriate energy binning. |
| 79 | 81 | |
| 82 | +``ebingamma [real]`` | |
| 83 | + Exponent of the power law for ``POW`` energy binning. An exponent of 1.0 | |
| 84 | + corresponds to a logarithmic energy binning. | |
| 85 | + | |
| 80 | 86 | ``(addbounds = no) [boolean]`` |
| 81 | 87 | Add energies to the energy dispersion cube at the observation energy boundaries? |
| 82 | 88 | ... | ... |
doc/source/users/reference_manual/ctexpcube.rst
| ... | ... | @@ -62,11 +62,13 @@ General parameters |
| 62 | 62 | ``outcube [file]`` |
| 63 | 63 | Output exposure cube file. |
| 64 | 64 | |
| 65 | -``ebinalg <FILE|LIN|LOG> [string]`` | |
| 65 | +``ebinalg <FILE|LIN|LOG|POW> [string]`` | |
| 66 | 66 | Algorithm for defining energy bins. For ``FILE``, the energy bins are defined |
| 67 | 67 | in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN`` |
| 68 | - and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or | |
| 69 | - logarithmically between ``emin`` and ``emax``, respectively. | |
| 68 | + ``LOG`` and ``POW`` there will be ``enumbins`` energy bins spaced linearly, | |
| 69 | + logarithmically, or following a power law between ``emin`` and ``emax``, | |
| 70 | + respectively. For ``POW``, the parameter ``ebingamma`` specifies the slope | |
| 71 | + of the power law. | |
| 70 | 72 | |
| 71 | 73 | ``emin [real]`` |
| 72 | 74 | Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG`` |
| ... | ... | @@ -84,6 +86,10 @@ General parameters |
| 84 | 86 | Name of the file containing the energy binning definition if ``ebinalg=FILE``. |
| 85 | 87 | You may use :ref:`csebins` to generate a file with appropriate energy binning. |
| 86 | 88 | |
| 89 | +``ebingamma [real]`` | |
| 90 | + Exponent of the power law for ``POW`` energy binning. An exponent of 1.0 | |
| 91 | + corresponds to a logarithmic energy binning. | |
| 92 | + | |
| 87 | 93 | ``(addbounds = no) [boolean]`` |
| 88 | 94 | Add energies to the exposure cube at the observation energy boundaries? |
| 89 | 95 | ... | ... |
doc/source/users/reference_manual/ctmapcube.rst
| ... | ... | @@ -34,11 +34,13 @@ General parameters |
| 34 | 34 | ``(ptsrcsig = 1.0) [real]`` |
| 35 | 35 | Sigma of Gaussian to be used for point sources (in arcmin). |
| 36 | 36 | |
| 37 | -``ebinalg <FILE|LIN|LOG> [string]`` | |
| 37 | +``ebinalg <FILE|LIN|LOG|POW> [string]`` | |
| 38 | 38 | Algorithm for defining energy bins. For ``FILE``, the energy bins are defined |
| 39 | 39 | in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN`` |
| 40 | - and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or | |
| 41 | - logarithmically between ``emin`` and ``emax``, respectively. | |
| 40 | + ``LOG`` and ``POW`` there will be ``enumbins`` energy bins spaced linearly, | |
| 41 | + logarithmically, or following a power law between ``emin`` and ``emax``, | |
| 42 | + respectively. For ``POW``, the parameter ``ebingamma`` specifies the slope | |
| 43 | + of the power law. | |
| 42 | 44 | |
| 43 | 45 | ``emin [real]`` |
| 44 | 46 | Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG`` |
| ... | ... | @@ -56,6 +58,10 @@ General parameters |
| 56 | 58 | Name of the file containing the energy binning definition if ``ebinalg=FILE``. |
| 57 | 59 | You may use :ref:`csebins` to generate a file with appropriate energy binning. |
| 58 | 60 | |
| 61 | +``ebingamma [real]`` | |
| 62 | + Exponent of the power law for ``POW`` energy binning. An exponent of 1.0 | |
| 63 | + corresponds to a logarithmic energy binning. | |
| 64 | + | |
| 59 | 65 | ``nxpix [integer]`` |
| 60 | 66 | Number of cube bins in Right Ascension or Galactic longitude. |
| 61 | 67 | ... | ... |
doc/source/users/reference_manual/ctmodel.rst
| ... | ... | @@ -98,11 +98,13 @@ General parameters |
| 98 | 98 | ``(deadc = 0.95) [real]`` |
| 99 | 99 | Average deadtime correction factor. |
| 100 | 100 | |
| 101 | -``ebinalg <FILE|LIN|LOG> [string]`` | |
| 101 | +``ebinalg <FILE|LIN|LOG|POW> [string]`` | |
| 102 | 102 | Algorithm for defining energy bins. For ``FILE``, the energy bins are defined |
| 103 | 103 | in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN`` |
| 104 | - and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or | |
| 105 | - logarithmically between ``emin`` and ``emax``, respectively. | |
| 104 | + ``LOG`` and ``POW`` there will be ``enumbins`` energy bins spaced linearly, | |
| 105 | + logarithmically, or following a power law between ``emin`` and ``emax``, | |
| 106 | + respectively. For ``POW``, the parameter ``ebingamma`` specifies the slope | |
| 107 | + of the power law. | |
| 106 | 108 | |
| 107 | 109 | ``emin [real]`` |
| 108 | 110 | Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG`` |
| ... | ... | @@ -120,6 +122,10 @@ General parameters |
| 120 | 122 | Name of the file containing the energy binning definition if ``ebinalg=FILE``. |
| 121 | 123 | You may use :ref:`csebins` to generate a file with appropriate energy binning. |
| 122 | 124 | |
| 125 | +``ebingamma [real]`` | |
| 126 | + Exponent of the power law for ``POW`` energy binning. An exponent of 1.0 | |
| 127 | + corresponds to a logarithmic energy binning. | |
| 128 | + | |
| 123 | 129 | ``(usepnt = no) [boolean]`` |
| 124 | 130 | Use pointing instead of xref/yref parameters? |
| 125 | 131 | ... | ... |
doc/source/users/reference_manual/ctpsfcube.rst
| ... | ... | @@ -54,11 +54,13 @@ General parameters |
| 54 | 54 | ``outcube [file]`` |
| 55 | 55 | Output point spread function cube file. |
| 56 | 56 | |
| 57 | -``ebinalg <FILE|LIN|LOG> [string]`` | |
| 57 | +``ebinalg <FILE|LIN|LOG|POW> [string]`` | |
| 58 | 58 | Algorithm for defining energy bins. For ``FILE``, the energy bins are defined |
| 59 | 59 | in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN`` |
| 60 | - and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or | |
| 61 | - logarithmically between ``emin`` and ``emax``, respectively. | |
| 60 | + ``LOG`` and ``POW`` there will be ``enumbins`` energy bins spaced linearly, | |
| 61 | + logarithmically, or following a power law between ``emin`` and ``emax``, | |
| 62 | + respectively. For ``POW``, the parameter ``ebingamma`` specifies the slope | |
| 63 | + of the power law. | |
| 62 | 64 | |
| 63 | 65 | ``emin [real]`` |
| 64 | 66 | Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG`` |
| ... | ... | @@ -76,6 +78,10 @@ General parameters |
| 76 | 78 | Name of the file containing the energy binning definition if ``ebinalg=FILE``. |
| 77 | 79 | You may use :ref:`csebins` to generate a file with appropriate energy binning. |
| 78 | 80 | |
| 81 | +``ebingamma [real]`` | |
| 82 | + Exponent of the power law for ``POW`` energy binning. An exponent of 1.0 | |
| 83 | + corresponds to a logarithmic energy binning. | |
| 84 | + | |
| 79 | 85 | ``(addbounds = no) [boolean]`` |
| 80 | 86 | Add energies to the point spread function cube at the observation energy boundaries? |
| 81 | 87 | ... | ... |
src/ctbin/ctbin.par
| ... | ... | @@ -24,11 +24,12 @@ prefix, s, h, cntcube_,,, "Prefix for counts cubes in observation definition XML |
| 24 | 24 | # |
| 25 | 25 | # Energy binning parameters |
| 26 | 26 | #========================== |
| 27 | -ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins" | |
| 28 | -emin, r, a, 0.1,,, "Lower energy limit (TeV)" | |
| 29 | -emax, r, a, 100.0,,, "Upper energy limit (TeV)" | |
| 30 | -enumbins, i, a, 20,1,200, "Number of energy bins" | |
| 31 | -ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" | |
| 27 | +ebinalg, s, a, LOG,FILE|LIN|LOG|POW,, "Algorithm for defining energy bins" | |
| 28 | +emin, r, a, 0.1,,, "Lower energy limit (TeV)" | |
| 29 | +emax, r, a, 100.0,,, "Upper energy limit (TeV)" | |
| 30 | +enumbins, i, a, 20,1,200, "Number of energy bins" | |
| 31 | +ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" | |
| 32 | +ebingamma, r, a, 1.0,,, "Exponent for POW energy node definition" | |
| 32 | 33 | |
| 33 | 34 | # |
| 34 | 35 | # Spatial binning parameters | ... | ... |
src/ctedispcube/ctedispcube.par
| ... | ... | @@ -25,11 +25,12 @@ outcube, f, a, edispcube.fits,,, "Output energy dispersion cube file" |
| 25 | 25 | # |
| 26 | 26 | # Energy binning parameters |
| 27 | 27 | #========================== |
| 28 | -ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins" | |
| 28 | +ebinalg, s, a, LOG,FILE|LIN|LOG|POW,, "Algorithm for defining energy bins" | |
| 29 | 29 | emin, r, a, 0.1,,, "Lower energy limit (TeV)" |
| 30 | 30 | emax, r, a, 100.0,,, "Upper energy limit (TeV)" |
| 31 | 31 | enumbins, i, a, 20,1,1000, "Number of energy bins" |
| 32 | 32 | ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" |
| 33 | +ebingamma, r, a, 1.0,,, "Exponent for POW energy node definition" | |
| 33 | 34 | addbounds, b, h, no,,, "Add energies at observation energy boundaries?" |
| 34 | 35 | |
| 35 | 36 | # | ... | ... |
src/ctexpcube/ctexpcube.par
| ... | ... | @@ -25,11 +25,12 @@ outcube, f, a, expcube.fits,,, "Output exposure cube file" |
| 25 | 25 | # |
| 26 | 26 | # Energy binning parameters |
| 27 | 27 | #========================== |
| 28 | -ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins" | |
| 28 | +ebinalg, s, a, LOG,FILE|LIN|LOG|POW,, "Algorithm for defining energy bins" | |
| 29 | 29 | emin, r, a, 0.1,,, "Lower energy limit (TeV)" |
| 30 | 30 | emax, r, a, 100.0,,, "Upper energy limit (TeV)" |
| 31 | 31 | enumbins, i, a, 20,1,1000, "Number of energy bins" |
| 32 | 32 | ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" |
| 33 | +ebingamma, r, a, 1.0,,, "Exponent for POW energy node definition" | |
| 33 | 34 | addbounds, b, h, no,,, "Add energies at observation energy boundaries?" |
| 34 | 35 | |
| 35 | 36 | # | ... | ... |
src/ctmapcube/ctmapcube.par
| ... | ... | @@ -23,11 +23,12 @@ ptsrcsig, r, h, 1.0,0,60, "Point source Gaussian sigma in arcmin" |
| 23 | 23 | # |
| 24 | 24 | # Energy binning parameters |
| 25 | 25 | #========================== |
| 26 | -ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins" | |
| 27 | -emin, r, a, 0.1,,, "Lower energy limit (TeV)" | |
| 28 | -emax, r, a, 100.0,,, "Upper energy limit (TeV)" | |
| 29 | -enumbins, i, a, 20,1,200, "Number of energy bins" | |
| 30 | -ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" | |
| 26 | +ebinalg, s, a, LOG,FILE|LIN|LOG|POW,, "Algorithm for defining energy bins" | |
| 27 | +emin, r, a, 0.1,,, "Lower energy limit (TeV)" | |
| 28 | +emax, r, a, 100.0,,, "Upper energy limit (TeV)" | |
| 29 | +enumbins, i, a, 20,1,200, "Number of energy bins" | |
| 30 | +ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" | |
| 31 | +ebingamma, r, a, 1.0,,, "Exponent for POW energy node definition" | |
| 31 | 32 | |
| 32 | 33 | # |
| 33 | 34 | # Spatial binning parameters | ... | ... |
src/ctmodel/ctmodel.par
| ... | ... | @@ -41,11 +41,12 @@ deadc, r, h, 0.98,0,1, "Average deadtime correction factor" |
| 41 | 41 | # |
| 42 | 42 | # Energy binning parameters |
| 43 | 43 | #========================== |
| 44 | -ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins" | |
| 45 | -emin, r, a, 0.1,,, "Lower energy limit (TeV)" | |
| 46 | -emax, r, a, 100.0,,, "Upper energy limit (TeV)" | |
| 47 | -enumbins, i, a, 20,1,200, "Number of energy bins" | |
| 48 | -ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" | |
| 44 | +ebinalg, s, a, LOG,FILE|LIN|LOG|POW,, "Algorithm for defining energy bins" | |
| 45 | +emin, r, a, 0.1,,, "Lower energy limit (TeV)" | |
| 46 | +emax, r, a, 100.0,,, "Upper energy limit (TeV)" | |
| 47 | +enumbins, i, a, 20,1,200, "Number of energy bins" | |
| 48 | +ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" | |
| 49 | +ebingamma, r, a, 1.0,,, "Exponent for POW energy node definition" | |
| 49 | 50 | |
| 50 | 51 | # |
| 51 | 52 | # Spatial binning parameters | ... | ... |
src/ctpsfcube/ctpsfcube.par
| ... | ... | @@ -25,11 +25,12 @@ outcube, f, a, psfcube.fits,,, "Output PSF cube file" |
| 25 | 25 | # |
| 26 | 26 | # Energy binning parameters |
| 27 | 27 | #========================== |
| 28 | -ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins" | |
| 28 | +ebinalg, s, a, LOG,FILE|LIN|LOG|POW,, "Algorithm for defining energy bins" | |
| 29 | 29 | emin, r, a, 0.1,,, "Lower energy limit (TeV)" |
| 30 | 30 | emax, r, a, 100.0,,, "Upper energy limit (TeV)" |
| 31 | 31 | enumbins, i, a, 20,1,1000, "Number of energy bins" |
| 32 | 32 | ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition" |
| 33 | +ebingamma, r, a, 1.0,,, "Exponent for POW energy node definition" | |
| 33 | 34 | addbounds, b, h, no,,, "Add energies at observation energy boundaries?" |
| 34 | 35 | |
| 35 | 36 | # | ... | ... |
src/support/ctool.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * ctool - ctool base class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2019 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2014-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -688,25 +688,23 @@ GEbounds ctool::create_ebounds(void) |
| 688 | 688 | |
| 689 | 689 | } // endif: ebinalg was "FILE" |
| 690 | 690 | |
| 691 | - // ... otherwise use a linear or a logarithmically-spaced energy binning | |
| 691 | + // ... otherwise use native energy binning algorithms | |
| 692 | 692 | else { |
| 693 | 693 | |
| 694 | 694 | // Get task parameters |
| 695 | - double emin = (*this)["emin"].real(); | |
| 696 | - double emax = (*this)["emax"].real(); | |
| 697 | - int enumbins = (*this)["enumbins"].integer(); | |
| 698 | - | |
| 699 | - // Initialise log mode for ebinning | |
| 700 | - bool log = true; | |
| 695 | + double emin = (*this)["emin"].real(); | |
| 696 | + double emax = (*this)["emax"].real(); | |
| 697 | + int enumbins = (*this)["enumbins"].integer(); | |
| 698 | + double ebingamma = 1.0; | |
| 701 | 699 | |
| 702 | - // Check if algorithm is linear | |
| 703 | - if (ebinalg == "LIN") { | |
| 704 | - log = false; | |
| 700 | + // Get task parameter for POW method | |
| 701 | + if (ebinalg == "POW") { | |
| 702 | + ebingamma = (*this)["ebingamma"].real(); | |
| 705 | 703 | } |
| 706 | 704 | |
| 707 | - // Setup energy bins | |
| 708 | - ebounds = GEbounds(enumbins, GEnergy(emin, "TeV"), | |
| 709 | - GEnergy(emax, "TeV"), log); | |
| 705 | + // Setup energy boundaries | |
| 706 | + ebounds = GEbounds(enumbins, GEnergy(emin, "TeV"), GEnergy(emax, "TeV"), | |
| 707 | + ebinalg, ebingamma); | |
| 710 | 708 | |
| 711 | 709 | } // endelse: ebinalg was not "FILE" |
| 712 | 710 | |
| ... | ... | @@ -854,57 +852,23 @@ GEnergies ctool::create_energies(void) |
| 854 | 852 | |
| 855 | 853 | } // endif: ebinalg was "FILE" |
| 856 | 854 | |
| 857 | - // ... otherwise, if energy binning algorithm is of type "POW" (case | |
| 858 | - // sensitive), then set the energy binning according to a power-law | |
| 859 | - else if (ebinalg == "POW") { | |
| 855 | + // ... otherwise use native energy binning algorithms | |
| 856 | + else { | |
| 860 | 857 | |
| 861 | 858 | // Get task parameters |
| 862 | 859 | double emin = (*this)["emin"].real(); |
| 863 | 860 | double emax = (*this)["emax"].real(); |
| 864 | 861 | int enumbins = (*this)["enumbins"].integer(); |
| 865 | - double ebingamma = (*this)["ebingamma"].real(); | |
| 866 | - | |
| 867 | - // Precomputation | |
| 868 | - double a = 1.0 - ebingamma; | |
| 869 | - double c = (a == 0.0) | |
| 870 | - ? 1.0 / (std::log(emax) - std::log(emin)) | |
| 871 | - : a / (std::pow(emax,a) - std::pow(emin,a)); | |
| 872 | - double b = double(c*(enumbins-1.0)); | |
| 873 | - | |
| 874 | - // Initialise first energy | |
| 875 | - double e = emin; | |
| 876 | - energies.append(GEnergy(e, "TeV")); | |
| 877 | - | |
| 878 | - // Loop over energy bins | |
| 879 | - for (int i = 0; i < enumbins-1; ++i) { | |
| 880 | - double log_e_next = (a == 0.0) | |
| 881 | - ? 1.0/b + std::log(e) | |
| 882 | - : std::log(a/b + std::pow(e,a)) / a; | |
| 883 | - double e_next = std::exp(log_e_next); | |
| 884 | - energies.append(GEnergy(e_next, "TeV")); | |
| 885 | - e = e_next; | |
| 886 | - } | |
| 887 | - } | |
| 888 | - | |
| 889 | - // ... otherwise use a linear or a logarithmically-spaced energy binning | |
| 890 | - else { | |
| 891 | - | |
| 892 | - // Get task parameters | |
| 893 | - double emin = (*this)["emin"].real(); | |
| 894 | - double emax = (*this)["emax"].real(); | |
| 895 | - int enumbins = (*this)["enumbins"].integer(); | |
| 896 | - | |
| 897 | - // Initialise log mode for ebinning | |
| 898 | - bool log = true; | |
| 862 | + double ebingamma = 1.0; | |
| 899 | 863 | |
| 900 | - // Check if algorithm is linear | |
| 901 | - if (ebinalg == "LIN") { | |
| 902 | - log = false; | |
| 864 | + // Get task parameter for POW method | |
| 865 | + if (ebinalg == "POW") { | |
| 866 | + ebingamma = (*this)["ebingamma"].real(); | |
| 903 | 867 | } |
| 904 | 868 | |
| 905 | 869 | // Setup energy nodes |
| 906 | - energies = GEnergies(enumbins, GEnergy(emin, "TeV"), | |
| 907 | - GEnergy(emax, "TeV"), log); | |
| 870 | + energies = GEnergies(enumbins, GEnergy(emin, "TeV"), GEnergy(emax, "TeV"), | |
| 871 | + ebinalg, ebingamma); | |
| 908 | 872 | |
| 909 | 873 | } // endelse: ebinalg was not "FILE" |
| 910 | 874 | ... | ... |
test/test_csphagen.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This scripts performs unit tests for the csphagen script. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2017-2018 Luigi Tibaldo | |
| 5 | +# Copyright (C) 2017-2020 Luigi Tibaldo | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -210,10 +210,11 @@ class Test(test): |
| 210 | 210 | # Setup csphagen |
| 211 | 211 | phagen = cscripts.csphagen(obs) |
| 212 | 212 | phagen['inmodel'] = 'NONE' |
| 213 | - phagen['ebinalg'] = 'LOG' | |
| 213 | + phagen['ebinalg'] = 'POW' | |
| 214 | 214 | phagen['emin'] = 0.1 |
| 215 | 215 | phagen['emax'] = 100.0 |
| 216 | 216 | phagen['enumbins'] = self._nbins |
| 217 | + phagen['ebingamma'] = 1.0 | |
| 217 | 218 | phagen['coordsys'] = 'CEL' |
| 218 | 219 | phagen['ra'] = 83.633 |
| 219 | 220 | phagen['dec'] = 22.0145 | ... | ... |
test/test_csresmap.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This scripts performs unit tests for the csresmap script. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2016-2018 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -119,9 +119,11 @@ class Test(test): |
| 119 | 119 | resmap['inmodel'] = self._model |
| 120 | 120 | resmap['caldb'] = self._caldb |
| 121 | 121 | resmap['irf'] = self._irf |
| 122 | + resmap['ebinalg'] = 'POW' | |
| 122 | 123 | resmap['emin'] = 1.0 |
| 123 | 124 | resmap['emax'] = 100.0 |
| 124 | 125 | resmap['enumbins'] = 5 |
| 126 | + resmap['ebingamma'] = 1.0 | |
| 125 | 127 | resmap['nxpix'] = 20 |
| 126 | 128 | resmap['nypix'] = 20 |
| 127 | 129 | resmap['binsz'] = 0.2 | ... | ... |
test/test_csresspec.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This scripts performs unit tests for the csresspec script. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2017-2018 Luigi Tibaldo | |
| 5 | +# Copyright (C) 2017-2020 Luigi Tibaldo | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -144,10 +144,11 @@ class Test(test): |
| 144 | 144 | resspec['inmodel'] = self._model |
| 145 | 145 | resspec['caldb'] = self._caldb |
| 146 | 146 | resspec['irf'] = self._irf |
| 147 | - resspec['ebinalg'] = 'LOG' | |
| 147 | + resspec['ebinalg'] = 'POW' | |
| 148 | 148 | resspec['emin'] = 1.0 |
| 149 | 149 | resspec['emax'] = 100.0 |
| 150 | 150 | resspec['enumbins'] = 2 |
| 151 | + resspec['ebingamma'] = 1.0 | |
| 151 | 152 | resspec['mask'] = False |
| 152 | 153 | resspec['algorithm'] = 'SUBDIV' |
| 153 | 154 | resspec['components'] = True | ... | ... |
test/test_csspec.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This scripts performs unit tests for the csspec script. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2016-2018 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -194,18 +194,19 @@ class Test(test): |
| 194 | 194 | |
| 195 | 195 | # Set-up On/Off csspec with NODES method |
| 196 | 196 | spec = cscripts.csspec() |
| 197 | - spec['inobs'] = self._inonoff | |
| 198 | - spec['inmodel'] = self._onoff_model | |
| 199 | - spec['srcname'] = 'Crab' | |
| 200 | - spec['method'] = 'NODES' | |
| 201 | - spec['ebinalg'] = 'LOG' | |
| 202 | - spec['enumbins'] = 2 | |
| 203 | - spec['emin'] = 1.0 | |
| 204 | - spec['emax'] = 10.0 | |
| 205 | - spec['outfile'] = 'csspec_py4.fits' | |
| 206 | - spec['logfile'] = 'csspec_py4.log' | |
| 207 | - spec['chatter'] = 4 | |
| 208 | - spec['publish'] = False | |
| 197 | + spec['inobs'] = self._inonoff | |
| 198 | + spec['inmodel'] = self._onoff_model | |
| 199 | + spec['srcname'] = 'Crab' | |
| 200 | + spec['method'] = 'NODES' | |
| 201 | + spec['ebinalg'] = 'POW' | |
| 202 | + spec['enumbins'] = 2 | |
| 203 | + spec['emin'] = 1.0 | |
| 204 | + spec['emax'] = 10.0 | |
| 205 | + spec['ebingamma'] = 1.0 | |
| 206 | + spec['outfile'] = 'csspec_py4.fits' | |
| 207 | + spec['logfile'] = 'csspec_py4.log' | |
| 208 | + spec['chatter'] = 4 | |
| 209 | + spec['publish'] = False | |
| 209 | 210 | |
| 210 | 211 | # Execute csspec script |
| 211 | 212 | spec.execute() | ... | ... |
test/test_ctbin.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This scripts performs unit tests for the ctbin tool. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2014-2018 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -254,21 +254,22 @@ class Test(test): |
| 254 | 254 | |
| 255 | 255 | # Set-up ctbin using an observation container |
| 256 | 256 | binning = ctools.ctbin(obs) |
| 257 | - binning['outobs'] = 'ctbin_py3.fits' | |
| 258 | - binning['ebinalg'] = 'LOG' | |
| 259 | - binning['emin'] = 1.0 | |
| 260 | - binning['emax'] = 100.0 | |
| 261 | - binning['enumbins'] = 10 | |
| 262 | - binning['nxpix'] = 40 | |
| 263 | - binning['nypix'] = 40 | |
| 264 | - binning['binsz'] = 0.1 | |
| 265 | - binning['coordsys'] = 'CEL' | |
| 266 | - binning['proj'] = 'CAR' | |
| 267 | - binning['xref'] = 83.63 | |
| 268 | - binning['yref'] = 22.01 | |
| 269 | - binning['publish'] = True | |
| 270 | - binning['logfile'] = 'ctbin_py3.log' | |
| 271 | - binning['chatter'] = 3 | |
| 257 | + binning['outobs'] = 'ctbin_py3.fits' | |
| 258 | + binning['ebinalg'] = 'POW' | |
| 259 | + binning['emin'] = 1.0 | |
| 260 | + binning['emax'] = 100.0 | |
| 261 | + binning['enumbins'] = 10 | |
| 262 | + binning['ebingamma'] = 1.0 | |
| 263 | + binning['nxpix'] = 40 | |
| 264 | + binning['nypix'] = 40 | |
| 265 | + binning['binsz'] = 0.1 | |
| 266 | + binning['coordsys'] = 'CEL' | |
| 267 | + binning['proj'] = 'CAR' | |
| 268 | + binning['xref'] = 83.63 | |
| 269 | + binning['yref'] = 22.01 | |
| 270 | + binning['publish'] = True | |
| 271 | + binning['logfile'] = 'ctbin_py3.log' | |
| 272 | + binning['chatter'] = 3 | |
| 272 | 273 | |
| 273 | 274 | # Execute ctbin tool |
| 274 | 275 | binning.logFileOpen() | ... | ... |
test/test_ctedispcube.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This scripts performs unit tests for the ctedispcube tool. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2016-2018 Maria Haupt | |
| 5 | +# Copyright (C) 2016-2020 Maria Haupt | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -192,10 +192,11 @@ class Test(test): |
| 192 | 192 | edispcube['incube'] = 'NONE' |
| 193 | 193 | edispcube['caldb'] = self._caldb |
| 194 | 194 | edispcube['irf'] = self._irf |
| 195 | - edispcube['ebinalg'] = 'LOG' | |
| 195 | + edispcube['ebinalg'] = 'POW' | |
| 196 | 196 | edispcube['emin'] = 1.0 |
| 197 | 197 | edispcube['emax'] = 100.0 |
| 198 | 198 | edispcube['enumbins'] = 5 |
| 199 | + edispcube['ebingamma'] = 1.0 | |
| 199 | 200 | edispcube['nxpix'] = 10 |
| 200 | 201 | edispcube['nypix'] = 10 |
| 201 | 202 | edispcube['binsz'] = 0.4 | ... | ... |
test/test_ctexpcube.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This scripts performs unit tests for the ctexpcube tool. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2014-2018 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -185,23 +185,24 @@ class Test(test): |
| 185 | 185 | |
| 186 | 186 | # Set-up ctexpcube from observation container |
| 187 | 187 | expcube = ctools.ctexpcube(obs) |
| 188 | - expcube['incube'] = 'NONE' | |
| 189 | - expcube['caldb'] = self._caldb | |
| 190 | - expcube['irf'] = self._irf | |
| 191 | - expcube['ebinalg'] = 'LOG' | |
| 192 | - expcube['emin'] = 1.0 | |
| 193 | - expcube['emax'] = 100.0 | |
| 194 | - expcube['enumbins'] = 5 | |
| 195 | - expcube['nxpix'] = 20 | |
| 196 | - expcube['nypix'] = 20 | |
| 197 | - expcube['binsz'] = 0.2 | |
| 198 | - expcube['coordsys'] = 'CEL' | |
| 199 | - expcube['proj'] = 'CAR' | |
| 200 | - expcube['xref'] = 83.63 | |
| 201 | - expcube['yref'] = 22.01 | |
| 202 | - expcube['logfile'] = 'ctexpcube_py3.log' | |
| 203 | - expcube['outcube'] = 'ctexpcube_py3.fits' | |
| 204 | - expcube['chatter'] = 4 | |
| 188 | + expcube['incube'] = 'NONE' | |
| 189 | + expcube['caldb'] = self._caldb | |
| 190 | + expcube['irf'] = self._irf | |
| 191 | + expcube['ebinalg'] = 'POW' | |
| 192 | + expcube['emin'] = 1.0 | |
| 193 | + expcube['emax'] = 100.0 | |
| 194 | + expcube['enumbins'] = 5 | |
| 195 | + expcube['ebingamma'] = 1.0 | |
| 196 | + expcube['nxpix'] = 20 | |
| 197 | + expcube['nypix'] = 20 | |
| 198 | + expcube['binsz'] = 0.2 | |
| 199 | + expcube['coordsys'] = 'CEL' | |
| 200 | + expcube['proj'] = 'CAR' | |
| 201 | + expcube['xref'] = 83.63 | |
| 202 | + expcube['yref'] = 22.01 | |
| 203 | + expcube['logfile'] = 'ctexpcube_py3.log' | |
| 204 | + expcube['outcube'] = 'ctexpcube_py3.fits' | |
| 205 | + expcube['chatter'] = 4 | |
| 205 | 206 | |
| 206 | 207 | # Execute ctexpcube tool |
| 207 | 208 | expcube.logFileOpen() # Needed to get a new log file | ... | ... |
test/test_ctmapcube.py
| ... | ... | @@ -126,21 +126,22 @@ class Test(test): |
| 126 | 126 | mapcube.clear() |
| 127 | 127 | |
| 128 | 128 | # Now set ctmapcube parameters |
| 129 | - mapcube['inmodel'] = self._model | |
| 130 | - mapcube['ebinalg'] = 'LOG' | |
| 131 | - mapcube['emin'] = 1.0 | |
| 132 | - mapcube['emax'] = 100.0 | |
| 133 | - mapcube['enumbins'] = 5 | |
| 134 | - mapcube['nxpix'] = 20 | |
| 135 | - mapcube['nypix'] = 20 | |
| 136 | - mapcube['binsz'] = 0.2 | |
| 137 | - mapcube['coordsys'] = 'CEL' | |
| 138 | - mapcube['proj'] = 'CAR' | |
| 139 | - mapcube['xref'] = 83.63 | |
| 140 | - mapcube['yref'] = 22.01 | |
| 141 | - mapcube['outcube'] = 'ctmapcube_py1.fits' | |
| 142 | - mapcube['logfile'] = 'ctmapcube_py1.log' | |
| 143 | - mapcube['chatter'] = 2 | |
| 129 | + mapcube['inmodel'] = self._model | |
| 130 | + mapcube['ebinalg'] = 'POW' | |
| 131 | + mapcube['emin'] = 1.0 | |
| 132 | + mapcube['emax'] = 100.0 | |
| 133 | + mapcube['enumbins'] = 5 | |
| 134 | + mapcube['ebingamma'] = 1.0 | |
| 135 | + mapcube['nxpix'] = 20 | |
| 136 | + mapcube['nypix'] = 20 | |
| 137 | + mapcube['binsz'] = 0.2 | |
| 138 | + mapcube['coordsys'] = 'CEL' | |
| 139 | + mapcube['proj'] = 'CAR' | |
| 140 | + mapcube['xref'] = 83.63 | |
| 141 | + mapcube['yref'] = 22.01 | |
| 142 | + mapcube['outcube'] = 'ctmapcube_py1.fits' | |
| 143 | + mapcube['logfile'] = 'ctmapcube_py1.log' | |
| 144 | + mapcube['chatter'] = 2 | |
| 144 | 145 | |
| 145 | 146 | # Run ctmapcube tool |
| 146 | 147 | mapcube.logFileOpen() # Make sure we get a log file | ... | ... |
test/test_ctmodel.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This scripts performs unit tests for the ctmodel tool. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2014-2018 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -242,10 +242,11 @@ class Test(test): |
| 242 | 242 | model['dec'] = 22.01 |
| 243 | 243 | model['tmin'] = 0 |
| 244 | 244 | model['tmax'] = 1800 |
| 245 | - model['ebinalg'] = 'LOG' | |
| 245 | + model['ebinalg'] = 'POW' | |
| 246 | 246 | model['emin'] = 1.0 |
| 247 | 247 | model['emax'] = 100.0 |
| 248 | 248 | model['enumbins'] = 5 |
| 249 | + model['ebingamma'] = 1.0 | |
| 249 | 250 | model['nxpix'] = 40 |
| 250 | 251 | model['nypix'] = 40 |
| 251 | 252 | model['binsz'] = 0.1 | ... | ... |
test/test_ctpsfcube.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This scripts performs unit tests for the ctpsfcube tool. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2014-2018 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -128,26 +128,27 @@ class Test(test): |
| 128 | 128 | psfcube.clear() |
| 129 | 129 | |
| 130 | 130 | # Now set ctpsfcube parameters |
| 131 | - psfcube['inobs'] = self._events | |
| 132 | - psfcube['incube'] = 'NONE' | |
| 133 | - psfcube['caldb'] = self._caldb | |
| 134 | - psfcube['irf'] = self._irf | |
| 135 | - psfcube['ebinalg'] = 'LOG' | |
| 136 | - psfcube['emin'] = 1.0 | |
| 137 | - psfcube['emax'] = 100 | |
| 138 | - psfcube['enumbins'] = 5 | |
| 139 | - psfcube['nxpix'] = 10 | |
| 140 | - psfcube['nypix'] = 10 | |
| 141 | - psfcube['binsz'] = 0.4 | |
| 142 | - psfcube['coordsys'] = 'CEL' | |
| 143 | - psfcube['proj'] = 'CAR' | |
| 144 | - psfcube['xref'] = 83.63 | |
| 145 | - psfcube['yref'] = 22.01 | |
| 146 | - psfcube['amax'] = 0.3 | |
| 147 | - psfcube['anumbins'] = 10 | |
| 148 | - psfcube['outcube'] = 'ctpsfcube_py1.fits' | |
| 149 | - psfcube['logfile'] = 'ctpsfcube_py1.log' | |
| 150 | - psfcube['chatter'] = 2 | |
| 131 | + psfcube['inobs'] = self._events | |
| 132 | + psfcube['incube'] = 'NONE' | |
| 133 | + psfcube['caldb'] = self._caldb | |
| 134 | + psfcube['irf'] = self._irf | |
| 135 | + psfcube['ebinalg'] = 'POW' | |
| 136 | + psfcube['emin'] = 1.0 | |
| 137 | + psfcube['emax'] = 100 | |
| 138 | + psfcube['enumbins'] = 5 | |
| 139 | + psfcube['ebingamma'] = 1.0 | |
| 140 | + psfcube['nxpix'] = 10 | |
| 141 | + psfcube['nypix'] = 10 | |
| 142 | + psfcube['binsz'] = 0.4 | |
| 143 | + psfcube['coordsys'] = 'CEL' | |
| 144 | + psfcube['proj'] = 'CAR' | |
| 145 | + psfcube['xref'] = 83.63 | |
| 146 | + psfcube['yref'] = 22.01 | |
| 147 | + psfcube['amax'] = 0.3 | |
| 148 | + psfcube['anumbins'] = 10 | |
| 149 | + psfcube['outcube'] = 'ctpsfcube_py1.fits' | |
| 150 | + psfcube['logfile'] = 'ctpsfcube_py1.log' | |
| 151 | + psfcube['chatter'] = 2 | |
| 151 | 152 | |
| 152 | 153 | # Run ctpsfcube tool |
| 153 | 154 | psfcube.logFileOpen() # Make sure we get a log file | ... | ... |