Commit 83ee3aeca3d4aead47f31015a53ad9a63fd52929
1 parent
53907f7d
In csresspec._residuals_3D(), replace 'NONE' by None for optional arguments
Showing
1 changed file
with
7 additions
and
7 deletions
cscripts/csresspec.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Generates a residual spectrum. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2017-2018 Luigi Tibaldo | |
| 5 | +# Copyright (C) 2017-2019 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 |
| ... | ... | @@ -447,7 +447,7 @@ class csresspec(ctools.csobservation): |
| 447 | 447 | # Return modified table |
| 448 | 448 | return table |
| 449 | 449 | |
| 450 | - def _residuals_3D(self, obs, obs_id, ccube='NONE'): | |
| 450 | + def _residuals_3D(self, obs, obs_id, ccube=None): | |
| 451 | 451 | """ |
| 452 | 452 | Calculate residuals for 3D observation |
| 453 | 453 | |
| ... | ... | @@ -457,7 +457,7 @@ class csresspec(ctools.csobservation): |
| 457 | 457 | Observation container with a single observations of type GCTAObservation |
| 458 | 458 | obs_id : str |
| 459 | 459 | Observation ID |
| 460 | - ccube : `~gammalib.GCTAEventCube' | |
| 460 | + ccube : `~gammalib.GCTAEventCube', optional | |
| 461 | 461 | Count cube with stacked events lists |
| 462 | 462 | |
| 463 | 463 | Returns |
| ... | ... | @@ -468,7 +468,7 @@ class csresspec(ctools.csobservation): |
| 468 | 468 | |
| 469 | 469 | # If binned data already exist set the evlist_info dictionary to have |
| 470 | 470 | # attribute was_list False |
| 471 | - if obs[0].eventtype() == 'CountsCube' or ccube!='NONE': | |
| 471 | + if obs[0].eventtype() == 'CountsCube' or ccube is not None: | |
| 472 | 472 | evlist_info = {'was_list': False} |
| 473 | 473 | |
| 474 | 474 | # ... otherwise bin now |
| ... | ... | @@ -489,14 +489,14 @@ class csresspec(ctools.csobservation): |
| 489 | 489 | msg = 'Computing model cube' |
| 490 | 490 | self._log_string(gammalib.NORMAL, msg) |
| 491 | 491 | modelcube = ctools.ctmodel(obs) |
| 492 | - if ccube != 'NONE': | |
| 492 | + if ccube is not None: | |
| 493 | 493 | modelcube.cube(ccube) |
| 494 | 494 | modelcube['edisp'] = self['edisp'].boolean() |
| 495 | 495 | modelcube.run() |
| 496 | 496 | modcube = modelcube.cube().copy() |
| 497 | 497 | |
| 498 | 498 | # Extract cntcube for residual computation |
| 499 | - if ccube != 'NONE': | |
| 499 | + if ccube is not None: | |
| 500 | 500 | cntcube = ccube |
| 501 | 501 | else: |
| 502 | 502 | cntcube = obs[0].events().copy() |
| ... | ... | @@ -533,7 +533,7 @@ class csresspec(ctools.csobservation): |
| 533 | 533 | modelcube.obs().models(model_cont) |
| 534 | 534 | |
| 535 | 535 | # Reset base cube that was modified internally by ctmodel |
| 536 | - if ccube != 'NONE': | |
| 536 | + if ccube is not None: | |
| 537 | 537 | modelcube.cube(ccube) |
| 538 | 538 | |
| 539 | 539 | # Run model cube | ... | ... |