Bug #1312
GCTAPointing::skydir sometimes gives wrong results
Status: | Rejected | Start date: | 08/06/2014 | |
---|---|---|---|---|
Priority: | High | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | - | |||
Duration: |
Description
We should get 329.717 = pos_sky.ra_deg() by the following code, but gammalib gives (329.717-360.0) = -30.283 = pos_sky.ra_deg()
I made a quick fix by adding the following lines in GCTAPointing::skydir(), but I am not sure whether this fixes all cases.
if (sky.ra_deg() < 0){
sky.radec_deg( 360. + sky.ra_deg(), sky.dec_deg() );
}
============
from gammalib import *
from ctools import *
dir = GSkyDir()
dir.radec_deg(329.717, -30.226)
pnt = GCTAPointing();
pnt.dir(dir)
pos_inst = GCTAInstDir();
pos_inst.detx(0)
pos_inst.dety(0)
pos_sky = pnt.skydir(pos_inst);
Recurrence
No recurrence.
History
#1 Updated by Knödlseder Jürgen over 10 years ago
Why do you think this is a bug?
#2 Updated by Knödlseder Jürgen about 10 years ago
Coming back to this, is there any reason why RA should always be in the interval [0, 360] deg? So far there is no code in GammaLib that guarantees this, and I’m not sure that this is a good idea. There are for example FITS images with negative RA values. This is fully acceptable.
#3 Updated by Lu Chia-Chun about 10 years ago
I thought it was a bug because I have never seen people using negative ra values, or ra values outside [0,360]! Since you think it’s not a bug, we can close this issue.
I have problems with this issue when I use gammalib in hap to do coordinate transformation. I can get around this problem by checking the returned ra and add 360 when it’s negative.
Since people usually expect ra = [0,360], we probably should point out in the document that this is not guaranteed.
#4 Updated by Knödlseder Jürgen about 10 years ago
- Status changed from In Progress to Rejected
- % Done changed from 20 to 100
Thanks, I prefer that way.
An example: take a Galactic plane map in a FITS file centred on the Galactic centre (0 in middle). The RA axis values become necessarily negative when you move to the left.