# Are 3D coordinate data from Sloan DSS-III available & easily accessible to non-pros?

Of course the newly announced SDSS-III data and maps from the Sloan Digital Sky Survey with 1.2 million objects, along with all previous data sets are openly available, and I'm sure there are many tools to access, work with, and view the data.

What would be the simplest way to extract a list of coordinates of galaxies in order to just try to visualize it on my own? There may be visualization tools also, if you want to add a link that would be great, but this question is about getting a list of coordinates so I can look at density or even try to plot one dot per galaxy in some slice.

I'm guessing the coordinates might be available in RA, dec, and redshift, and possibly also some calculated/inferred x, y, z.

I use python, but I'm not familiar with AstroPy yet, so if it can be done, albeit inefficiently and/or inaccurately by my writing a straightforward python script on my laptop, that would be the most helpful answer.

edit: if doing this in AstroPy is failry easy, I do have an Anaconda installation, and therefore already have at least a basic AstroPy installation.

Here is a graphic (below), from here in Phys.org attributed there to Daniel Eisenstein and SDSS-III.

Another graphic (below), from here in Phys.org attributed there to Jeremy Tinker and SDSS-III.

• Did you succeed? I would also be interested in x,y,z or spherical coordinates with depth data. – Erich Schubert Nov 7 '17 at 12:29
• @ErichSchubert Didn't go as far as I'd hoped, distracted by other things at the time. I'll see what I can find out; ping me if I don't get back to you in a week or so. Thanks for the reminder! – uhoh Nov 7 '17 at 20:19

## 2 Answers

BTW if anyone wants a quick and fast query to solution do the following:

Go to https://skyserver.sdss.org/dr12/en/tools/search/sql.aspx. Paste a query like this:

SELECT
s.specobjid, s.ra, s.dec, s.z
FROM SpecObj as s
WHERE
s.z > 0 AND s.z < .18 AND s.ra > 0 AND s.ra < 50 AND s.dec > 0 AND s.dec < 30


Then after downloading a csv file use the following code to make a nice heatmap plot in the x and y direction.

import astropy.cosmology
from scipy.stats.kde import gaussian_kde
import astropy.coordinates
import astropy.units as u
import numpy as np

data = np.genfromtxt('your_csv_file'), delimiter=',')
sdss_low_redshift = np.array([np.array([i[1], i[2], i[3]]) for i in data])
comoving_dist = astropy.cosmology.WMAP9.comoving_distance(sdss_low_redshift[:, 2])
c = astropy.coordinates.SkyCoord(ra=sdss_low_redshift[:, 0]*u.degree, dec=sdss_low_redshift[:, 1]*u.degree, distance=comoving_dist*u.mpc)
sdss_pos = np.stack([np.array([i.x.value, i.y.value, i.z.value]) for i in c.cartesian])
# Removing nans
mask = np.all(np.isnan(sdss_pos) | np.equal(sdss_pos, 0), axis=1)
sdss_pos = sdss_pos[~mask]

x, y = sdss_pos[:, 2], sdss_pos[:, 1]
heatmap, xedges, yedges = np.histogram2d(x, y, bins=50)
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]

plt.clf()
plt.figure(figsize=(8, 6))
plt.gca().set_aspect('equal')
plt.imshow(heatmap.T, extent=extent, origin='lower', cmap=plt.get_cmap('nipy_spectral'))


I wish there were more tutorials like this around took me more time than I expected to figure it out. Hopefully, this helps someone!

• Gotcha, what line do you get the error I should be able to help out if you need it – kauii8 Feb 26 at 0:36
• I've posted the entire thing as a temporary answer below. I will have a more modern version of astropy available in about an hour – uhoh Feb 26 at 0:48
• Gotcha looks like those warnings should be fine it's likely due to the fact there are nans in the dataset. Do the warnings cause the image not to show? – kauii8 Feb 26 at 1:05
• oic, in addition to not importing matplotlib your script doesn't contain plt.show() and that's the only reason nothing happened! Plotting the log10 of the data I get this: i.stack.imgur.com/OiBIr.png which means everything seems okay and I'm on my way! (it's early here and my morning coffee is just starting to kick in) – uhoh Feb 26 at 1:12

SDSS DR12 Catalog Data looks like a good starting point, apparently pretty open to those willing and able to figure it out. Their SciServer Compute site hosts Jupyter notebooks to query CasJobs in SQL.

The Large Scale Structure galaxy catalog under BOSS value added catalogs may also be relevant.