Jpp  19.1.0-rc.1
the software that should make you happy
Classes | Functions | Variables
JASTRONOMY Namespace Reference

Classes

class  JSourceLocation
 Location of astrophysical source. More...
 
class  JGalacticCoordinates
 Location of astrophysical source in Galactic coordinates. More...
 
class  JNeutrinoDirection
 Direction of incident neutrino. More...
 
class  JGeographicalLocation
 Location of detector. More...
 
class  JAstronomy
 Auxiliary class to make coordinate transformations for a specific geographical location of the detector. More...
 
struct  JStarTrek
 Auxiliary class for source tracking. More...
 

Functions

double sla_gmst_ (double &ut1)
 
double sla_gmsta_ (double &ut1, double &part_day)
 
double sla_eqeqx_ (double &ut1)
 
void sla_de2h_ (double &hourangle, double &declination, double &observer_latitude, double &azimuth, double &elevation)
 
void sla_dh2e_ (double &azimuth, double &elevation, double &observer_latitude, double &hourangle, double &declination)
 
void sla_eqecl_ (double &rightascension, double &declination, double &time, double &ecliptic_longitude, double &ecliptic_latitude)
 
void sla_ecleq_ (double &ecliptic_longitude, double &ecliptic_latitude, double &time, double &rightascension, double &declination)
 
void sla_eqgal_ (double &rightascension, double &declination, double &galactic_longitude, double &galactic_latitude)
 
void sla_galeq_ (double &galactic_longitude, double &galactic_latitude, double &rightascension, double &declination)
 
void sla_galsup_ (double &galactic_longitude, double &galactic_latitude, double &sgalactic_longitude, double &sgalactic_latitude)
 
void sla_supgal_ (double &sgalactic_longitude, double &sgalactic_latitude, double &galactic_longitude, double &galactic_latitude)
 
void sla_caldj_ (int &year, int &month, int &day, double &mjd, int &status)
 
void sla_clyd_ (int &year, int &month, int &day, int &nyears, int &ndays, int &status)
 
void sla_djcal_ (int &precision, double &mjd, int result[4], int &status)
 
void sla_dd2tf_ (int &ndec, double &day, char sign[1], int result[4])
 
double sla_dtt_ (double &ut1)
 
void sla_rdplan_ (double &dtt, int &object, const double &longitude, const double &latitude, double &rightascension, double &declination, double &diam)
 
void sla_preces_ (char *system, double &ep0, double &ep1, double &ra, double &dec, int length)
 
void sla_prenut_ (double &epoch, double &mjd, double rmatpn[3][3])
 
double wrap (double angle)
 
int get_utm_zone (double lat)
 
double longitude_of_central_meridian (int utmzone)
 
double compute_meridian_convergence_angle (double longitude, double latitude)
 
void correct_to_j2000 (double &in_dec, double &in_ra, double &mjd, double &out_dec, double &out_ra, bool reverse=false)
 Convert (Dec, RA) to J2000. More...
 
double getRadians (const double angle)
 Convert angle to radians. More...
 
double getRadians (const int angle, const int amin, const double asec)
 Convert angle to radians. More...
 
double getHourAngle (const int hour, const int min, const double sec)
 Convert hour angle to radians. More...
 
double getDot (const JNeutrinoDirection &first, const JNeutrinoDirection &second)
 Dot product. More...
 
double getDot (const JSourceLocation &first, const JSourceLocation &second)
 Dot product. More...
 

Variables

static const double MJD_EPOCH = 40587.0
 
static const double NUMBER_OF_SECONDS_PER_HOUR = 60.0 * 60.0
 
static const double NUMBER_OF_SECONDS_PER_DAY = NUMBER_OF_SECONDS_PER_HOUR * 24.0
 
static const double NUMBER_OF_SECONDS_PER_YEAR = NUMBER_OF_SECONDS_PER_DAY * 365.0
 
static const double NUMBER_OF_SECONDS_PER_SEDERIAL_DAY = NUMBER_OF_SECONDS_PER_HOUR * 23.9344696
 
static const JGeographicalLocation Antares (42, 48, 06, 10)
 
static const JGeographicalLocation Sicily (36, 16, 16, 06)
 
static const JGeographicalLocation Pylos (36, 33, 16, 06)
 
static const JGeographicalLocation ARCA (36, 17, 15, 58)
 
static const JGeographicalLocation ORCA (42, 48, 06, 02)
 
static const JSourceLocation galacticCenter (-0.5062816, -1.633335)
 
static const JSourceLocation RXJ1713 (getRadians(-39, -46, 0.0), getHourAngle(17, 13, 7))
 
static const JSourceLocation VELAX (getRadians(-45, -10, -35.2), getHourAngle(8, 35, 20.66))
 

Detailed Description

Author
mdejong

Function Documentation

◆ sla_gmst_()

double JASTRONOMY::sla_gmst_ ( double &  ut1)

◆ sla_gmsta_()

double JASTRONOMY::sla_gmsta_ ( double &  ut1,
double &  part_day 
)

◆ sla_eqeqx_()

double JASTRONOMY::sla_eqeqx_ ( double &  ut1)

◆ sla_de2h_()

void JASTRONOMY::sla_de2h_ ( double &  hourangle,
double &  declination,
double &  observer_latitude,
double &  azimuth,
double &  elevation 
)

◆ sla_dh2e_()

void JASTRONOMY::sla_dh2e_ ( double &  azimuth,
double &  elevation,
double &  observer_latitude,
double &  hourangle,
double &  declination 
)

◆ sla_eqecl_()

void JASTRONOMY::sla_eqecl_ ( double &  rightascension,
double &  declination,
double &  time,
double &  ecliptic_longitude,
double &  ecliptic_latitude 
)

◆ sla_ecleq_()

void JASTRONOMY::sla_ecleq_ ( double &  ecliptic_longitude,
double &  ecliptic_latitude,
double &  time,
double &  rightascension,
double &  declination 
)

◆ sla_eqgal_()

void JASTRONOMY::sla_eqgal_ ( double &  rightascension,
double &  declination,
double &  galactic_longitude,
double &  galactic_latitude 
)

◆ sla_galeq_()

void JASTRONOMY::sla_galeq_ ( double &  galactic_longitude,
double &  galactic_latitude,
double &  rightascension,
double &  declination 
)

◆ sla_galsup_()

void JASTRONOMY::sla_galsup_ ( double &  galactic_longitude,
double &  galactic_latitude,
double &  sgalactic_longitude,
double &  sgalactic_latitude 
)

◆ sla_supgal_()

void JASTRONOMY::sla_supgal_ ( double &  sgalactic_longitude,
double &  sgalactic_latitude,
double &  galactic_longitude,
double &  galactic_latitude 
)

◆ sla_caldj_()

void JASTRONOMY::sla_caldj_ ( int &  year,
int &  month,
int &  day,
double &  mjd,
int &  status 
)

◆ sla_clyd_()

void JASTRONOMY::sla_clyd_ ( int &  year,
int &  month,
int &  day,
int &  nyears,
int &  ndays,
int &  status 
)

◆ sla_djcal_()

void JASTRONOMY::sla_djcal_ ( int &  precision,
double &  mjd,
int  result[4],
int &  status 
)

◆ sla_dd2tf_()

void JASTRONOMY::sla_dd2tf_ ( int &  ndec,
double &  day,
char  sign[1],
int  result[4] 
)

◆ sla_dtt_()

double JASTRONOMY::sla_dtt_ ( double &  ut1)

◆ sla_rdplan_()

void JASTRONOMY::sla_rdplan_ ( double &  dtt,
int &  object,
const double &  longitude,
const double &  latitude,
double &  rightascension,
double &  declination,
double &  diam 
)

◆ sla_preces_()

void JASTRONOMY::sla_preces_ ( char *  system,
double &  ep0,
double &  ep1,
double &  ra,
double &  dec,
int  length 
)

◆ sla_prenut_()

void JASTRONOMY::sla_prenut_ ( double &  epoch,
double &  mjd,
double  rmatpn[3][3] 
)

◆ wrap()

double JASTRONOMY::wrap ( double  angle)
inline

Definition at line 104 of file JAstronomy.hh.

105  {
106  int n = int(angle / (2 * JMATH::PI)) - (angle < 0);
107  angle -= n * 2 * JMATH::PI;
108  return angle;
109  }
static const double PI
Mathematical constants.
const int n
Definition: JPolint.hh:786

◆ get_utm_zone()

int JASTRONOMY::get_utm_zone ( double  lat)
inline

Definition at line 116 of file JAstronomy.hh.

117  {
118  return 1 + int( ( JMATH::PI + lat ) / ( 6 * JMATH::PI / 180 ) );
119  }

◆ longitude_of_central_meridian()

double JASTRONOMY::longitude_of_central_meridian ( int  utmzone)
inline

Definition at line 125 of file JAstronomy.hh.

126  {
127  const double zone_width = 6 * JMATH::PI / 180;
128  return -JMATH::PI + (utmzone -1)*zone_width + zone_width/2;
129  }

◆ compute_meridian_convergence_angle()

double JASTRONOMY::compute_meridian_convergence_angle ( double  longitude,
double  latitude 
)
inline

Definition at line 140 of file JAstronomy.hh.

141  {
142 
143  double latitude_deg = latitude * 180/JMATH::PI;
144 
145  if ( latitude_deg > 84. || latitude_deg < -80.)
146  {
147  std::cout << "UTM coordinate system not defined for given Latitude: %f (max 84 deg N or min -80 deg S), setting meridian convergence angle to 0 deg.";
148  return 0;
149  }
150 
151  // detector position, longitude and latitude in rad
152  double lambda = longitude;
153  double phi = latitude;
154 
155  // find UTM zone and central meridian
156  // longitude of the central meridian of UTM zone in rad
158  double omega = lambda-lambda0;
159 
160  // parameters of the Earth ellipsoid
161  double a = 6378137.; // semi-major axis in meters (WGS84)
162  double e2 = 0.0066943800; // eccentricity (WGS84)
163 
164  double rho = a*(1.-e2)/pow(1.-e2*pow(sin(phi),2),3./2.);
165  double nu = a/sqrt(1-e2*pow(sin(phi),2.));
166  double psi = nu/rho;
167  double t = tan(phi);
168 
169  // power series for convergence angle
170  double gamma = sin(phi) * omega
171  - sin(phi) * pow(omega,3.)/3. * pow(cos(phi),2.) * (2.*pow(psi,2.)-psi)
172  - sin(phi) * pow(omega,5.)/15. * pow(cos(phi),4.) * (pow(psi,4.)*(11.-24.*pow(t,2.))-
173  pow(psi,3.)*(11.-36.*pow(t,2.))+
174  2.*pow(psi,2.)*(1.-7.*pow(t,2.))+
175  psi*pow(t,2.)
176  )
177  - sin(phi) * pow(omega,7.)/315. * pow(cos(phi),6.) * (17.-26.*pow(t,2.)+2.*pow(t,4.));
178 
179  return gamma;
180  }
const double a
Definition: JQuadrature.cc:42
double longitude_of_central_meridian(int utmzone)
Definition: JAstronomy.hh:125
int get_utm_zone(double lat)
Definition: JAstronomy.hh:116
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97

◆ correct_to_j2000()

void JASTRONOMY::correct_to_j2000 ( double &  in_dec,
double &  in_ra,
double &  mjd,
double &  out_dec,
double &  out_ra,
bool  reverse = false 
)
inline

Convert (Dec, RA) to J2000.

Adapted from aanet/astro/Astro.cc

Parameters
mjdModified Julian Date (= # of days since midnight 17th of november 1858 AD)
in_decInput dec
in_raInput RA
out_decOutput dec
out_raOutput RA
reverseif reverse = false, this function converts from ra,dec at a certain time to J2000, if reverse = true, it goes the other way (i.e. if you have a catalog position and want to compute a track, use reverse = true)

Definition at line 193 of file JAstronomy.hh.

194  {
195  // --- get the rotation matrix ----
196  // NOTE: (from seatray Astro): Julian epoch of J2000 time definition
197  // is 2000, corrsponding by definition to 2451545.0 TT (unmodified)
198  // Julian date!
199 
200  double epoch = 2000;
201  double rmatpn[3][3] {};
202  sla_prenut_(epoch, mjd, rmatpn); // SLALIB function to get the matrix of precession and nutation
203 
204  JMATH::JMatrix3D M = JMATH::JMatrix3D(rmatpn[0][0], rmatpn[0][1], rmatpn[0][2], rmatpn[1][0], rmatpn[1][1], rmatpn[1][2], rmatpn[2][0], rmatpn[2][1], rmatpn[2][2]);
205  JMATH::JMatrix3D& M_T = M.transpose(); // transpose 'cause of fortan matrix convention
206  JMATH::JSVD3D V(M_T);
207 
208  double theta = JMATH::PI/2 - in_dec;
209  double phi = in_ra; // get the (theta, phi) from (in_dec, in_ra)
210  double v[3]; // get the vector in the form (x, y, z) from (theta, phi)
211  v[0] = sin (theta) * cos(phi);
212  v[1] = sin (theta) * sin(phi);
213  v[2] = cos (theta);
214  // multiplying the matrix with v and get the transformed vector
215  if (reverse){
216  M_T.transform(v[0],v[1],v[2]);
217  }
218  else{
219  JMATH::JMatrix3D M_T_Inv;
220  M_T_Inv = V.invert();
221  M_T_Inv.transform(v[0],v[1],v[2]);
222  }
223 
224  // get the (phi, theta) from v2
225  double phi_2 = atan2( v[1], v[0] ); double theta_2 = acos(v[2]);
226  // convert (phi,theta) to declination and right ascention
227  out_ra = wrap(phi_2);
228  out_dec = JMATH::PI/2 - theta_2;
229  }
JMatrix3D & transpose()
Transpose.
void transform(double &__x, double &__y, double &__z) const
Transform.
Singular value decomposition.
Definition: JSVD3D.hh:27
double wrap(double angle)
Definition: JAstronomy.hh:104
void sla_prenut_(double &epoch, double &mjd, double rmatpn[3][3])
data_type v[N+1][M+1]
Definition: JPolint.hh:866

◆ getRadians() [1/2]

double JASTRONOMY::getRadians ( const double  angle)
inline

Convert angle to radians.

Parameters
angleangle [deg]
Returns
angle [rad]

Definition at line 238 of file JAstronomy.hh.

239  {
240  return JMATH::PI * angle / 180.0;
241  }

◆ getRadians() [2/2]

double JASTRONOMY::getRadians ( const int  angle,
const int  amin,
const double  asec 
)
inline

Convert angle to radians.

Parameters
angleangle [deg]
aminarcminutes
asecarcseconds
Returns
angle [rad]

Definition at line 252 of file JAstronomy.hh.

255  {
256  return JMATH::PI * ((double) angle +
257  (double) amin / 60.0 +
258  (double) asec / 3600.0) / 180.0;
259  }

◆ getHourAngle()

double JASTRONOMY::getHourAngle ( const int  hour,
const int  min,
const double  sec 
)
inline

Convert hour angle to radians.

Parameters
hourhour
minminutes
secseconds
Returns
angle [rad]

Definition at line 270 of file JAstronomy.hh.

273  {
274  double ha = (JMATH::PI * (double) hour / 12.0 +
275  JMATH::PI * (double) min / 720.0 +
276  JMATH::PI * (double) sec / 43200.0);
277 
278  if (ha > JMATH::PI) {
279  ha -= 2*JMATH::PI;
280  }
281 
282  return ha;
283  }

◆ getDot() [1/2]

double JASTRONOMY::getDot ( const JNeutrinoDirection first,
const JNeutrinoDirection second 
)
inline

Dot product.

Parameters
firstneutrino direction
secondneutrino direction
Returns
dot product

Definition at line 676 of file JAstronomy.hh.

678  {
679  return
680  cos(first.getZenith()) * cos(second.getZenith()) +
681  sin(first.getZenith()) * sin(second.getZenith()) *
682  cos(first.getAzimuth() - second.getAzimuth());
683  }
const double & getAzimuth() const
Definition: JAstronomy.hh:415
const double & getZenith() const
Definition: JAstronomy.hh:414

◆ getDot() [2/2]

double JASTRONOMY::getDot ( const JSourceLocation first,
const JSourceLocation second 
)
inline

Dot product.

Parameters
firstsource location
secondsource location
Returns
dot product

Definition at line 693 of file JAstronomy.hh.

695  {
696  return
697  sin(first.getDeclination()) * sin(second.getDeclination()) +
698  cos(first.getDeclination()) * cos(second.getDeclination()) *
699  cos(first.getRightAscension() - second.getRightAscension());
700  }
const double & getDeclination() const
Definition: JAstronomy.hh:313
const double & getRightAscension() const
Definition: JAstronomy.hh:314

Variable Documentation

◆ MJD_EPOCH

const double JASTRONOMY::MJD_EPOCH = 40587.0
static

Definition at line 92 of file JAstronomy.hh.

◆ NUMBER_OF_SECONDS_PER_HOUR

const double JASTRONOMY::NUMBER_OF_SECONDS_PER_HOUR = 60.0 * 60.0
static

Definition at line 94 of file JAstronomy.hh.

◆ NUMBER_OF_SECONDS_PER_DAY

const double JASTRONOMY::NUMBER_OF_SECONDS_PER_DAY = NUMBER_OF_SECONDS_PER_HOUR * 24.0
static

Definition at line 95 of file JAstronomy.hh.

◆ NUMBER_OF_SECONDS_PER_YEAR

const double JASTRONOMY::NUMBER_OF_SECONDS_PER_YEAR = NUMBER_OF_SECONDS_PER_DAY * 365.0
static

Definition at line 96 of file JAstronomy.hh.

◆ NUMBER_OF_SECONDS_PER_SEDERIAL_DAY

const double JASTRONOMY::NUMBER_OF_SECONDS_PER_SEDERIAL_DAY = NUMBER_OF_SECONDS_PER_HOUR * 23.9344696
static

Definition at line 97 of file JAstronomy.hh.

◆ Antares

const JGeographicalLocation JASTRONOMY::Antares(42, 48, 06, 10) ( 42  ,
48  ,
06  ,
10   
)
static

◆ Sicily

const JGeographicalLocation JASTRONOMY::Sicily(36, 16, 16, 06) ( 36  ,
16  ,
16  ,
06   
)
static

◆ Pylos

const JGeographicalLocation JASTRONOMY::Pylos(36, 33, 16, 06) ( 36  ,
33  ,
16  ,
06   
)
static

◆ ARCA

const JGeographicalLocation JASTRONOMY::ARCA(36, 17, 15, 58) ( 36  ,
17  ,
15  ,
58   
)
static

◆ ORCA

const JGeographicalLocation JASTRONOMY::ORCA(42, 48, 06, 02) ( 42  ,
48  ,
06  ,
02   
)
static

◆ galacticCenter

const JSourceLocation JASTRONOMY::galacticCenter(-0.5062816, -1.633335) ( -0.  5062816,
-1.  633335 
)
static

◆ RXJ1713

const JSourceLocation JASTRONOMY::RXJ1713(getRadians(-39, -46, 0.0), getHourAngle(17, 13, 7)) ( getRadians(-39, -46, 0.0)  ,
getHourAngle(17, 13, 7)   
)
static

◆ VELAX

const JSourceLocation JASTRONOMY::VELAX(getRadians(-45, -10, -35.2), getHourAngle(8, 35, 20.66)) ( getRadians(-45, -10, -35.2)  ,
getHourAngle(8, 35, 20.66)   
)
static