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:<br>
<br>import astropysics<br>from astropysics.coords import ICRSCoordinates,GalacticCoordinates<br>import asciitable<br><br>x='Core_rod_name.list'<br>dat=asciitable.read(x,Reader=asciitable.CommentedHeader, fill_values=['','-999.99'])<br>
Radeg=dat['ra-drad']*180./math.pi<br>Decdeg=dat['dec-drad']*180./math.pi<br><br>plot(Radeg,Decdeg,'o')<br>xlabel('Radeg')<br>ylabel('Decdeg')<br><br>gcoords=ICRSCoordinates(dat['ra-drad'],dat['dec-drad'],radians=True).convert(GalacticCoordinates)<br>
l=gcoords.l.degrees<br>b=gcoords.b.degrees<br><br>VLSR=dat['Vhel_f'] + 9*np.cos(l)*np.cos(b) + 12*np.sin(l)*np.cos(b) + 7*np.sin(b)<br>VGSR=VLSR + 220*np.sin(l)*np.cos(b)<br><br>dustmap='SFD_dust_4096_ngp.fits'<br>
EB_V=astropysics.obstools.get_SFD_dust(l,b,dustmap,interpolate=True)<br>-------<br>this gives the error 'Only length-1 arrays can be converted to Python scalars' ... however, I cannot do:<br><br>for row in dat:<br>
gcoords=ICRSCoordinates(dat['ra-drad'],dat['dec-drad'],radians=True).convert(GalacticCoordinates)<br><br>without the same error. Any ideas would be apreciated, thanks!<br clear="all"><br>~Elaina<br>-- <br>
PhD Candidate<br>Department of Physics and Astronomy<br>Faculty of Science<br>Macquarie University<br>North Ryde, NSW 2109, Australia<br>