CARMA C++
SourceChecker.h
Go to the documentation of this file.
1 
11 #ifndef CARMA_SERVICES_SOURCECHECKER_H
12 #define CARMA_SERVICES_SOURCECHECKER_H
13 
17 #include "carma/services/Types.h"
18 #include "carma/services/TelescopeStatus.h"
19 #include "carma/services/Units.h"
21 
22 #include <vector>
23 #include <set>
24 
25 namespace carma {
26 namespace services {
27 
28  class Angle;
29  class Source;
30 
37  class SourceChecker {
38  public:
42  SourceChecker();
43 
45  virtual ~SourceChecker();
46 
51  void setSource(const Source& source);
52 
59  void setSource(const std::string& source,
60  const std::string& catalog="");
61 
71  void setLocation(const Location& location);
72 
79  void setElevLimit(double elevDegrees);
80 
88  void setElevLimit(const Angle& elevation);
89 
95  void setElevUpperLimit(double elevDegrees);
96 
103  void setElevUpperLimit(const Angle& elevation);
104 
105  // NB: Should probably put the wrap limit info
106  // into a separate Telescope class.
107  // then SourceChecker::setTelescope(..)
111  void setAzPositiveWrapLimit( const Angle & azimuth );
112 
116  void setAzNegativeWrapLimit( const Angle & azimuth );
117 
122  inline void useSexagesimal(bool sexa)
123  {
124  sexa_ = sexa;
125  }
126 
131  void useJ2000(bool j2000)
132  {
133  j2000_ = j2000;
134  }
135 
143  void showHeader(bool showit) ;
144 
150  Angle getElevLimit() const;
151 
155  Angle getElevUpperLimit() const;
156 
159 
162 
171  void setFrequency(double frequency);
172 
179  void setMJD( double mjd = carma::util::Time::MJD() );
180 
184  std::string info();
185 
190  bool isUp();
191 
198  double riseTime() ;
199 
205  double minutesSinceRise() ;
206 
212  double minutesSinceSet() ;
213 
219  double minutesUntilRise();
220 
227  double minutesUntilTransit();
228 
242  double minutesUntilAzLimit();
243 
251  double setTime() ;
252 
257  double minutesUntilSet();
258 
262  double lst() ;
263 
267  std::string localTime();
268 
272  std::string ut();
273 
278 
284 
290 
305  double minutesUntilBlind();
306 
322  double minutesUntilAzWrapLimit();
323 
330 
342  services::AntennaType antType,
343  double antAzDegrees,
344  double timeToTrack );
345 
346 
353  services::NeighborSet
354  getNearest( const ::std::set< ::std::string > & sourceList,
355  bool include,
356  unsigned short numReturn, bool ignoreNorthSouth,
357  coordSysType coordSys,
358  sourcePntType pType,
359  float fluxLimit );
360 
379  services::Neighbor createNeighbor( const Source & neighborSource,
380  const coordSysType coordSys, Ephemeris & localEphemeris);
381 
383  double getMJD();
384 
389  bool slewWouldCrossNorthSouthBoundary( const Source & neighborSource );
390 
391 
392  private:
393  // lower elevation limit
394  Angle* elevLimit_;
395  // upper elevation limit
396  Angle* elevUpperLimit_;
397  // positive wrap azimuth limit
398  Angle azPositiveWrapLimit_;
399  // negative wrap azimuth limit
400  Angle azNegativeWrapLimit_;
401  // local sidereal time in HOURS when source hits positive azimuth limit;
402  double azPositiveWrapLimitLst_;
403  AstroTime at_;
404  Ephemeris ephem_;
405  Units units_;
406 
407  // Has the MJD for queries been set yet?
408  bool needsMjd_;
409 
410  // For source info output, do we need the header or not?
411  // If looping over many sources, we don't want to spit
412  // out the header each time.
413  bool needsHeader_;
414 
415  // output angles in sexagesimal format if sexa_ =- true
416  bool sexa_;
417 
418  // output RA/DEC in J2000 or not.
419  bool j2000_;
420 
421  TelescopeStatus telescopeStatus_;
422 
426  std::string rise();
427 
431  std::string set();
432 
436  Velocity doppler();
437 
442  std::string header( Source source );
443 
449  double hourAngleAtElevLimit();
450 
456  double hourAngleAtElevUpperLimit();
457 
464  double hourAngleAtElevation( Angle * elev );
465 
470  void computeTelescopeStatus();
471 
472  // marker for source that never sets below elevation limit
473  static const double NEVER_SETS;
474  // marker for source that never rises above elevation limit
475  static const double NEVER_RISES;
476 
477  // oft-used strings
478  static const std::string NEVER_RISES_STR;
479  static const std::string NEVER_SETS_STR;
480  static const std::string UNSUPPORTED_COORDSYS_STR;
481 
482  // widths for info() formatting
483  static const int SOURCE_WIDTH = 10;
484  static const int ANGLE_WIDTH = 13;
485  static const int TEXT_WIDTH = 10;
486  static const int TIME_WIDTH = 12;
487  static const int DOPPLER_WIDTH= 8;
488 
489 
490  };
491 
492 } // end services
493 } // end carma
494 
495 #endif // CARMA_SERVICES_SOURCECHECKER_H
void setAzNegativeWrapLimit(const Angle &azimuth)
Set the azimuth limit on the negative wrap.
Angle getElevLimit() const
Get the current elevation limit for source rise and set times.
Data on nearest neighbor to a source.
Definition: Neighbor.h:24
enum carma::services::AzWrapTypeEnum AzWrapType
mirror drive mode wrap types
void setMJD(double mjd=carma::util::Time::MJD())
Set the MJD for subsequent queries.
SourceChecker()
Default Constructor.
void showHeader(bool showit)
Call to toggle whether or not the info() command prints out the column headers.
Source is derived from CatalogEntry and is used to hold information for a particular entry from a sou...
Definition: Source.h:23
void setElevUpperLimit(double elevDegrees)
Set the upper elevation limit for azimuth wrap calculation If the limit is less than zero...
bool slewWouldCrossNorthSouthBoundary(const Source &neighborSource)
Various type definitions for services classes.
This class implements various astronomical time computation routines.
Definition: AstroTime.h:32
Angle getAzPositiveWrapLimit() const
The Velocity class can represent an velocity in any units.
Definition: Velocity.h:42
enum carma::services::sourcePntEnum sourcePntType
Can this source be used for RADIO and/or OPTICAL pointing?
Nearby neighbor source data structure definition.
services::NeighborSet getNearest(const ::std::set< ::std::string > &sourceList, bool include, unsigned short numReturn, bool ignoreNorthSouth, coordSysType coordSys, sourcePntType pType, float fluxLimit)
Must be called after setSource, set elev limits, setFrequency, and setMJD.
void setLocation(const Location &location)
Set the location for source checking.
Ephemeris wraps the NOVAS library and any other ephemeris related functions into a simple to use clas...
Definition: Ephemeris.h:91
Astronomical Time routines.
services::Neighbor createNeighbor(const Source &neighborSource, const coordSysType coordSys, Ephemeris &localEphemeris)
Make a Neighbor object using the current object in this SourceChecker instance as the reference and t...
void useJ2000(bool j2000)
Use J2000 in when printing RA/DEC coordinates.
Location specifies a location (observatory if you wish) on planet earth, as longitude, latitude, and altitude above sea-level.
Definition: Location.h:32
AntennaType
Enumeration of possible types for antennas.
Definition: Types.h:210
carma::services::Angle getElevation()
void useSexagesimal(bool sexa)
Use sexagesimal in when printing angular data.
The Angle class can represent any angle in any units.
Definition: Angle.h:38
void setFrequency(double frequency)
Set the frequency for the observation.
Angle getAzNegativeWrapLimit() const
virtual ~SourceChecker()
Destructor.
enum carma::services::coordSysEnum coordSysType
The coordinate systems.
TelescopeStatus getTelescopeStatus()
services::AzWrapType computeOptimumWrapValue(services::AntennaType antType, double antAzDegrees, double timeToTrack)
void setElevLimit(double elevDegrees)
Set the elevation lower limit for source rise and set times.
Holds information about the telescope status with respect to azimuth wrap and upper elevation limits...
Representation of Velocity in any units.
Source checker returns info on the location in the sky of a source at a given time, e.g.
Definition: SourceChecker.h:37
void setSource(const Source &source)
Set the source to check.
Declaration of carma::services::Ephemeris.
carma::services::Angle getAzimuth()
static double MJD()
Get current MJD.
void setAzPositiveWrapLimit(const Angle &azimuth)
Set the azimuth limit on the positive wrap.
This class is based on the GNU units library.
Definition: Units.h:46
bool canBeTrackedOnNegativeWrap()
If the source azimuth can be represented by a value between negative wrap limit and zero...