2
$\begingroup$

I’m working on a project of which one of its functions is determining the XY pixel coordinates of an object given the object RA DEC coordinates and a platesolved image (this assumes that the target is near the image center).

I didn’t base this code on any algorithm, I thought it would just be basic vector manipulation. I’m aware that this basic approach doesn’t correct field flatness and stuff, I need it to be only roughly accurate.

'PS_DEC,PS_RA,PS_NORTH_ANGLE,PS_PIXEL_SCALE are retrieved from a platesolve
'Target_dec and Target_ra are the coordinates of the target
'VectorRotate(vector,angle) is a function that rotates a vector

'PS_DEC = 3.3026014754
'PS_RA = 278.7921661190
'Target_dec = 3.136138
'Target_ra = 278.65
'PS_NORTH_ANGLE = 99.89
'PS_PIXEL_SCALE = 3.15

Dim lengthTotal As Double = (90 - PS_DEC) * 3600 / PS_PIXEL_SCALE ' gets the length of the vector towards the celestial north pole in pixel

Dim InitVector As PointF
InitVector.X = 0
InitVector.Y = -CSng(lengthTotal) 'Casts the length to a vector

Dim FirstRotation As PointF = VectorRotate(InitVector, PS_NORTH_ANGLE * -1) 'rotates the vector towards the celestial north pole using north angle from the Plate Solve
Dim FlipVector As PointF
FlipVector.X = FirstRotation.X * -1
FlipVector.Y = FirstRotation.Y * -1 'flips the vector so that it points from the north pole to the image center

Dim Multiplier As Single = CSng((90 - Target_dec) / (90 - PS_DEC)) 'multiplier for applying the DEC difference
Dim FlipVectorTrim As PointF
FlipVectorTrim.X = FlipVector.X * Multiplier 
FlipVectorTrim.Y = FlipVector.Y * Multiplier 'after this the vector should have the length of the Target dec

Dim Finalvector As PointF = VectorRotate(FlipVectorTrim, (target_Ra - PS_RA)) 'rotates the vector by the difference of the target ra and the ra from the plate solve
Dim Pixeloffset As Point
Pixeloffset.X = CInt(Finalvector.X - FlipVector.X)
Pixeloffset.Y = CInt(Finalvector.Y - FlipVector.Y) ' by subtracting the vectors I should get the relative offset from the image center in pixels

When I use the coordinates from the star marked green I get the yellow circle as a result, to the bottom left of the star.

Image

Fiddling around with the code I found out that if I multiply the RA correction angle by 0.67 the target is correctly found.

Dim Finalvector As PointF = VectorRotate(FlipVectorTrim, (target_Ra - PS_RA) * 0.67)

enter image description here

I’ve tried this on another star where I got the same results. What I figure from this is that DEC is correctly handled, but the RA rotation is for some reason too much, by about one third.

I’ve looked at other possible error sources(placement of the circle in the image, star coordinates, the plate solve itself) and I’m confident that they are all correct, so the error has to be somewhere in this code.

I can use the fix I found, but I’d much rather know what I’m doing wrong.

Here is a link to the platesolved image.

$\endgroup$
2
  • $\begingroup$ astrometry.net may be helpful as may be this question I asked in photo.SE: photo.stackexchange.com/questions/6111/… $\endgroup$
    – user21
    Commented Sep 4, 2018 at 19:49
  • $\begingroup$ @barrycarter the image has already solved with the (online) astrometry.net. The solved image includes the SIP distortion polynomial transformation which will make your task of mapping the World co-ordinates (RA, Dec) to pixel co-ordinates. Assuming your field is small (look like it), if you re-upload your image and set 'Tweak=0' under the Advanced Options, do you get more sensible results. In general, what you are trying to do is implement WCS e.g. docs.astropy.org/en/stable/wcs/index.html; this is a very general system which is often best left to libraries to do $\endgroup$ Commented Sep 4, 2018 at 23:47

0

You must log in to answer this question.

Browse other questions tagged .