Reputation: 83
I have two separate list of numbers that are the RA and Dec of objects in an image. I want to convert these into the pixel values of the image. Example of the list:
RA = [34.402274, 34.331012, 34.154252, 34.646844, 34.481959, 34.506609, 34.430659, 34.370766]
Dec = [-5.36572, -5.355275, -5.353743, -5.350714, -5.338268, -5.330245, -5.317526, -5.314187]
Is there a loop I could use where I could take each number and convert it into a pixel coordinate in the image I took this from?
Upvotes: 0
Views: 489
Reputation: 826
from numpy import pi, sin, cos
coordinates = [[ra * cos(dec * pi / 180), ra * sin(dec * pi / 180)] for ra, dec in zip(RA, Dec)]
Is that what you want?
Upvotes: 1