#include #include #include #include #include #include #include #include using std::endl; using std::setw; using std::setfill; using std::setprecision; void Detection::outputDetectionTextWCS(std::ostream &stream) { /** * outputDetectionTextWCS * Prints to a stream the relevant details of a detected object, * including the WCS parameters, which need to have been calculated. * If they have not (given by the isWCS() function), then the WCS-related outputs * are left blank. */ stream << setw(5) << setfill(' ') << this->id; if(this->flagWCS) stream << setw(14) << this->name; else stream << " "; stream.setf(std::ios::fixed); stream <xcentre + this->xSubOffset; stream << setw(6) << this->ycentre + this->ySubOffset; stream << setw(7) << this->zcentre + this->zSubOffset; if(this->flagWCS){ stream << setw(13) << this->raS; stream << setw(13) << this->decS; stream << setprecision(2); stream << setw(8) << this->raWidth; stream << setw(8) << this->decWidth; stream << setprecision(3); stream << setw(10) << this->vel; stream << setw(9) << this->velWidth; } else stream << " "; if(this->flagWCS) stream<intFlux; else stream<totalFlux; stream << setw(9) << this->peakFlux; stream << setw(4) << this->xmin + this->xSubOffset; stream << setw(4) << this->xmax + this->xSubOffset; stream << setw(4) << this->ymin + this->ySubOffset; stream << setw(4) << this->ymax + this->ySubOffset; stream << setw(5) << this->zmin + this->zSubOffset; stream << setw(5) << this->zmax + this->zSubOffset; stream << setprecision(4); stream << setw(6) << this->pix.size(); stream << setw(5) << this->flagText; stream << endl; resetiosflags(std::ios::fixed); } void outputDetectionTextWCSHeader(std::ostream &stream, wcsprm *wcs) { /** * outputDetectionTextWCSHeader * Prints to a stream the column headers to match the output generated by outputDetectionTextWCS */ string lngtype = wcs->lngtyp; string lattype = wcs->lattyp; stream<xcentre + this->xSubOffset; stream<ycentre + this->ySubOffset; stream<zcentre + this->zSubOffset; stream<xmin + this->xSubOffset; stream<xmax + this->xSubOffset; stream<ymin + this->ySubOffset; stream<ymax + this->ySubOffset; stream<zmin + this->zSubOffset; stream<zmax + this->zSubOffset; stream<pix.size(); stream<totalFlux; stream<peakFlux; stream<xcentre + this->xSubOffset; std::cout<ycentre + this->ySubOffset; std::cout<zcentre + this->zSubOffset; std::cout<xmin + this->xSubOffset; std::cout<xmax + this->xSubOffset; std::cout<ymin + this->ySubOffset; std::cout<ymax + this->ySubOffset; std::cout<zmin + this->zSubOffset; std::cout<zmax + this->zSubOffset; std::cout<pix.size(); std::cout<totalFlux; std::cout<peakFlux; std::cout<id << ": "; ss << this->name ; if(this->getFlagText()!="") ss << " [" << this->getFlagText() << "] "; else ss<< " "; ss << setfill(' '); ss << this->raS << ", "; ss << this->decS; ss << setprecision(3); ss.setf(std::ios::fixed); ss << ", Vel=" << this->vel <<"km/s"; return ss.str(); } string Detection::outputLabelPix() { /** * outputLabelPix * Prints to a string the pixel centres and extents of a detected object. * Returns the string. */ std::stringstream ss; ss.setf(std::ios::fixed); // // This is the OLD code -- have improved the formatting below... // ss << this->pix.size() << " Voxels: "; // ss << setprecision(1) << setfill(' '); // ss <xcentre + this->xSubOffset; // ss <<" " <ycentre + this->ySubOffset; // ss <<" " <zcentre + this->zSubOffset; // ss <<" ["<xmin + this->xSubOffset <<":"<< this->xmax + this->xSubOffset; // ss <<", "<ymin + this->ySubOffset <<":"<< this->ymax + this->ySubOffset; // ss <<", "<zmin + this->zSubOffset <<":"<< this->zmax + this->zSubOffset << "]"; ss << "Centre: "; ss << setprecision(1) << setfill(' '); ss <<"(" << this->xcentre + this->xSubOffset; ss <<", " << this->ycentre + this->ySubOffset; ss <<", " << this->zcentre + this->zSubOffset << ")"; ss <<", Size: " << this->pix.size() << " voxels, "; ss <<"Range: ["<< this->xmin + this->xSubOffset <<":"<< this->xmax + this->xSubOffset; ss <<", " << this->ymin + this->ySubOffset <<":"<< this->ymax + this->ySubOffset; ss <<", " << this->zmin + this->zSubOffset <<":"<< this->zmax + this->zSubOffset << "]"; return ss.str(); } string Detection::outputLabelInfo() { /** * outputLabelInfo * Prints to a string the widths of the object (in position and velocity), * as well as the flux information. * Assumes the WCS parameters of the object have been calculated. * If they have not (given by the isWCS() function), then the WCS-related outputs * are left blank. * Returns the string. */ std::stringstream ss; ss.setf(std::ios::fixed); if(this->flagWCS){ ss << setprecision(2); ss << "w_" << this->lngtype <<"=" << this->raWidth; ss << ", w_" << this->lattype <<"=" << this->decWidth; ss << setprecision(3); ss << ", w_Vel=" << this->velWidth <<"km/s"; ss << ", F\\dint\\u=" << this->intFlux; ss << ", F\\dpeak\\u=" << this->peakFlux; } else{ ss << "#" << setfill('0') << setw(3) << this->id << ": "; ss << setprecision(3); ss << "F\\dtot\\u=" << this->totalFlux; ss << ", F\\dpeak\\u=" << this->peakFlux; } string output = ss.str(); return output; }