source: trunk/src/Detection/spectrumDetect.cc @ 192

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

A large commit based around a few changes:

  • Implemented the new SNRpeak column, defining it in columns.cc and printing it out in outputDetection.cc.
  • Corrected a bug in the subsection parsing that miscalculated the pixel offset when "*" was given as an axis range.
  • setupFDR now calculates the flux threshold so this can be reported.
  • The object flags now distinguish between spatial edge and spectral edge locations.
  • Other minor changes for clarity's sake.
File size: 1.2 KB
Line 
1/**
2 *  spectrumDetect.cc
3 *
4 * A detection algorithm that searches in a single 1-D spectrum.
5 *
6 * INPUTS:
7 *    image     -- an Image object, containing a 1-D image that has had
8 *                 its StatsContainer object defined.
9 *   The detection array in image will be filled, according to
10 *   the location of the objects in the image.
11 *
12 */
13
14#include <Cubes/cubes.hh>
15#include <Detection/detection.hh>
16
17enum STATUS { NONOBJECT, OBJECT };
18
19void Image::spectrumDetect()
20{
21  STATUS status;
22  Detection *obj = new Detection;
23  Pixel *pix = new Pixel;
24  bool isObject;
25
26  status = NONOBJECT;
27  for(int pos=0;pos<(this->axisDim[0]+1);pos++){
28
29    isObject=false;
30    if(pos<this->axisDim[0]){
31      pix->setXYF(pos, 0, this->array[pos] );
32      isObject = this->isDetection(pos,0);
33    }
34
35    if(isObject){
36      if(status != OBJECT) status = OBJECT;
37      obj->addPixel(*pix);
38    }
39    else{
40      if(status == OBJECT){ // if we were on an object and have left
41        if(obj->getSize() >= this->minSize){ // if it's big enough
42          obj->calcParams(); // work out midpoints, fluxes etc
43          this->addObject(*obj);  // add to list.
44        }
45        obj->clearDetection();
46      }
47      status = NONOBJECT;
48    }
49
50  }
51
52  // clean up and remove declared memory
53  delete obj,pix;
54}
Note: See TracBrowser for help on using the repository browser.