source: trunk/src/Cubes/cubes_extended.cc @ 272

Last change on this file since 272 was 272, checked in by Matthew Whiting, 17 years ago
  • Moved the FitsHeader? class & functions to a separate file (fitsHeader.{cc,hh}).
  • This entailed changing a bunch of #include statements.
  • Also fixed up the declaration/implementation of Col functions.
File size: 3.1 KB
Line 
1#include <unistd.h>
2#include <iostream>
3#include <iomanip>
4#include <vector>
5#include <algorithm>
6#include <string>
7#include <math.h>
8
9#include <wcs.h>
10
11#include <duchamp.hh>
12#include <param.hh>
13#include <fitsHeader.hh>
14#include <Cubes/cubes.hh>
15#include <Detection/detection.hh>
16#include <Detection/columns.hh>
17#include <Utils/utils.hh>
18#include <Utils/mycpgplot.hh>
19#include <Utils/Statistics.hh>
20using namespace Column;
21using namespace mycpgplot;
22using namespace Statistics;
23
24void Cube::sortDetections()
25{
26  /**
27   *  A front end to the sort-by functions.
28   *  If there is a good WCS, the detection list is sorted by velocity.
29   *  Otherwise, it is sorted by increasing z-pixel value.
30   *  The ID numbers are then re-calculated.
31   */
32 
33  if(this->head.isWCS()) SortByVel(this->objectList);
34  else SortByZ(this->objectList);
35  for(int i=0; i<this->objectList.size();i++) this->objectList[i].setID(i+1);
36
37}
38//--------------------------------------------------------------------
39
40void Cube::readSavedArrays()
41{
42  /**
43   *  This function reads in reconstructed and/or smoothed arrays that have
44   *   been saved on disk in FITS files.
45   *  To do this it calls the functions Cube::readReconCube() and
46   *   Cube::readSmoothCube().
47   *  The Param set is consulted to determine which of these arrays are needed.
48   */
49
50  // If the reconstructed array is to be read in from disk
51  if( this->par.getFlagReconExists() && this->par.getFlagATrous() ){
52    std::cout << "Reading reconstructed array: "<<std::endl;
53    if( this->readReconCube() == FAILURE){
54      std::stringstream errmsg;
55      errmsg <<"Could not read in existing reconstructed array.\n"
56             <<"Will perform reconstruction using assigned parameters.\n";
57      duchampWarning("Duchamp", errmsg.str());
58      this->par.setFlagReconExists(false);
59    }
60    else std::cout << "Reconstructed array available.\n";
61  }
62
63  if( this->par.getFlagSmoothExists() && this->par.getFlagSmooth() ){
64    std::cout << "Reading Hanning-smoothed array: "<<std::endl;
65    if( this->readSmoothCube() == FAILURE){
66      std::stringstream errmsg;
67      errmsg <<"Could not read in existing smoothed array.\n"
68             <<"Will smooth the cube using assigned parameters.\n";
69      duchampWarning("Duchamp", errmsg.str());
70      this->par.setFlagSmoothExists(false);
71    }
72    else std::cout << "Smoothed array available.\n";
73  }
74   
75}
76
77//--------------------------------------------------------------------
78
79void Cube::plotBlankEdges()
80{
81  /**
82   *  A front end to the drawBlankEdges() function. This draws the lines
83   *   indicating the extent of the non-BLANK region of the cube in the
84   *   PGPLOT colour MAGENTA (from the namespace mycpgplot), using the Cube's
85   *   arrays and dimensions.
86   *
87   *  Note that a PGPLOT device needs to be open. This is only done if the
88   *   appropriate Param parameter is set.
89   */
90  if(this->par.drawBlankEdge()){
91    int colour;
92    cpgqci(&colour);
93    cpgsci(MAGENTA);
94    drawBlankEdges(this->array,this->axisDim[0],this->axisDim[1],this->par);
95    cpgsci(colour);
96  }
97}
98//--------------------------------------------------------------------
99
Note: See TracBrowser for help on using the repository browser.