#include #include #include #include #include #include using std::setw; using std::setfill; using std::setprecision; std::string getIAUNameEQ(double ra, double dec, float equinox) { /** * std::string getIAUNameEQ(double, double, float) * both ra and dec are assumed to be in degrees. * returns name of the form J1234-4321 for equinox = 2000, * and B1234-4321 otherwise */ double raHrs = ra / 15.; int h = int(raHrs); int m = (int)(fmod(raHrs,1.)*60.); int s = (int)(fmod(raHrs,1./60.)*3600.); std::stringstream ss(std::stringstream::out); ss.setf(std::ios::showpoint); ss.setf(std::ios::fixed); if(equinox==2000.) ss << "J"; else ss << "B"; ss<= 360.) { thisDec -= 360.; } if(type=="RA") thisDec /= 15.; // Convert to hours. } else if((type=="DEC")||(type=="GLAT")){ if(thisDec<0.) sign = "-"; else sign = "+"; } else { // UNKNOWN TYPE -- DEFAULT TO RA. std::cerr << "WARNING : Unknown axis type (" << type << "). Defaulting to using RA.\n"; while (thisDec < 0.) { thisDec += 360.; } while (thisDec >= 360.) { thisDec -= 360.; } thisDec /= 15.; } dec_abs = fabs(thisDec); deg = int(dec_abs); min = int(fmod(dec_abs,1.)*60.); sec = fmod(dec_abs,onemin)*3600.; if(fabs(sec-60.)<1.e-10){ // to prevent rounding errors stuffing things up sec=0.; min++; } std::stringstream ss(std::stringstream::out); ss.setf(std::ios::showpoint); ss.setf(std::ios::fixed); ss << sign; ss << setw(degSize)<