I'm trying to fix this code which used astlib
to convert coordinates to use the astropy
coordinate modules. Here's a copy of the code:
from astLib import astCoords as coords
#Convert B1950 coordinates (as given)
clra=zeros(3)
cldec=zeros(3)
for i in range(len(clra)):
clra[i], cldec[i] = coords.convertCoords(
'B1950', 'J2000', clra1950[i],
cldec1950[i], 1950
)
#Convert input coords to Galactic coords
lgal,bgal = radians(coords.convertCoords(
'J2000', 'GALACTIC', ra,
dec,2000
))
I need help with 2 things.
What are the proper imports for
astropy
if I want to change fromB1950
toJ2000
, and the proper imports to go fromJ2000
to galactic coordinates?in the areas that start with
coords.convertCoords()
, What are the functions and arguments from astropy that go in its place. In other words, what do I replace it with?
Also, I had done some research into this issue. I found this link here: http://docs.astropy.org/en/v0.2.1/coordinates/
It describes the notation for astropy's
coordinate related functions. However, there is a lot there, and I'm not sure what to use and how to use it.
This is one way to do it:
Note that you can convert
c1
to Galactic directly too.