Commit b14736b7e0683b6266ae710f202a0723bd10b4e3
1 parent
fba90429
Adapt cslightcrv, csphasecrv and csscs for the usage of rectangular On/Off regions (#3248)
Showing
12 changed files
with
116 additions
and
23 deletions
cscripts/cslightcrv.par
| @@ -45,8 +45,11 @@ yref, r, a, 22.51,-90,90, "Second coordinate of image/source region cen | @@ -45,8 +45,11 @@ yref, r, a, 22.51,-90,90, "Second coordinate of image/source region cen | ||
| 45 | nxpix, i, a, 200,,, "Size of the X axis in pixels" | 45 | nxpix, i, a, 200,,, "Size of the X axis in pixels" |
| 46 | nypix, i, a, 200,,, "Size of the Y axis in pixels" | 46 | nypix, i, a, 200,,, "Size of the Y axis in pixels" |
| 47 | binsz, r, a, 0.02,,, "Pixel size (deg/pixel)" | 47 | binsz, r, a, 0.02,,, "Pixel size (deg/pixel)" |
| 48 | -srcshape, s, h, CIRCLE,CIRCLE,, "Shape of the source region" | 48 | +srcshape, s, a, CIRCLE,CIRCLE|RECT,, "Shape of the source region" |
| 49 | rad, r, a, 0.2,0,180, "Radius of source region circle (deg)" | 49 | rad, r, a, 0.2,0,180, "Radius of source region circle (deg)" |
| 50 | +width, r, a, 0.2,0,180, "Width of source region rectangle (deg)" | ||
| 51 | +height, r, a, 0.2,0,180, "Height of source region rectangle (deg)" | ||
| 52 | +posang, r, a, 0.0,-360,360, "Position angle of source region rectangle (deg)" | ||
| 50 | bkgmethod, s, h, REFLECTED,REFLECTED,, "Method for background estimation" | 53 | bkgmethod, s, h, REFLECTED,REFLECTED,, "Method for background estimation" |
| 51 | bkgregmin, i, h, 2,1,1000, "Minimum number of background regions" | 54 | bkgregmin, i, h, 2,1,1000, "Minimum number of background regions" |
| 52 | use_model_bkg, b, h, yes,,, "Use background model?" | 55 | use_model_bkg, b, h, yes,,, "Use background model?" |
cscripts/csphasecrv.par
| @@ -42,8 +42,11 @@ yref, r, a, 22.51,-90,90, "Second coordinate of image/source region center | @@ -42,8 +42,11 @@ yref, r, a, 22.51,-90,90, "Second coordinate of image/source region center | ||
| 42 | nxpix, i, a, 200,,, "Size of the X axis in pixels" | 42 | nxpix, i, a, 200,,, "Size of the X axis in pixels" |
| 43 | nypix, i, a, 200,,, "Size of the Y axis in pixels" | 43 | nypix, i, a, 200,,, "Size of the Y axis in pixels" |
| 44 | binsz, r, a, 0.02,,, "Pixel size (deg/pixel)" | 44 | binsz, r, a, 0.02,,, "Pixel size (deg/pixel)" |
| 45 | -srcshape, s, h, CIRCLE,CIRCLE,, "Shape of the source region" | 45 | +srcshape, s, a, CIRCLE,CIRCLE|RECT,, "Shape of the source region" |
| 46 | rad, r, a, 0.2,0,180, "Radius of source region circle (deg)" | 46 | rad, r, a, 0.2,0,180, "Radius of source region circle (deg)" |
| 47 | +width, r, a, 0.2,0,180, "Width of source region rectangle (deg)" | ||
| 48 | +height, r, a, 0.2,0,180, "Height of source region rectangle (deg)" | ||
| 49 | +posang, r, a, 0.0,-360,360, "Position angle of source region rectangle (deg)" | ||
| 47 | bkgmethod, s, h, REFLECTED,REFLECTED,, "Method for background estimation" | 50 | bkgmethod, s, h, REFLECTED,REFLECTED,, "Method for background estimation" |
| 48 | bkgregmin, i, h, 2,1,1000, "Minimum number of background regions" | 51 | bkgregmin, i, h, 2,1,1000, "Minimum number of background regions" |
| 49 | maxoffset, r, h, 4.0,,, "Maximum offset of source from camera center to accept observation" | 52 | maxoffset, r, h, 4.0,,, "Maximum offset of source from camera center to accept observation" |
cscripts/csscs.par
| @@ -45,7 +45,10 @@ emax, r, a, 100.0,,, "Upper energy limit (TeV)" | @@ -45,7 +45,10 @@ emax, r, a, 100.0,,, "Upper energy limit (TeV)" | ||
| 45 | method, s, a, UNBINNED, UNBINNED|ONOFF,, "Analysis method" | 45 | method, s, a, UNBINNED, UNBINNED|ONOFF,, "Analysis method" |
| 46 | enumbins, i, a, 20,,, "Number of energy bins" | 46 | enumbins, i, a, 20,,, "Number of energy bins" |
| 47 | bkgmethod, s, h, REFLECTED,REFLECTED,, "Method for background estimation" | 47 | bkgmethod, s, h, REFLECTED,REFLECTED,, "Method for background estimation" |
| 48 | -srcshape, s, h, CIRCLE,CIRCLE,, "Shape of the source region" | 48 | +srcshape, s, a, CIRCLE,CIRCLE|RECT,, "Shape of the source region" |
| 49 | +width, r, a, 0.2,0,180, "Width of source region rectangle (deg)" | ||
| 50 | +height, r, a, 0.2,0,180, "Height of source region rectangle (deg)" | ||
| 51 | +posang, r, a, 0.0,-360,360, "Position angle of source region rectangle (deg)" | ||
| 49 | bkgregmin, i, h, 2,1,1000, "Minimum number of background regions" | 52 | bkgregmin, i, h, 2,1,1000, "Minimum number of background regions" |
| 50 | bkgregskip, i, h, 1,0,10, "Number of background regions to skip next to On region" | 53 | bkgregskip, i, h, 1,0,10, "Number of background regions to skip next to On region" |
| 51 | use_model_bkg, b, h, yes,,, "Use background model?" | 54 | use_model_bkg, b, h, yes,,, "Use background model?" |
cscripts/obsutils.py
| @@ -129,6 +129,7 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, | @@ -129,6 +129,7 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, | ||
| 129 | phagen['emin'] = emin | 129 | phagen['emin'] = emin |
| 130 | phagen['emax'] = emax | 130 | phagen['emax'] = emax |
| 131 | phagen['enumbins'] = nbins | 131 | phagen['enumbins'] = nbins |
| 132 | + phagen['srcshape'] = 'CIRCLE' | ||
| 132 | phagen['coordsys'] = 'CEL' | 133 | phagen['coordsys'] = 'CEL' |
| 133 | phagen['ra'] = ra | 134 | phagen['ra'] = ra |
| 134 | phagen['dec'] = dec | 135 | phagen['dec'] = dec |
| @@ -798,8 +799,8 @@ def get_onoff_obs(cls, obs, nthreads=0, ra = None, dec = None, srcname = ''): | @@ -798,8 +799,8 @@ def get_onoff_obs(cls, obs, nthreads=0, ra = None, dec = None, srcname = ''): | ||
| 798 | # User has specified custom centre for the source region | 799 | # User has specified custom centre for the source region |
| 799 | if ra != None and dec != None: | 800 | if ra != None and dec != None: |
| 800 | phagen['coordsys'] = 'CEL' | 801 | phagen['coordsys'] = 'CEL' |
| 801 | - phagen['ra'] = ra | ||
| 802 | - phagen['dec'] = dec | 802 | + phagen['ra'] = ra |
| 803 | + phagen['dec'] = dec | ||
| 803 | # Otherwise use default in class | 804 | # Otherwise use default in class |
| 804 | else: | 805 | else: |
| 805 | phagen['coordsys'] = cls['coordsys'].string() | 806 | phagen['coordsys'] = cls['coordsys'].string() |
| @@ -811,6 +812,10 @@ def get_onoff_obs(cls, obs, nthreads=0, ra = None, dec = None, srcname = ''): | @@ -811,6 +812,10 @@ def get_onoff_obs(cls, obs, nthreads=0, ra = None, dec = None, srcname = ''): | ||
| 811 | phagen['glat'] = cls['yref'].real() | 812 | phagen['glat'] = cls['yref'].real() |
| 812 | if cls['srcshape'].string() == 'CIRCLE': | 813 | if cls['srcshape'].string() == 'CIRCLE': |
| 813 | phagen['rad'] = cls['rad'].real() | 814 | phagen['rad'] = cls['rad'].real() |
| 815 | + elif cls['srcshape'].string() == 'RECT': | ||
| 816 | + phagen['width'] = cls['width'].real() | ||
| 817 | + phagen['height'] = cls['height'].real() | ||
| 818 | + phagen['posang'] = cls['posang'].real() | ||
| 814 | phagen['bkgmethod'] = cls['bkgmethod'].string() | 819 | phagen['bkgmethod'] = cls['bkgmethod'].string() |
| 815 | if cls['bkgmethod'].string() == 'REFLECTED': | 820 | if cls['bkgmethod'].string() == 'REFLECTED': |
| 816 | phagen['bkgregmin'] = cls['bkgregmin'].integer() | 821 | phagen['bkgregmin'] = cls['bkgregmin'].integer() |
doc/source/users/reference_manual/cslightcrv.rst
| @@ -129,13 +129,23 @@ General parameters | @@ -129,13 +129,23 @@ General parameters | ||
| 129 | ``binsz [real]`` | 129 | ``binsz [real]`` |
| 130 | Pixel size for ``3D`` analysis (in degrees/pixel). | 130 | Pixel size for ``3D`` analysis (in degrees/pixel). |
| 131 | 131 | ||
| 132 | -``(srcshape = CIRCLE) [string]`` | ||
| 133 | - Shape of the source region for On/Off analysis. | ||
| 134 | - ``CIRCLE``: circular region around given position. | 132 | +``srcshape <CIRCLE|RECT> [string]`` |
| 133 | + Shape of the source region. ``CIRCLE`` defines a circular region around given | ||
| 134 | + position, ``RECT`` defines a rectangle centred on a given position. | ||
| 135 | 135 | ||
| 136 | ``rad [real]`` | 136 | ``rad [real]`` |
| 137 | Radius of source region circle for On/Off analysis (deg) | 137 | Radius of source region circle for On/Off analysis (deg) |
| 138 | 138 | ||
| 139 | +``width [real]`` | ||
| 140 | + Width of source region rectangle for On/Off analysis (deg). | ||
| 141 | + | ||
| 142 | +``height [real]`` | ||
| 143 | + Height of source region rectangle for On/Off analysis (deg). | ||
| 144 | + | ||
| 145 | +``posang [real]`` | ||
| 146 | + Position angle of source region rectangle for On/Off analysis, counted | ||
| 147 | + counterclockwise from celestial North (deg). | ||
| 148 | + | ||
| 139 | ``(bkgmethod = REFLECTED) [string]`` | 149 | ``(bkgmethod = REFLECTED) [string]`` |
| 140 | Method for background estimation in On/Off analysis. | 150 | Method for background estimation in On/Off analysis. |
| 141 | ``REFLECTED:`` background evaluated in regions with the same shape as | 151 | ``REFLECTED:`` background evaluated in regions with the same shape as |
doc/source/users/reference_manual/csphasecrv.rst
| @@ -118,13 +118,23 @@ General parameters | @@ -118,13 +118,23 @@ General parameters | ||
| 118 | ``binsz [real]`` | 118 | ``binsz [real]`` |
| 119 | Pixel size for ``3D`` analysis (in degrees/pixel). | 119 | Pixel size for ``3D`` analysis (in degrees/pixel). |
| 120 | 120 | ||
| 121 | -``(srcshape = CIRCLE) [string]`` | ||
| 122 | - Shape of the source region for On/Off analysis. | ||
| 123 | - ``CIRCLE``: circular region around given position. | 121 | +``srcshape <CIRCLE|RECT> [string]`` |
| 122 | + Shape of the source region. ``CIRCLE`` defines a circular region around given | ||
| 123 | + position, ``RECT`` defines a rectangle centred on a given position. | ||
| 124 | 124 | ||
| 125 | ``rad [real]`` | 125 | ``rad [real]`` |
| 126 | Radius of source region circle for On/Off analysis (deg) | 126 | Radius of source region circle for On/Off analysis (deg) |
| 127 | 127 | ||
| 128 | +``width [real]`` | ||
| 129 | + Width of source region rectangle for On/Off analysis (deg). | ||
| 130 | + | ||
| 131 | +``height [real]`` | ||
| 132 | + Height of source region rectangle for On/Off analysis (deg). | ||
| 133 | + | ||
| 134 | +``posang [real]`` | ||
| 135 | + Position angle of source region rectangle for On/Off analysis, counted | ||
| 136 | + counterclockwise from celestial North (deg). | ||
| 137 | + | ||
| 128 | ``(bkgmethod = REFLECTED) [string]`` | 138 | ``(bkgmethod = REFLECTED) [string]`` |
| 129 | Method for background estimation in On/Off analysis. | 139 | Method for background estimation in On/Off analysis. |
| 130 | ``REFLECTED:`` background evaluated in regions with the same shape as | 140 | ``REFLECTED:`` background evaluated in regions with the same shape as |
doc/source/users/reference_manual/csscs.rst
| @@ -159,9 +159,19 @@ On/Off parameters | @@ -159,9 +159,19 @@ On/Off parameters | ||
| 159 | with the same shape as source region reflected w.r.t. pointing direction for | 159 | with the same shape as source region reflected w.r.t. pointing direction for |
| 160 | each observation. | 160 | each observation. |
| 161 | 161 | ||
| 162 | -``(srcshape = CIRCLE) [string]`` | ||
| 163 | - Shape of the source region. | ||
| 164 | - ``CIRCLE``: circular region around given position. | 162 | +``srcshape <CIRCLE|RECT> [string]`` |
| 163 | + Shape of the source region. ``CIRCLE`` defines a circular region around given | ||
| 164 | + position, ``RECT`` defines a rectangle centred on a given position. | ||
| 165 | + | ||
| 166 | +``width [real]`` | ||
| 167 | + Width of source region rectangle for On/Off analysis (deg). | ||
| 168 | + | ||
| 169 | +``height [real]`` | ||
| 170 | + Height of source region rectangle for On/Off analysis (deg). | ||
| 171 | + | ||
| 172 | +``posang [real]`` | ||
| 173 | + Position angle of source region rectangle for On/Off analysis, counted | ||
| 174 | + counterclockwise from celestial North (deg). | ||
| 165 | 175 | ||
| 166 | ``(bkgregmin = 2) [integer]`` | 176 | ``(bkgregmin = 2) [integer]`` |
| 167 | Minimum number of background regions that are required for an | 177 | Minimum number of background regions that are required for an |
test/test_cslightcrv.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cslightcrv script. | 3 | # This scripts performs unit tests for the cslightcrv script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2018 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2020 Juergen Knoedlseder |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -251,6 +251,7 @@ class Test(test): | @@ -251,6 +251,7 @@ class Test(test): | ||
| 251 | lcrv['tmax'] = '2020-01-01T00:05:00' | 251 | lcrv['tmax'] = '2020-01-01T00:05:00' |
| 252 | lcrv['tbins'] = 2 | 252 | lcrv['tbins'] = 2 |
| 253 | lcrv['method'] = 'ONOFF' | 253 | lcrv['method'] = 'ONOFF' |
| 254 | + lcrv['srcshape'] = 'CIRCLE' | ||
| 254 | lcrv['use_model_bkg'] = False # Needed even if WSTAT | 255 | lcrv['use_model_bkg'] = False # Needed even if WSTAT |
| 255 | lcrv['emin'] = 1.0 | 256 | lcrv['emin'] = 1.0 |
| 256 | lcrv['emax'] = 100.0 | 257 | lcrv['emax'] = 100.0 |
test/test_csphagen.py
| @@ -88,7 +88,7 @@ class Test(test): | @@ -88,7 +88,7 @@ class Test(test): | ||
| 88 | '" ebinalg="LOG" emin=0.1 emax=100. enumbins=' + \ | 88 | '" ebinalg="LOG" emin=0.1 emax=100. enumbins=' + \ |
| 89 | str(self._nbins) + \ | 89 | str(self._nbins) + \ |
| 90 | ' etruemin=0.05 etruemax=150 etruebins=5'+ \ | 90 | ' etruemin=0.05 etruemax=150 etruebins=5'+ \ |
| 91 | - ' coordsys="CEL" ra=83.633 dec=22.0145' + \ | 91 | + ' srcshape="CIRCLE" coordsys="CEL" ra=83.633 dec=22.0145' + \ |
| 92 | ' rad=0.2 stack="no" inexclusion="' + \ | 92 | ' rad=0.2 stack="no" inexclusion="' + \ |
| 93 | self._exclusion + \ | 93 | self._exclusion + \ |
| 94 | '" bkgmethod="REFLECTED" '+ \ | 94 | '" bkgmethod="REFLECTED" '+ \ |
| @@ -111,7 +111,7 @@ class Test(test): | @@ -111,7 +111,7 @@ class Test(test): | ||
| 111 | '" ebinalg="LOG" emin=0.1 emax=100. enumbins=' + \ | 111 | '" ebinalg="LOG" emin=0.1 emax=100. enumbins=' + \ |
| 112 | str(self._nbins) + \ | 112 | str(self._nbins) + \ |
| 113 | ' etruemin=0.05 etruemax=150 etruebins=5'+ \ | 113 | ' etruemin=0.05 etruemax=150 etruebins=5'+ \ |
| 114 | - ' coordsys="CEL" ra=83.633 dec=22.0145' + \ | 114 | + ' srcshape="CIRCLE" coordsys="CEL" ra=83.633 dec=22.0145' + \ |
| 115 | ' rad=0.2 stack="no" inexclusion="' + \ | 115 | ' rad=0.2 stack="no" inexclusion="' + \ |
| 116 | self._exclusion + \ | 116 | self._exclusion + \ |
| 117 | '" bkgmethod="REFLECTED" '+ \ | 117 | '" bkgmethod="REFLECTED" '+ \ |
| @@ -143,6 +143,7 @@ class Test(test): | @@ -143,6 +143,7 @@ class Test(test): | ||
| 143 | phagen['emin'] = 0.1 | 143 | phagen['emin'] = 0.1 |
| 144 | phagen['emax'] = 100.0 | 144 | phagen['emax'] = 100.0 |
| 145 | phagen['enumbins'] = self._nbins | 145 | phagen['enumbins'] = self._nbins |
| 146 | + phagen['srcshape'] = 'CIRCLE' | ||
| 146 | phagen['coordsys'] = 'CEL' | 147 | phagen['coordsys'] = 'CEL' |
| 147 | phagen['ra'] = 83.633 | 148 | phagen['ra'] = 83.633 |
| 148 | phagen['dec'] = 22.0145 | 149 | phagen['dec'] = 22.0145 |
| @@ -176,6 +177,7 @@ class Test(test): | @@ -176,6 +177,7 @@ class Test(test): | ||
| 176 | phagen['emin'] = 0.1 | 177 | phagen['emin'] = 0.1 |
| 177 | phagen['emax'] = 100.0 | 178 | phagen['emax'] = 100.0 |
| 178 | phagen['enumbins'] = self._nbins | 179 | phagen['enumbins'] = self._nbins |
| 180 | + phagen['srcshape'] = 'CIRCLE' | ||
| 179 | phagen['coordsys'] = 'CEL' | 181 | phagen['coordsys'] = 'CEL' |
| 180 | phagen['ra'] = 83.633 | 182 | phagen['ra'] = 83.633 |
| 181 | phagen['dec'] = 22.0145 | 183 | phagen['dec'] = 22.0145 |
| @@ -215,6 +217,7 @@ class Test(test): | @@ -215,6 +217,7 @@ class Test(test): | ||
| 215 | phagen['emax'] = 100.0 | 217 | phagen['emax'] = 100.0 |
| 216 | phagen['enumbins'] = self._nbins | 218 | phagen['enumbins'] = self._nbins |
| 217 | phagen['ebingamma'] = 1.0 | 219 | phagen['ebingamma'] = 1.0 |
| 220 | + phagen['srcshape'] = 'CIRCLE' | ||
| 218 | phagen['coordsys'] = 'CEL' | 221 | phagen['coordsys'] = 'CEL' |
| 219 | phagen['ra'] = 83.633 | 222 | phagen['ra'] = 83.633 |
| 220 | phagen['dec'] = 22.0145 | 223 | phagen['dec'] = 22.0145 |
| @@ -247,6 +250,7 @@ class Test(test): | @@ -247,6 +250,7 @@ class Test(test): | ||
| 247 | phagen['emin'] = 0.1 | 250 | phagen['emin'] = 0.1 |
| 248 | phagen['emax'] = 100.0 | 251 | phagen['emax'] = 100.0 |
| 249 | phagen['enumbins'] = self._nbins | 252 | phagen['enumbins'] = self._nbins |
| 253 | + phagen['srcshape'] = 'CIRCLE' | ||
| 250 | phagen['coordsys'] = 'CEL' | 254 | phagen['coordsys'] = 'CEL' |
| 251 | phagen['ra'] = 83.633 | 255 | phagen['ra'] = 83.633 |
| 252 | phagen['dec'] = 22.0145 | 256 | phagen['dec'] = 22.0145 |
| @@ -346,6 +350,7 @@ class Test(test): | @@ -346,6 +350,7 @@ class Test(test): | ||
| 346 | phagen['emin'] = 0.1 | 350 | phagen['emin'] = 0.1 |
| 347 | phagen['emax'] = 100.0 | 351 | phagen['emax'] = 100.0 |
| 348 | phagen['enumbins'] = self._nbins | 352 | phagen['enumbins'] = self._nbins |
| 353 | + phagen['srcshape'] = 'CIRCLE' | ||
| 349 | phagen['coordsys'] = 'CEL' | 354 | phagen['coordsys'] = 'CEL' |
| 350 | phagen['ra'] = 83.633 | 355 | phagen['ra'] = 83.633 |
| 351 | phagen['dec'] = 22.0145 | 356 | phagen['dec'] = 22.0145 |
| @@ -372,6 +377,43 @@ class Test(test): | @@ -372,6 +377,43 @@ class Test(test): | ||
| 372 | self._check_output('csphagen_py7', self._nbins, self._nreg_with_excl) | 377 | self._check_output('csphagen_py7', self._nbins, self._nreg_with_excl) |
| 373 | self._check_outobs('csphagen_py7_obs.xml', 1) | 378 | self._check_outobs('csphagen_py7_obs.xml', 1) |
| 374 | 379 | ||
| 380 | + # Test with rectangular region | ||
| 381 | + phagen = cscripts.csphagen() | ||
| 382 | + phagen['inobs'] = self._myevents1 | ||
| 383 | + phagen['inmodel'] = 'NONE' | ||
| 384 | + phagen['caldb'] = self._caldb | ||
| 385 | + phagen['irf'] = self._irf | ||
| 386 | + phagen['ebinalg'] = 'LOG' | ||
| 387 | + phagen['emin'] = 0.1 | ||
| 388 | + phagen['emax'] = 100.0 | ||
| 389 | + phagen['enumbins'] = self._nbins | ||
| 390 | + phagen['srcshape'] = 'RECT' | ||
| 391 | + phagen['width'] = 0.15 | ||
| 392 | + phagen['height'] = 0.25 | ||
| 393 | + phagen['posang'] = 45.0 | ||
| 394 | + phagen['coordsys'] = 'CEL' | ||
| 395 | + phagen['ra'] = 83.633 | ||
| 396 | + phagen['dec'] = 22.0145 | ||
| 397 | + phagen['rad'] = 0.2 | ||
| 398 | + phagen['stack'] = False | ||
| 399 | + phagen['inexclusion'] = self._exclusion | ||
| 400 | + phagen['bkgmethod'] = 'REFLECTED' | ||
| 401 | + phagen['etruemin'] = 0.05 | ||
| 402 | + phagen['etruemax'] = 150.0 | ||
| 403 | + phagen['etruebins'] = 5 | ||
| 404 | + phagen['outobs'] = 'csphagen_py8_obs.xml' | ||
| 405 | + phagen['outmodel'] = 'csphagen_py8_model.xml' | ||
| 406 | + phagen['prefix'] = 'csphagen_py8' | ||
| 407 | + phagen['logfile'] = 'csphagen_py8.log' | ||
| 408 | + phagen['chatter'] = 2 | ||
| 409 | + | ||
| 410 | + # Execute script | ||
| 411 | + phagen.execute() | ||
| 412 | + | ||
| 413 | + # Check output | ||
| 414 | + self._check_output('csphagen_py8', self._nbins, self._nreg_with_excl) | ||
| 415 | + self._check_outobs('csphagen_py8_obs.xml', 1) | ||
| 416 | + | ||
| 375 | # Return | 417 | # Return |
| 376 | return | 418 | return |
| 377 | 419 | ||
| @@ -393,6 +435,7 @@ class Test(test): | @@ -393,6 +435,7 @@ class Test(test): | ||
| 393 | phagen['emin'] = 0.1 | 435 | phagen['emin'] = 0.1 |
| 394 | phagen['emax'] = 100.0 | 436 | phagen['emax'] = 100.0 |
| 395 | phagen['enumbins'] = self._nbins | 437 | phagen['enumbins'] = self._nbins |
| 438 | + phagen['srcshape'] = 'CIRCLE' | ||
| 396 | phagen['coordsys'] = 'CEL' | 439 | phagen['coordsys'] = 'CEL' |
| 397 | phagen['ra'] = 83.633 | 440 | phagen['ra'] = 83.633 |
| 398 | phagen['dec'] = 22.0145 | 441 | phagen['dec'] = 22.0145 |
test/test_csphasecrv.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csphasecrv script. | 3 | # This scripts performs unit tests for the csphasecrv script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2017-2018 Juergen Knoedlseder | 5 | +# Copyright (C) 2017-2020 Juergen Knoedlseder |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -247,6 +247,7 @@ class Test(test): | @@ -247,6 +247,7 @@ class Test(test): | ||
| 247 | pcrv['phbinalg'] = 'LIN' | 247 | pcrv['phbinalg'] = 'LIN' |
| 248 | pcrv['phbins'] = 2 | 248 | pcrv['phbins'] = 2 |
| 249 | pcrv['method'] = 'ONOFF' | 249 | pcrv['method'] = 'ONOFF' |
| 250 | + pcrv['srcshape'] = 'CIRCLE' | ||
| 250 | pcrv['statistic'] = 'WSTAT' | 251 | pcrv['statistic'] = 'WSTAT' |
| 251 | pcrv['emin'] = 1.0 | 252 | pcrv['emin'] = 1.0 |
| 252 | pcrv['emax'] = 100.0 | 253 | pcrv['emax'] = 100.0 |
test/test_csscs.py
| @@ -299,8 +299,8 @@ class Test(test): | @@ -299,8 +299,8 @@ class Test(test): | ||
| 299 | script['irf'] = self._irf | 299 | script['irf'] = self._irf |
| 300 | script['inmodel'] = self._model | 300 | script['inmodel'] = self._model |
| 301 | script['srcnames'] = 'Crab' | 301 | script['srcnames'] = 'Crab' |
| 302 | - script['emin'] = 1. | ||
| 303 | - script['emax'] = 100. | 302 | + script['emin'] = 1.0 |
| 303 | + script['emax'] = 100.0 | ||
| 304 | script['nxpix'] = 2 | 304 | script['nxpix'] = 2 |
| 305 | script['nypix'] = 2 | 305 | script['nypix'] = 2 |
| 306 | script['binsz'] = 0.1 | 306 | script['binsz'] = 0.1 |
| @@ -310,6 +310,7 @@ class Test(test): | @@ -310,6 +310,7 @@ class Test(test): | ||
| 310 | script['yref'] = 22.01 | 310 | script['yref'] = 22.01 |
| 311 | script['rad'] = 0.2 | 311 | script['rad'] = 0.2 |
| 312 | script['method'] = 'ONOFF' | 312 | script['method'] = 'ONOFF' |
| 313 | + script['srcshape'] = 'CIRCLE' | ||
| 313 | script['inexclusion'] = self._exclusion | 314 | script['inexclusion'] = self._exclusion |
| 314 | script['enumbins'] = 2 | 315 | script['enumbins'] = 2 |
| 315 | script['outfile'] = 'csscs_py6.fits' | 316 | script['outfile'] = 'csscs_py6.fits' |
| @@ -330,8 +331,8 @@ class Test(test): | @@ -330,8 +331,8 @@ class Test(test): | ||
| 330 | script['irf'] = self._irf | 331 | script['irf'] = self._irf |
| 331 | script['inmodel'] = self._model | 332 | script['inmodel'] = self._model |
| 332 | script['srcnames'] = 'Crab' | 333 | script['srcnames'] = 'Crab' |
| 333 | - script['emin'] = 1. | ||
| 334 | - script['emax'] = 100. | 334 | + script['emin'] = 1.0 |
| 335 | + script['emax'] = 100.0 | ||
| 335 | script['nxpix'] = 2 | 336 | script['nxpix'] = 2 |
| 336 | script['nypix'] = 2 | 337 | script['nypix'] = 2 |
| 337 | script['binsz'] = 0.1 | 338 | script['binsz'] = 0.1 |
| @@ -341,6 +342,7 @@ class Test(test): | @@ -341,6 +342,7 @@ class Test(test): | ||
| 341 | script['yref'] = 22.01 | 342 | script['yref'] = 22.01 |
| 342 | script['rad'] = 0.2 | 343 | script['rad'] = 0.2 |
| 343 | script['method'] = 'ONOFF' | 344 | script['method'] = 'ONOFF' |
| 345 | + script['srcshape'] = 'CIRCLE' | ||
| 344 | script['enumbins'] = 2 | 346 | script['enumbins'] = 2 |
| 345 | script['outfile'] = 'csscs_py7.fits' | 347 | script['outfile'] = 'csscs_py7.fits' |
| 346 | script['chatter'] = 2 | 348 | script['chatter'] = 2 |
| @@ -375,6 +377,7 @@ class Test(test): | @@ -375,6 +377,7 @@ class Test(test): | ||
| 375 | script['yref'] = 22.01 | 377 | script['yref'] = 22.01 |
| 376 | script['rad'] = 0.2 | 378 | script['rad'] = 0.2 |
| 377 | script['method'] = 'ONOFF' | 379 | script['method'] = 'ONOFF' |
| 380 | + script['srcshape'] = 'CIRCLE' | ||
| 378 | script['use_model_bkg'] = False | 381 | script['use_model_bkg'] = False |
| 379 | script['inexclusion'] = self._exclusion | 382 | script['inexclusion'] = self._exclusion |
| 380 | script['enumbins'] = 2 | 383 | script['enumbins'] = 2 |
test/test_obsutils.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the obsutils module | 3 | # This scripts performs unit tests for the obsutils module |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2017-2018 Juergen Knoedlseder | 5 | +# Copyright (C) 2017-2020 Juergen Knoedlseder |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -670,6 +670,7 @@ class Test(test): | @@ -670,6 +670,7 @@ class Test(test): | ||
| 670 | lcrv['tmax'] = '2020-01-01T00:05:00' | 670 | lcrv['tmax'] = '2020-01-01T00:05:00' |
| 671 | lcrv['tbins'] = 2 | 671 | lcrv['tbins'] = 2 |
| 672 | lcrv['method'] = 'ONOFF' | 672 | lcrv['method'] = 'ONOFF' |
| 673 | + lcrv['srcshape'] = 'CIRCLE' | ||
| 673 | lcrv['emin'] = 1.0 | 674 | lcrv['emin'] = 1.0 |
| 674 | lcrv['emax'] = 100.0 | 675 | lcrv['emax'] = 100.0 |
| 675 | lcrv['enumbins'] = 2 | 676 | lcrv['enumbins'] = 2 |