On 13/02/2012 23:50, Elaina Ann Hyde wrote:
Hi, I'm working on a routine for reading in the Schlegel dustmaps. I have
an ascii table with values, Ra-Dec and I'm trying to convert 2 columns to
l,b and get the dust values out, this is a 2 part problem as I need to
first convert to l,b, keep those values for other uses (calculating VLSR),
and get extinctions for each l,b value, I have:
import astropysics
from astropysics.coords import ICRSCoordinates,GalacticCoordinates
import asciitable
x='Core_rod_name.list'
dat=asciitable.read(x,Reader=asciitable.CommentedHeader,
fill_values=['','-999.99'])
Radeg=dat['ra-drad']*180./math.pi
Decdeg=dat['dec-drad']*180./math.pi
plot(Radeg,Decdeg,'o')
xlabel('Radeg')
ylabel('Decdeg')
gcoords=ICRSCoordinates(dat['ra-drad'],dat['dec-drad'],radians=True).convert(GalacticCoordinates)
l=gcoords.l.degrees
b=gcoords.b.degrees
VLSR=dat['Vhel_f'] + 9*np.cos(l)*np.cos(b) + 12*np.sin(l)*np.cos(b) +
7*np.sin(b)
VGSR=VLSR + 220*np.sin(l)*np.cos(b)
dustmap='SFD_dust_4096_ngp.fits'
EB_V=astropysics.obstools.get_SFD_dust(l,b,dustmap,interpolate=True)
-------
this gives the error 'Only length-1 arrays can be converted to Python
scalars' ... however, I cannot do:
for row in dat:
gcoords=ICRSCoordinates(dat['ra-drad'],dat['dec-drad'],radians=True).convert(GalacticCoordinates)
without the same error. Any ideas would be apreciated, thanks!
~Elaina
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Well it's as clear as dust to me :)
Unlike others who have already responded I don't believe that this will
be too difficult to sort as the astropysics package is available on Pypi
and there it states that it requires scipy and numpy. Did you or
someone else install the package, if the latter can you ask them about
this problem?
Best of British/Australian/Whatever luck with this.
--
Cheers.
Mark Lawrence.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor