AstValidate Class Reference

#include <AstValidate.h>

List of all members.

Public Member Functions

 AstValidate ()
virtual ~AstValidate ()
bool RunAllTests (void)

Private Member Functions

bool TestLocalToIdeal ()
bool TestIdealToHorizon ()
bool TestHorizonToEquatorial ()
bool TestEquatorialToCelestial ()
bool TestJulianDateToSiderealTime ()

Detailed Description

Definition at line 18 of file AstValidate.h.


Constructor & Destructor Documentation

AstValidate::AstValidate (  ) 

Definition at line 28 of file AstValidate.cc.

00028                          {
00029   //
00030   //  Purpose:  Default constructor.
00031   //
00032   //  Arguments: none.
00033   //
00034   //  Return:    n/a.
00035   //
00036   //  Contact:   S. Kasahara
00037   // 
00038 
00039 }

AstValidate::~AstValidate (  )  [virtual]

Definition at line 41 of file AstValidate.cc.

00041                           {
00042   //
00043   //  Purpose:  Destructor.
00044   //
00045   //  Contact:   S. Kasahara
00046   // 
00047 
00048 }


Member Function Documentation

bool AstValidate::RunAllTests ( void   ) 

Definition at line 328 of file AstValidate.cc.

References TestEquatorialToCelestial(), TestHorizonToEquatorial(), TestIdealToHorizon(), TestJulianDateToSiderealTime(), and TestLocalToIdeal().

Referenced by main().

00328                               {
00329   //
00330   //  Purpose:  Run sequence of AstroUtil package validity tests.
00331   //
00332   //  Arguments: none.
00333   //
00334   //  Return:    pass (if all tests successful) or fail
00335   //
00336   //  Contact:   S. Kasahara
00337   // 
00338 
00339   bool allPassed = true;
00340 
00341   cout << "*** Test local to ideal coordinate conversion  *** " << endl;
00342   if ( this -> TestLocalToIdeal() ) cout << "*** Passed ***" << endl;
00343   else {
00344     cout << "*** Failed ***" << endl;
00345     allPassed = false;
00346   }
00347 
00348   cout << "*** Test ideal to horizon coordinate conversion  *** " << endl;
00349   if ( this -> TestIdealToHorizon() ) cout << "*** Passed ***" << endl;
00350   else {
00351     cout << "*** Failed ***" << endl;
00352     allPassed = false;
00353   }
00354 
00355   cout << "*** Test horizon to equatorial coordinate conversion  *** " << endl;
00356   if ( this -> TestHorizonToEquatorial() ) cout << "*** Passed ***" << endl;
00357   else {
00358     cout << "*** Failed ***" << endl;
00359     allPassed = false;
00360   }
00361 
00362   cout << "*** Test equatorial to celestial coordinate conversion  *** "<<endl;
00363   if ( this -> TestEquatorialToCelestial() ) cout << "*** Passed ***" << endl;
00364   else {
00365     cout << "*** Failed ***" << endl;
00366     allPassed = false;
00367   }
00368 
00369   cout << "*** Test julian date to gmst conversion  *** "<<endl;
00370   if ( this -> TestJulianDateToSiderealTime() ) cout << "*** Passed ***" << endl;
00371   else {
00372     cout << "*** Failed ***" << endl;
00373     allPassed = false;
00374   }
00375 
00376   return allPassed;
00377 
00378 }

bool AstValidate::TestEquatorialToCelestial (  )  [private]

Definition at line 261 of file AstValidate.cc.

References AstUtil::CelestialToEquatorial(), and AstUtil::EquatorialToCelestial().

Referenced by RunAllTests().

00261                                             {
00262   //
00263   //  Purpose:  Test equatorial to celestial coordinate conversion
00264   //
00265   //  Arguments: none.
00266   //
00267   //  Return:    pass or fail
00268   //
00269   //  Contact:   S. Kasahara
00270   // 
00271 
00272   bool pass = true;
00273 
00274   double haold = 60.;
00275   double gmst = 12.2;
00276   double longitude = -92.;
00277   
00278   double ra;
00279   AstUtil::EquatorialToCelestial(haold,gmst,longitude,ra);
00280   
00281   double hanew;
00282   AstUtil::CelestialToEquatorial(ra,gmst,longitude,hanew);
00283 
00284   cout << "haold = " << haold << ", hanew = " << hanew << endl;
00285   cout << "ra = " << ra << endl;
00286 
00287   haold = -60.;
00288   AstUtil::EquatorialToCelestial(haold,gmst,longitude,ra);
00289   
00290   AstUtil::CelestialToEquatorial(ra,gmst,longitude,hanew);
00291   
00292   cout << "haold = " << haold << ", hanew = " << hanew << endl;
00293   cout << "ra = " << ra << endl;
00294 
00295   return pass;
00296 
00297 }

bool AstValidate::TestHorizonToEquatorial (  )  [private]

Definition at line 145 of file AstValidate.cc.

References AstUtil::EquatorialToHorizon(), and AstUtil::HorizonToEquatorial().

Referenced by RunAllTests().

00145                                           {
00146   //
00147   //  Purpose:  Test horizon to equatorial coordinate conversion
00148   //
00149   //  Arguments: none.
00150   //
00151   //  Return:    pass or fail
00152   //
00153   //  Contact:   S. Kasahara
00154   // 
00155 
00156   bool pass = true;
00157 
00158   double altold = 60.;
00159   double aziold  =-30.;
00160   double latitude = 40.;
00161   
00162   double hourangle,declination;
00163   AstUtil::HorizonToEquatorial(altold,aziold,latitude,hourangle,declination);
00164   
00165   double altnew,azinew;
00166   AstUtil::EquatorialToHorizon(hourangle,declination,latitude,altnew,azinew);
00167 
00168   cout << "altold = " << altold << ", altnew = " << altnew << endl;
00169   cout << "aziold = " << aziold << ", azinew = " << azinew << endl;
00170   cout << "hourangle = " << hourangle << ", declination = " << declination 
00171        << endl;
00172 
00173   altold = 30.;
00174   aziold  = 150.;
00175   
00176   AstUtil::HorizonToEquatorial(altold,aziold,latitude,hourangle,declination);
00177   
00178   AstUtil::EquatorialToHorizon(hourangle,declination,latitude,altnew,azinew);
00179 
00180   cout << "altold = " << altold << ", altnew = " << altnew << endl;
00181   cout << "aziold = " << aziold << ", azinew = " << azinew << endl;
00182   cout << "hourangle = " << hourangle << ", declination = " << declination 
00183        << endl;
00184 
00185   altold = 0.;
00186   aziold  = 150.;
00187   
00188   AstUtil::HorizonToEquatorial(altold,aziold,latitude,hourangle,declination);
00189   
00190   AstUtil::EquatorialToHorizon(hourangle,declination,latitude,altnew,azinew);
00191 
00192   cout << "altold = " << altold << ", altnew = " << altnew << endl;
00193   cout << "aziold = " << aziold << ", azinew = " << azinew << endl;
00194   cout << "hourangle = " << hourangle << ", declination = " << declination 
00195        << "latitude = " << latitude << endl;
00196 
00197   altold = -10.;
00198   aziold  = 150.;
00199   
00200   AstUtil::HorizonToEquatorial(altold,aziold,latitude,hourangle,declination);
00201   
00202   AstUtil::EquatorialToHorizon(hourangle,declination,latitude,altnew,azinew);
00203 
00204   cout << "altold = " << altold << ", altnew = " << altnew << endl;
00205   cout << "aziold = " << aziold << ", azinew = " << azinew << endl;
00206   cout << "hourangle = " << hourangle << ", declination = " << declination 
00207        << "latitude = " << latitude << endl;
00208 
00209   altold = -20.;
00210   aziold  = 150.;
00211   
00212   AstUtil::HorizonToEquatorial(altold,aziold,latitude,hourangle,declination);
00213   
00214   AstUtil::EquatorialToHorizon(hourangle,declination,latitude,altnew,azinew);
00215 
00216   cout << "altold = " << altold << ", altnew = " << altnew << endl;
00217   cout << "aziold = " << aziold << ", azinew = " << azinew << endl;
00218   cout << "hourangle = " << hourangle << ", declination = " << declination 
00219        << "latitude = " << latitude << endl;
00220 
00221   altold = -30.;
00222   aziold  = 150.;
00223   
00224   AstUtil::HorizonToEquatorial(altold,aziold,latitude,hourangle,declination);
00225   
00226   AstUtil::EquatorialToHorizon(hourangle,declination,latitude,altnew,azinew);
00227 
00228   cout << "altold = " << altold << ", altnew = " << altnew << endl;
00229   cout << "aziold = " << aziold << ", azinew = " << azinew << endl;
00230   cout << "hourangle = " << hourangle << ", declination = " << declination 
00231        << "latitude = " << latitude << endl;
00232 
00233   altold = -40.;
00234   aziold  = 150.;
00235   
00236   AstUtil::HorizonToEquatorial(altold,aziold,latitude,hourangle,declination);
00237   
00238   AstUtil::EquatorialToHorizon(hourangle,declination,latitude,altnew,azinew);
00239 
00240   cout << "altold = " << altold << ", altnew = " << altnew << endl;
00241   cout << "aziold = " << aziold << ", azinew = " << azinew << endl;
00242   cout << "hourangle = " << hourangle << ", declination = " << declination 
00243        << "latitude = " << latitude << endl;
00244 
00245   altold = -50.;
00246   aziold  = 150.;
00247   
00248   AstUtil::HorizonToEquatorial(altold,aziold,latitude,hourangle,declination);
00249   
00250   AstUtil::EquatorialToHorizon(hourangle,declination,latitude,altnew,azinew);
00251 
00252   cout << "altold = " << altold << ", altnew = " << altnew << endl;
00253   cout << "aziold = " << aziold << ", azinew = " << azinew << endl;
00254   cout << "hourangle = " << hourangle << ", declination = " << declination 
00255        << "latitude = " << latitude << endl;
00256 
00257   return pass;
00258 
00259 }

bool AstValidate::TestIdealToHorizon (  )  [private]

Definition at line 99 of file AstValidate.cc.

References AstUtil::HorizonToIdeal(), and AstUtil::IdealToHorizon().

Referenced by RunAllTests().

00099                                      {
00100   //
00101   //  Purpose:  Test ideal to horizon
00102   //
00103   //  Arguments: none.
00104   //
00105   //  Return:    pass or fail
00106   //
00107   //  Contact:   S. Kasahara
00108   // 
00109 
00110   bool pass = true;
00111 
00112   double dcosxold =  0.45;
00113   double dcosyold = -0.45;
00114   double dcoszold =  0.771362;
00115   double altitude,azimuth;
00116   
00117   AstUtil::IdealToHorizon(dcosxold,dcosyold,dcoszold,altitude,azimuth);
00118   
00119   double dcosxnew, dcosynew, dcosznew;
00120   AstUtil::HorizonToIdeal(altitude,azimuth,dcosxnew,dcosynew,dcosznew);
00121 
00122   cout << "dcosxold = " << dcosxold << ", dcosxnew = " << dcosxnew << endl;
00123   cout << "dcosyold = " << dcosyold << ", dcosynew = " << dcosynew << endl;
00124   cout << "dcoszold = " << dcoszold << ", dcosznew = " << dcosznew << endl;
00125   cout << "altitude = " << altitude << ", azimuth = " << azimuth << endl;
00126 
00127   dcosxold = -0.45;
00128   dcosyold =  0.45;
00129   dcoszold =  -0.771362;
00130   
00131   AstUtil::IdealToHorizon(dcosxold,dcosyold,dcoszold,altitude,azimuth);
00132 
00133   
00134   AstUtil::HorizonToIdeal(altitude,azimuth,dcosxnew,dcosynew,dcosznew);
00135 
00136   cout << "dcosxold = " << dcosxold << ", dcosxnew = " << dcosxnew << endl;
00137   cout << "dcosyold = " << dcosyold << ", dcosynew = " << dcosynew << endl;
00138   cout << "dcoszold = " << dcoszold << ", dcosznew = " << dcosznew << endl;
00139   cout << "altitude = " << altitude << ", azimuth = " << azimuth << endl;
00140 
00141   return pass;
00142 
00143 }

bool AstValidate::TestJulianDateToSiderealTime (  )  [private]

Definition at line 299 of file AstValidate.cc.

References AstUtil::GSTToLST(), AstUtil::JulianToGAST(), and AstUtil::JulianToGMST().

Referenced by RunAllTests().

00299                                                {
00300   //
00301   //  Purpose:  Test julian date to gmst conversion
00302   //
00303   //  Arguments: none.
00304   //
00305   //  Return:    pass or fail
00306   //
00307   //  Contact:   S. Kasahara
00308   // 
00309 
00310   bool pass = true;
00311 
00312   double juliandate = 2444970.5;
00313   double gmst,gast;
00314   AstUtil::JulianToGMST(juliandate,gmst);
00315   cout << "juliandate " << juliandate << " in Munich(lon 11.60833) " << endl;
00316   cout << "gmst " << gmst << ", should be 6.688139 " << endl;
00317   AstUtil::JulianToGAST(juliandate,gast);
00318   cout << "gast " << gast << ", should be 6.687861 " << endl;
00319   double last;
00320   double longitude = 11.6083333;
00321   AstUtil::GSTToLST(gast,longitude,last);
00322   cout << "last " << last << ", should be 7.46175 " << endl;
00323 
00324   return pass;
00325 
00326 }

bool AstValidate::TestLocalToIdeal (  )  [private]

Definition at line 50 of file AstValidate.cc.

References AstUtil::IdealToLocal(), Detector::kFar, Detector::kNear, and AstUtil::LocalToIdeal().

Referenced by RunAllTests().

00050                                    {
00051   //
00052   //  Purpose:  Test local to ideal
00053   //
00054   //  Arguments: none.
00055   //
00056   //  Return:    pass or fail
00057   //
00058   //  Contact:   S. Kasahara
00059   // 
00060 
00061   bool pass = true;
00062 
00063   double dcosxold =  0.45;
00064   double dcosyold = -0.45;
00065   double dcoszold =  0.771362;
00066   double dcosx_ideal, dcosy_ideal, dcosz_ideal;
00067   Detector::Detector_t dettype = Detector::kFar;
00068   
00069   AstUtil::LocalToIdeal(dcosxold,dcosyold,dcoszold,dettype,dcosx_ideal,
00070                         dcosy_ideal,dcosz_ideal);
00071   
00072   double dcosxnew, dcosynew, dcosznew;
00073   AstUtil::IdealToLocal(dcosx_ideal,dcosy_ideal,dcosz_ideal,dettype,
00074                         dcosxnew,dcosynew,dcosznew);
00075 
00076   cout << "dcosxold = " << dcosxold << ", dcosxnew = " << dcosxnew << endl;
00077   cout << "dcosyold = " << dcosyold << ", dcosynew = " << dcosynew << endl;
00078   cout << "dcoszold = " << dcoszold << ", dcosznew = " << dcosznew << endl;
00079 
00080   dcosxold = -0.45;
00081   dcosyold =  0.45;
00082   dcoszold =  -0.771362;
00083   dettype = Detector::kNear;
00084   
00085   AstUtil::LocalToIdeal(dcosxold,dcosyold,dcoszold,dettype,dcosx_ideal,
00086                         dcosy_ideal,dcosz_ideal);
00087   
00088   AstUtil::IdealToLocal(dcosx_ideal,dcosy_ideal,dcosz_ideal,dettype,
00089                         dcosxnew,dcosynew,dcosznew);
00090 
00091   cout << "dcosxold = " << dcosxold << ", dcosxnew = " << dcosxnew << endl;
00092   cout << "dcosyold = " << dcosyold << ", dcosynew = " << dcosynew << endl;
00093   cout << "dcoszold = " << dcoszold << ", dcosznew = " << dcosznew << endl;
00094 
00095   return pass;
00096 
00097 }


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1