CARMA C++
carma::services::Ephemeris Class Reference

Ephemeris wraps the NOVAS library and any other ephemeris related functions into a simple to use class. More...

#include <carma/services/Ephemeris.h>

Public Member Functions

double angle2000 (void)
 Compute the rotation of the coordinate system between the mean equatorial coordinates (ra,dec) at J2000 and the apparent coordinates as the current epoch. More...
 
void Debug (void)
 debug routine that dumps out the state of the Ephemeris with lots of human readable verbiage More...
 
 Ephemeris ()
 Construct a default Ephemeris. More...
 
 Ephemeris (const std::string &sourceName, const std::string &catalogName="")
 Constructor with a source name See also setSource() with the same calling sequence. More...
 
 Ephemeris (const Source &source)
 constructor from a source See also setSource() with the same calling sequence More...
 
 Ephemeris (const Location &location)
 Constructor from a location (not implemented yet) More...
 
double getAz (void)
 get the Azimuth More...
 
Vector< double > getAzEl (double mjd, double ra, double dec)
 Convert a given current epoch topocentric RA,DEC into AzEl. More...
 
Vector< AnglegetAzEl (double mjd, const Angle &ra, const Angle &dec)
 Convert a given current epoch topocentric RA,DEC into AzEl. More...
 
double getDec (void)
 get the topocentric DEC in the current epoch More...
 
double getDoppler (velocityFrameType frameType=FRAME_TOPOGRAPHIC)
 get the Doppler velocity in a specific frame of reference Note that normally you want the Topocentric velocity for observations, but for ephemeris usage LSR or Heliocentric may be more commonly used. More...
 
double getEl (void)
 get the Elevation, in radians. More...
 
double getFreq (void) const
 
Location getLocation (void) const
 
double getMJD () const
 
double getRa (void)
 get the topocentric RA in the current epoch More...
 
Vector< double > getRaDec (double mjd, double az, double el)
 Convert a given current Az,El into Ra,Dec for the current site This is a somewhat peculiar routine, since novas only has the reverse routine 'equ2hor' and there is no hor2equ'\ Use with caution, as not all ephemeris state information may have been initialized properly. More...
 
double getRefrac (void) const
 get the last used refraction correction. More...
 
Source getSource ()
 
bool isFixed (const std::string &sourceName)
 find out if a source is a supported fixed source (e.g. More...
 
void planetDebug (void)
 debug routine to calculate and print parameters for planetary sources. More...
 
void setAzElOffsets (const double daz, const double del)
 sky offset in AZ and EL applied, until a new source has been specified. More...
 
void setBody (const int type, const int number, const std::string &name)
 set a SolarSystemBody not implemented yet More...
 
void setBody (const std::string &name)
 set a SolarSystemBody not implemented yet More...
 
void setDeltaT (const double deltat=0)
 set the time correction, in seconds, added to the MJD to get dynamical time (TT or TDB). More...
 
void setEphemerisTableSource (const double ra2000, const double dec2000, const double doppler, const double distance)
 NB: private function. More...
 
void setFreq (const double freq)
 update the observing frequency for refraction computation. More...
 
void setLocation (const Location &location)
 Set the site information. More...
 
void setLocation (const std::string &observatory, bool topocentric=true)
 Set the observatory for the internal location, as taken from a list that is defined via the Location class. More...
 
void setMJD (const double mjd=0)
 set the time of observation (defaults to the current time) and a few ancillary variables (deltat, xpolar, ypolar) from AstroTime that are needed within the Ephemeris More...
 
void setRaDecOffsets (const double dra, const double ddec)
 sky offset in RA and DEC applied, until a new source has been specified. More...
 
void setRefraction (const bool refract)
 Turn off refraction explicitly. More...
 
void setSource (const Source &source)
 set a source (the catalog entry. More...
 
void setSource (const std::string &sourceName, const std::string &catalogName="")
 set a source from a name, and an optional (user) catalog planets are also allowed. More...
 
void SetSpinningBodySpot (double majorAxis, double minorAxis, double axisAngle, double tiltAngle, double mjd, double Longitude, double Latitude, double SpinRate)
 Set properties to be passed to novas about spinning bodies in order to produce an emphemeris for a spot on a spinning body. More...
 
void setWeather (const double atmPressure, const double airTemp, const double relHumid)
 update the weather, such that refraction is more accurate. More...
 
void ShowVector (void)
 experiments with tracking spots on DE405 planets (object type=0) More...
 
bool useSource (void) const
 Was a true Source was used, or should sourcename string be used to re-use an ephemeris (important for EphemerisTables) More...
 
virtual ~Ephemeris ()
 Destructor. More...
 

Protected Member Functions

void compute (void)
 the internal ephemeris compute engine. More...
 
void ComputeFixedAzEl (void)
 compute the Az,El between two Location's, used internally More...
 
Vector< double > dms (double angle)
 return a vector with (sign,D,M,S) values for a given angle 0..360 note that D and M will be integers More...
 
Vector< double > hms (double angle)
 return a vector with (sign,H,M,S) values for a given angle 0..360 note that H and M will be integers More...
 
void initialize (void)
 initialize all variables for this class. More...
 
bool my_set_body (short int type, short int number, const std::string &sourceName)
 NOVAS helper routine for isPlanet() to construct a NOVAS body for a particular planet sourceName is actually the filename of the ephem file here. More...
 
double refract (const double elevation)
 compute refraction angle. More...
 

Detailed Description

Ephemeris wraps the NOVAS library and any other ephemeris related functions into a simple to use class.

Time is mostly handled by AstroTime For most of CARMA work one instantiates this class with a source, viz.
Ephemeris e; after which the time should be set (default is current time)
e.setMJD(mjd); e.setSource('venus') and probably some weather and observing site info (they default to CARMA at 100 GHz with average weather
e.setLocation(location); e.setWeather(pres_mB,temp_C,relhum_percent); e.setFreq(freq_Hz); and the RA/DEC or AZ/EL can be retrieved (all angles are in radians)
double ra=e.getRa(); double az=e.getAz(); or an instantaneous:
Vector<double> azel=e.getAzEl(mjd,ra,dec)

Caution: the Ephemeris class can initialize sources in three ways, in doing so the Amar should not expect theirs paths to cross over! 1) setSource(Source &) 2) setSource(string &) 3) setSource(double ra, double dec, double doppler)

Definition at line 91 of file Ephemeris.h.

Constructor & Destructor Documentation

carma::services::Ephemeris::Ephemeris ( )

Construct a default Ephemeris.

The default constructor also does a few sneaky things: site is the CARMA array center (use setLocation()) time is now (use setMJD()) temp, pressure, humidity (use setWeathe()) observing frequency for refraction computation (use setFreq()) Note there is no default for a Source. There are 3 ways (2 good ones, one deprecated one) to set a source to observe.

carma::services::Ephemeris::Ephemeris ( const std::string &  sourceName,
const std::string &  catalogName = "" 
)

Constructor with a source name See also setSource() with the same calling sequence.

Parameters
sourceNamesourcename, can also be a planet
catalogNameoptional filename for source catalog (default is CARMA/conf/catalogs/SystemSource.cat)
virtual carma::services::Ephemeris::~Ephemeris ( )
virtual

Destructor.

carma::services::Ephemeris::Ephemeris ( const Source source)

constructor from a source See also setSource() with the same calling sequence

Parameters
sourcea source in full FK5
carma::services::Ephemeris::Ephemeris ( const Location location)

Constructor from a location (not implemented yet)

Parameters
locationthe station location

Member Function Documentation

double carma::services::Ephemeris::angle2000 ( void  )

Compute the rotation of the coordinate system between the mean equatorial coordinates (ra,dec) at J2000 and the apparent coordinates as the current epoch.

The minimum requirements are setting an epoch and ra/dec (J2000) to derive the rotation angle from.

Returns
angle, in radians.
void carma::services::Ephemeris::compute ( void  )
protected

the internal ephemeris compute engine.

Given an internal state (site, sky, time, weather etc.) it computes apparent ra,dec,az,el, time constants etc.etc. A number of the set-routines in Ephemeris will trigger recomputing the state of the Ephemeris if queries are made (the get-routines)

void carma::services::Ephemeris::ComputeFixedAzEl ( void  )
protected

compute the Az,El between two Location's, used internally

void carma::services::Ephemeris::Debug ( void  )

debug routine that dumps out the state of the Ephemeris with lots of human readable verbiage

Vector<double> carma::services::Ephemeris::dms ( double  angle)
protected

return a vector with (sign,D,M,S) values for a given angle 0..360 note that D and M will be integers

double carma::services::Ephemeris::getAz ( void  )

get the Azimuth

Returns
the Azimuth,, in radians
Vector<double> carma::services::Ephemeris::getAzEl ( double  mjd,
double  ra,
double  dec 
)

Convert a given current epoch topocentric RA,DEC into AzEl.

This routine directly calls novas::equ2hor Use with caution, as not all ephemeris state information may have been initialized properly.

Todo:

clarify this what you mean with 'properly'

this routine should also set the mjd,ra,dec internally

Parameters
mjdinput MJD (modified julian date, JD-2400000.5) [UTC]
racurrent epoch topocentric RA in radians
deccurrent epoch topocentric DEC in radians
Returns
a pair, as a vector, of Az and El. Both in radians
Vector<Angle> carma::services::Ephemeris::getAzEl ( double  mjd,
const Angle ra,
const Angle dec 
)

Convert a given current epoch topocentric RA,DEC into AzEl.

This routine directly calls novas::equ2hor Use with caution, as not all ephemeris state information may have been initialized properly.

Todo:
this routine should also set the mjd,ra,dec internally
Parameters
mjdinput MJD (modified julian date, JD-2400000.5) [UTC]
racurrent epoch topocentric RA
deccurrent epoch topocentric DEC
Returns
a pair, as a vector, of Az and El, in conformable quantities
double carma::services::Ephemeris::getDec ( void  )

get the topocentric DEC in the current epoch

Returns
the current DEC, in radians
double carma::services::Ephemeris::getDoppler ( velocityFrameType  frameType = FRAME_TOPOGRAPHIC)

get the Doppler velocity in a specific frame of reference Note that normally you want the Topocentric velocity for observations, but for ephemeris usage LSR or Heliocentric may be more commonly used.

Note for solar system objects (and those using an external ephemeris) the resulting doppler is always placed at 0, to ease comparison at different epochs.

Returns
Doppler velocity, in m/s
double carma::services::Ephemeris::getEl ( void  )

get the Elevation, in radians.

If a non-zero frequency was set, or if setRefraction(true) was set in this ephemeris, refraction has been added into the elevation. Also note that refraction will be 0 for negative elevation. See getRefrac() to get the last used refraction value.

Returns
the Elevation, in radians
double carma::services::Ephemeris::getFreq ( void  ) const
Returns
observing frequency, in Hz
Location carma::services::Ephemeris::getLocation ( void  ) const
Returns
the Location stored herein, the vantage point from which all sky coordinates are calculated.
double carma::services::Ephemeris::getRa ( void  )

get the topocentric RA in the current epoch

Returns
the current RA, in radians
Vector<double> carma::services::Ephemeris::getRaDec ( double  mjd,
double  az,
double  el 
)

Convert a given current Az,El into Ra,Dec for the current site This is a somewhat peculiar routine, since novas only has the reverse routine 'equ2hor' and there is no hor2equ'\ Use with caution, as not all ephemeris state information may have been initialized properly.

Parameters
mjdinput MJD (modified julian date, JD-2400000.5)
azcurrent epoch AZ in radians
alcurrent epoch EL in radians
Returns
a pair, as a vector, of Ra and Dec. Both in radians
double carma::services::Ephemeris::getRefrac ( void  ) const

get the last used refraction correction.

Only use this after getAz/getEl/getAzEl have been called.

Todo:
rename this to getRefract()
Returns
the Refraction Correction, in degrees!.
Source carma::services::Ephemeris::getSource ( )
Returns
the Source stored herein.

Note if Ephemeris was instantiated from the private method setSource(RA,DEC,VEL) instead of a full Source, the returned Source is very minimal and should not be used in its full context.

Vector<double> carma::services::Ephemeris::hms ( double  angle)
protected

return a vector with (sign,H,M,S) values for a given angle 0..360 note that H and M will be integers

void carma::services::Ephemeris::initialize ( void  )
protected

initialize all variables for this class.

called by all constructors.

bool carma::services::Ephemeris::isFixed ( const std::string &  sourceName)

find out if a source is a supported fixed source (e.g.

transmitter) from the source catalog. Fixed sources need an Long,Lat,Elev from the source catalog from which a nominal Az,El can be computed.

bool carma::services::Ephemeris::my_set_body ( short int  type,
short int  number,
const std::string &  sourceName 
)
protected

NOVAS helper routine for isPlanet() to construct a NOVAS body for a particular planet sourceName is actually the filename of the ephem file here.

the sourcename may also have been upper cased, e.g. /somehere/conf/catalogs/SUN15.ephem since both lower and upper case will be matched.

void carma::services::Ephemeris::planetDebug ( void  )

debug routine to calculate and print parameters for planetary sources.

Todo:
absorb this stuff into Planet class.
double carma::services::Ephemeris::refract ( const double  elevation)
protected

compute refraction angle.

to be added to the elevation to get the new refracted elevation. Note it always returns refraction (unless freq < 1 or el < 0) irrespective of setRefrect(true|false)

It uses Atmosphere::computeRefractionCorrection() to compute the the refraction

Parameters
elevation,inradians
Returns
refraction, in radians
void carma::services::Ephemeris::setAzElOffsets ( const double  daz,
const double  del 
)

sky offset in AZ and EL applied, until a new source has been specified.

Note you can only apply offsets in AZ/EL or RA/DEC, not both.

Parameters
dazsky offset in AZ (radians)
delsky offset in EL (radians)
void carma::services::Ephemeris::setBody ( const int  type,
const int  number,
const std::string &  name 
)

set a SolarSystemBody not implemented yet

void carma::services::Ephemeris::setBody ( const std::string &  name)

set a SolarSystemBody not implemented yet

void carma::services::Ephemeris::setDeltaT ( const double  deltat = 0)

set the time correction, in seconds, added to the MJD to get dynamical time (TT or TDB).

  deltat = UTC-UT1 + leap_seconds + 32.184 

It is approximately 65 seconds in the current era. This is normally not needed and retrieved by the Ephemeris class from the IERS tables. this routine only exist(ed) to cheat and compare with xephem it should really not be exposed to the public

** to be deprecated **

Parameters
deltatcorrection in seconds
void carma::services::Ephemeris::setEphemerisTableSource ( const double  ra2000,
const double  dec2000,
const double  doppler,
const double  distance 
)

NB: private function.

void carma::services::Ephemeris::setFreq ( const double  freq)

update the observing frequency for refraction computation.

This is only needed for a more accurate refraction model If this function is used, setWeather() should also be used. Currently there is separate model for radio and optical, but is otherwise independant of frequency, but check updates to carma::services::Atmosphere::

Parameters
freqobserving frequency, in Hz.
void carma::services::Ephemeris::setLocation ( const Location location)

Set the site information.

This will only set the location of the observatory, See also setWeather, setFreq, setMJD, setSource for other functions related to setting ephemeris information.

Parameters
locationLocation the station antenna coordinates
void carma::services::Ephemeris::setLocation ( const std::string &  observatory,
bool  topocentric = true 
)

Set the observatory for the internal location, as taken from a list that is defined via the Location class.

See also CARMA/conf/catalogs/Observatory.cat

Parameters
observatoryname of the observatory
topocentricpass on if RA/DEC should be topocentric (vs. geocentric)
See Also
setLocation(Location)
void carma::services::Ephemeris::setMJD ( const double  mjd = 0)

set the time of observation (defaults to the current time) and a few ancillary variables (deltat, xpolar, ypolar) from AstroTime that are needed within the Ephemeris

Parameters
mjdinput modified julian date (JD-2400000.5)
void carma::services::Ephemeris::setRaDecOffsets ( const double  dra,
const double  ddec 
)

sky offset in RA and DEC applied, until a new source has been specified.

A positive dra means shifted to the east, in the usual astronomical fashion. Note you can only apply offsets in RA/DEC or AZ/EL, not both.

Parameters
drasky offset in RA (radians)
ddecsky offset in DEC (radians)
void carma::services::Ephemeris::setRefraction ( const bool  refract)

Turn off refraction explicitly.

Any setting of observing parameters that control refraction will now be ignored. This is useful when observing very nearby sources, such as the transmitter, when there no appreciable atmosphere to look through. Also note that refraction will be 0 for negative elevation.

void carma::services::Ephemeris::setSource ( const Source source)

set a source (the catalog entry.

This is the first (of 3) methods to set a source for the ephemeris. Note a new source will reset any existing RA/DEC or AZ/EL offsets.

Parameters
sourceSource object to represent
void carma::services::Ephemeris::setSource ( const std::string &  sourceName,
const std::string &  catalogName = "" 
)

set a source from a name, and an optional (user) catalog planets are also allowed.

This is the second (of 3) methods to set a source for the ephemeris. Note a new source will reset any existing RA/DEC or AZ/EL offsets. This member function also understands a small set of special "fixed" locations near the CARMA array, which must appear in the "position" field of the Observatory.cat catalog. The "configs" field for these stations is called "fixed". An example is the transmitter (sourceName=trans) The search order of sources is as follows: 1) planet (NOVAS uses JPL DE405 tables for these) 2) ephemeris tables (SOURCE.ephem in the user or system catalogs directory) 3) fixed source in the local terrain (e.g. "trans" for transmitter) 4) source from a catalog (user catalog or default SystemSource.cat)

Parameters
sourceNamesource name
catalogNamecatalog name, defaults to CARMA/conf/catalogs/SystemSource.cat as derived from the [sic] location of the executable If an existing catalog is given, that one is tried before the system catalog.
void carma::services::Ephemeris::SetSpinningBodySpot ( double  majorAxis,
double  minorAxis,
double  axisAngle,
double  tiltAngle,
double  mjd,
double  Longitude,
double  Latitude,
double  SpinRate 
)

Set properties to be passed to novas about spinning bodies in order to produce an emphemeris for a spot on a spinning body.

Parameters
majorAxisarcsec
minorAxisarcsec
axisAngledeg
tiltAngledeg
mjddate at which we define the spot below (UTC)
Longitudelongitude on body - deg
Latitudelatitude on body - deg
SpinRateInverse period - 1/days (jupiter 2.1, sun 0.03 latitude dependant)
void carma::services::Ephemeris::setWeather ( const double  atmPressure,
const double  airTemp,
const double  relHumid 
)

update the weather, such that refraction is more accurate.

Note that the observing frequency also needs to be set for an accurate refraction correction, since there is a 10-20% difference between radio and optical refraction. There are some reasonable defaults for the weather for refraction to work, so for low precision this routine does not need to be set.

The input values are passed through the "safe" routines of carma::environment::Atmosphere, to ensure reasonable numbers.

See Also
carma::services::Atmosphere
Parameters
atmPressureatmostpheric pressure in millibars
airTempair temperature in Kelvin
relHumidrelative humidity, in percent
void carma::services::Ephemeris::ShowVector ( void  )

experiments with tracking spots on DE405 planets (object type=0)

bool carma::services::Ephemeris::useSource ( void  ) const

Was a true Source was used, or should sourcename string be used to re-use an ephemeris (important for EphemerisTables)

Definition at line 671 of file Ephemeris.h.


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