Commit d532b581dd8c4f7ca4ae1d370ca1a6b1bf94db0d
1 parent
beefe63f
Solve some minor code quality issues
Showing
4 changed files
with
8 additions
and
12 deletions
cscripts/csbkgmodel.py
| @@ -19,7 +19,6 @@ | @@ -19,7 +19,6 @@ | ||
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | import sys | 21 | import sys |
| 22 | -import math | ||
| 23 | import gammalib | 22 | import gammalib |
| 24 | import ctools | 23 | import ctools |
| 25 | 24 | ||
| @@ -96,10 +95,10 @@ class csbkgmodel(ctools.csobservation): | @@ -96,10 +95,10 @@ class csbkgmodel(ctools.csobservation): | ||
| 96 | 95 | ||
| 97 | # Query input parameters | 96 | # Query input parameters |
| 98 | spatial = self['spatial'].string() | 97 | spatial = self['spatial'].string() |
| 99 | - if self['spatial'].string() == 'GAUSS': | 98 | + if spatial == 'GAUSS': |
| 100 | self['gradient'].boolean() | 99 | self['gradient'].boolean() |
| 101 | self['spectral'].string() | 100 | self['spectral'].string() |
| 102 | - if self['spatial'].string() == 'NODES': | 101 | + if spatial == 'NODES': |
| 103 | self._create_energies() | 102 | self._create_energies() |
| 104 | self['runwise'].boolean() | 103 | self['runwise'].boolean() |
| 105 | self['emin'].real() | 104 | self['emin'].real() |
| @@ -330,7 +329,6 @@ class csbkgmodel(ctools.csobservation): | @@ -330,7 +329,6 @@ class csbkgmodel(ctools.csobservation): | ||
| 330 | spectral = model.spectral() | 329 | spectral = model.spectral() |
| 331 | nodes = spectral.nodes() | 330 | nodes = spectral.nodes() |
| 332 | for i in range(nodes): | 331 | for i in range(nodes): |
| 333 | - ieng = 2*(nodes - i) - 2 | ||
| 334 | iint = 2*(nodes - i) - 1 | 332 | iint = 2*(nodes - i) - 1 |
| 335 | if spectral[iint].error() == 0.0: | 333 | if spectral[iint].error() == 0.0: |
| 336 | spectral.remove(nodes - i - 1) | 334 | spectral.remove(nodes - i - 1) |
examples/show_significance_distribution.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # Shows the distribution of significances in a given significance map. | 3 | # Shows the distribution of significances in a given significance map. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2018 Andreas Specovius | 5 | +# Copyright (C) 2018-2019 Andreas Specovius |
| 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 |
| @@ -50,7 +50,6 @@ import gammalib | @@ -50,7 +50,6 @@ import gammalib | ||
| 50 | import cscripts | 50 | import cscripts |
| 51 | try: | 51 | try: |
| 52 | import matplotlib.pyplot as plt | 52 | import matplotlib.pyplot as plt |
| 53 | - import matplotlib.mlab as mlab | ||
| 54 | plt.figure() | 53 | plt.figure() |
| 55 | plt.close() | 54 | plt.close() |
| 56 | except (ImportError, RuntimeError): | 55 | except (ImportError, RuntimeError): |
src/ctfindvar/ctfindvar.cpp
| @@ -768,10 +768,10 @@ void ctfindvar::analyse_cube(void) | @@ -768,10 +768,10 @@ void ctfindvar::analyse_cube(void) | ||
| 768 | for (int ipix = 0; ipix < m_counts.npix(); ++ipix) { | 768 | for (int ipix = 0; ipix < m_counts.npix(); ++ipix) { |
| 769 | 769 | ||
| 770 | // Compute total counts for pixel | 770 | // Compute total counts for pixel |
| 771 | - double total_counts = 0.0; | ||
| 772 | - for (int k = 0; k < nbins; ++k) { | ||
| 773 | - total_counts += m_counts(ipix, k); | ||
| 774 | - } | 771 | + //double total_counts = 0.0; |
| 772 | + //for (int k = 0; k < nbins; ++k) { | ||
| 773 | + // total_counts += m_counts(ipix, k); | ||
| 774 | + //} | ||
| 775 | 775 | ||
| 776 | // Getting the variability significance for the current pixel | 776 | // Getting the variability significance for the current pixel |
| 777 | GNdarray pixSig = get_variability_sig(ipix); | 777 | GNdarray pixSig = get_variability_sig(ipix); |
test/test_ctfindvar.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctfindvar tool. | 3 | # This scripts performs unit tests for the ctfindvar tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2018 Simon Bonnefoy | 5 | +# Copyright (C) 2018-2019 Simon Bonnefoy |
| 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 |
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import os | ||
| 22 | import gammalib | 21 | import gammalib |
| 23 | import ctools | 22 | import ctools |
| 24 | from testing import test | 23 | from testing import test |