Commit 3d73c0034d342a5e4f38e07815b8ec5e50ec3de0
1 parent
53177ac4
added method to extract backscal as GNdarray
Showing
3 changed files
with
21 additions
and
0 deletions
include/GPha.hpp
| ... | ... | @@ -101,6 +101,7 @@ public: |
| 101 | 101 | const double& areascal(const int& index) const; |
| 102 | 102 | void backscal(const int& index, const double& backscal); |
| 103 | 103 | const double& backscal(const int& index) const; |
| 104 | + GNdarray backscal_spectrum(void) const; | |
| 104 | 105 | const double& underflow(void) const; |
| 105 | 106 | const double& overflow(void) const; |
| 106 | 107 | const double& outflow(void) const; | ... | ... |
pyext/GPha.i
| ... | ... | @@ -62,6 +62,7 @@ public: |
| 62 | 62 | const double& areascal(const int& index) const; |
| 63 | 63 | void backscal(const int& index, const double& backscal); |
| 64 | 64 | const double& backscal(const int& index) const; |
| 65 | + GNdarray backscal_spectrum(void) const; | |
| 65 | 66 | const double& underflow(void) const; |
| 66 | 67 | const double& overflow(void) const; |
| 67 | 68 | const double& outflow(void) const; | ... | ... |
src/xspec/GPha.cpp
| ... | ... | @@ -601,6 +601,25 @@ GNdarray GPha::counts_spectrum(void) const |
| 601 | 601 | return counts; |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | +/***********************************************************************//** | |
| 605 | + * @brief Number of counts in spectrum as GNdArray | |
| 606 | + * | |
| 607 | + * Returns the number of counts in the spectrum as a GNdArray. | |
| 608 | + ***************************************************************************/ | |
| 609 | +GNdarray GPha::backscal_spectrum(void) const | |
| 610 | +{ | |
| 611 | + // Initialise array | |
| 612 | + int size = m_backscal.size(); | |
| 613 | + GNdarray alpha = GNdarray(size); | |
| 614 | + | |
| 615 | + // Compute content | |
| 616 | + for (int i = 0; i < size; ++i) { | |
| 617 | + alpha(i) = m_backscal[i]; | |
| 618 | + } | |
| 619 | + | |
| 620 | + // Return counts | |
| 621 | + return alpha; | |
| 622 | +} | |
| 604 | 623 | |
| 605 | 624 | /***********************************************************************//** |
| 606 | 625 | * @brief Fill spectrum with a value. | ... | ... |