Action #1854
Add GSkyDir::sun() method
Status: | Closed | Start date: | 09/28/2016 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | 1.7.0 | |||
Duration: |
Description
A sun(const GTime& time)
method should be added to the GSkyDir
class that returns the position of the Sun at a given time in sufficient precision for gamma-ray astronomy.
Recurrence
No recurrence.
History
#1 Updated by Knödlseder Jürgen about 8 years ago
Here a Use Case that returns the Sun’s current position:
GTime time;
time.now();
GSkyDir dir;
dir.sun(time);
std::cout << dir << std::endl;
#2 Updated by Knödlseder Jürgen over 5 years ago
- Target version set to 1.7.0
#3 Updated by Knödlseder Jürgen about 5 years ago
- Status changed from New to In Progress
- Assigned To set to Knödlseder Jürgen
- % Done changed from 0 to 50
I implemented GTime::julian_epoch()
methods that return time in units of Julian epochs. This method is needed to precess the Sub position to a given epoch.
For the precession, I implemented a GSkyDir::precess()
method.
Finally, I implemented the GSkyDir::sun()
method based on the formulae on https://en.wikipedia.org/wiki/Position_of_the_Sun.
I checked the implementation using a public web site. Using GammaLib I got:
>>> import gammalib >>> time=gammalib.GTime() >>> sky=gammalib.GSkyDir() >>> time.now() >>> sky.sun(time) >>> print(sky) (RA,Dec)=(-132.731223266557,-17.6621265786828)
and using https://theskylive.com/sun-info I got
(RA,Dec)=(-132.7375,-17.6625)
A more rigorous comparison should be done for example versus PyEphem (see https://pypi.org/project/pyephem/).
#4 Updated by Knödlseder Jürgen about 5 years ago
- File Sun_position_difference.png added
- Status changed from In Progress to Pull request
- % Done changed from 50 to 100
Here a comparison for the years 2000 to 2050 between the Right Ascension and Declination computed using GSkyDir.sun()
and ephem.Sun()
from the PyEphem package. The maximum differences amount to about 0.01 degrees, as stated on https://en.wikipedia.org/wiki/Position_of_the_Sun, which corresponds to 0.6 arcmin or 36 arcsec. This should be sufficient for gamma-ray applications.
#5 Updated by Knödlseder Jürgen about 5 years ago
- File test_ephem.py added
Here is the script I used for testing: test_ephem.py
#6 Updated by Knödlseder Jürgen about 5 years ago
- Status changed from Pull request to Closed
Merged into devel
.