source: tags/release-1.0.5/src/Cubes/invertCube.cc @ 1455

Last change on this file since 1455 was 62, checked in by Matthew Whiting, 18 years ago

Inversion in case of negative features now deals correctly with the
calculation of parameters, in particular fluxes.
Introduced a new bool flag to the Detection class that records whether the
source is a positive or negative feature. If negative, the peakFlux parameter
is the minimum flux (most negative), else it is the maximum/most positive flux.

File size: 987 bytes
Line 
1#include <Cubes/cubes.hh>
2
3void Cube::invert()
4{
5  /**
6   *  Cube::invert()
7   *   A function that multiplies all non-Blank pixels by -1.
8   *   This is used when searching for negative features.
9   */
10  for(int i=0; i<this->numPixels; i++)
11    if(!this->isBlank(i)) this->array[i] *= -1.;
12}
13
14void Cube::reInvert()
15{
16  /**
17   *  Cube::reInvert()
18   *   A function that switches the array back to the original sign.
19   *   Any objects will have the flux of each pixel inverted as well.
20   *   This is used when searching for negative features.
21   */
22  for(int i=0; i<this->numPixels; i++){
23    if(!this->isBlank(i)){
24      this->array[i] *= -1.;
25      if(this->reconExists) this->recon[i] *= -1.;
26    }
27  }
28
29  for(int i=0; i<this->objectList.size(); i++){
30    this->objectList[i].setNegative(true);
31    for(int pix=0; pix<this->objectList[i].getSize(); pix++){
32      this->objectList[i].setF(pix, -1. * this->objectList[i].getF(pix) );
33    }
34    this->objectList[i].calcParams();
35  }
36
37}
Note: See TracBrowser for help on using the repository browser.