from astropy.table import Table,Column from astropy.coordinates import CartesianRepresentation, SkyCoord, Distance from astroquery.vizier import Vizier from astropy import units as u #Create Vizier object, turn off default row limit v=Vizier(columns=['N1']) #Need to ask for N1 explicitly as it is not part of the standard returned elements v.ROW_LIMIT = -1 Cats = v.get_catalogs('J/AJ/146/86') CosmicFlows=Cats[1] CosmicFlows.keep_columns(["GGLON","GGLAT","__Dist_","__PV_","__Bmag_","N1"]) CosmicFlows.rename_column('__Dist_', 'Dist') CosmicFlows.rename_column('__PV_', 'PV') CosmicFlows.rename_column('__Bmag_', 'Bmag') coordsCol=SkyCoord(CosmicFlows['GGLAT'],CosmicFlows['GGLON'],unit=(u.degree, u.degree),\ distance=Distance(CosmicFlows['Dist'],u.Mpc),frame='galactic') CosmicFlows.add_column(Column(coordsCol.represent_as(CartesianRepresentation).x.to(u.Mpc),name='x_coord',meta={'ucd': 'pos.cartesian.x'}),0) CosmicFlows.add_column(Column(coordsCol.represent_as(CartesianRepresentation).y.to(u.Mpc),name='y_coord',meta={'ucd': 'pos.cartesian.y'}),1) CosmicFlows.add_column(Column(coordsCol.represent_as(CartesianRepresentation).z.to(u.Mpc),name='z_coord',meta={'ucd': 'pos.cartesian.z'}),2) print len(CosmicFlows) CosmicFlows CosmicFlows.filled(-9999).write("CosmicFlows/CosmicFlows.raw",format='ascii.no_header') #initalize plotting %config InlineBackend.rc = {} import matplotlib import matplotlib.pyplot as plt %matplotlib inline import seaborn fig = plt.figure (figsize=(13,20)) ax = fig.add_subplot(311,projection="mollweide", axisbg='black') ax.grid(False) ax.get_xaxis().tick_bottom() ax.scatter(coordsCol.l.wrap_at(180.*u.degree).radian,\ coordsCol.b.radian,s=2*CosmicFlows['N1']+4,c=-1*CosmicFlows['PV'],\ cmap='RdBu',vmin=-2500.,vmax=2500.,lw=0) a2 = fig.add_subplot(312) a2.hist(CosmicFlows['PV'],bins=100) a2.set_title("Galaxy Group Peculiar Velocities") a2.set_xlabel("PV") #a2.set_yscale('log')