#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 << " "; 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(8) << this->totalFlux(); stream << setw(10) << this->intFlux; stream << setw(9) << this->peakFlux; 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 << 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); 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 << "]"; 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 << setprecision(3); ss.setf(std::ios::fixed); if(this->flagWCS){ ss << "w_" << this->lngtype <<"=" << this->raWidth; ss << ", w_" << this->lattype <<"=" << this->decWidth; ss << ", w_Vel=" << this->velWidth <<"km/s"; ss << ", F\\dT\\u=" << this->intFlux; } else ss << "F\\dT\\u=" << this->intFlux; //ss << ", F\\dT\\u=" << this->totalFlux; ss << ", F\\dP\\u=" << this->peakFlux; string output = ss.str(); return output; }