Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sdss fixes python3 #91

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions astroquery/sdss/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
Affiliation: University of Colorado at Boulder
Created on: Sun Apr 14 19:18:43 2013

Description: Access Sloan Digital Sky Survey database online via Tamas
Budavari's SQL tool (included). Higher level wrappers provided to download
Description: Access Sloan Digital Sky Survey database online. Higher level wrappers provided to download
spectra and images using wget.

"""
Expand All @@ -18,7 +17,7 @@
import os, re, math
from astropy.io import fits
from astropy import coordinates as coord
from . import sqlcl
import requests

# Default photometric and spectroscopic quantities to retrieve.
photoobj_defs = ['ra', 'dec', 'objid', 'run', 'rerun', 'camcol', 'field']
Expand Down Expand Up @@ -47,8 +46,7 @@ def crossID(ra, dec, unit=None, dr=2., fields=None):
"""
Perform object cross-ID in SDSS using SQL.

Search for objects near position (ra, dec) within some radius using
Tamas Budavari's SQL tool (sqlcl.py).
Search for objects near position (ra, dec) within some radius.

Parameters
----------
Expand Down Expand Up @@ -108,18 +106,19 @@ def crossID(ra, dec, unit=None, dr=2., fields=None):
q_where = 'WHERE (p.ra between %g and %g) and (p.dec between %g and %g)' \
% (ra.degrees-dr, ra.degrees+dr, dec.degrees-dr, dec.degrees+dr)

q = sqlcl.query("%s%s%s%s" % (q_select, q_from, q_join, q_where))
sql = "%s%s%s%s" % (q_select, q_from, q_join, q_where)
r = requests.get('http://cas.sdss.org/public/en/tools/search/x_sql.asp', params={'cmd': sql, 'format': 'csv'})

results = []
cols = q.readline()
while True:
line = q.readline().replace('\n', '').split(',')
(cols, data) = r.text.split('\n',1)
for line in data.split('\n'):
items = line.split(',')

if len(line) == 1:
if len(items) == 1:
break

tmp = {}
for i, val in enumerate(line):
for i, val in enumerate(items):

field = fields[i]

Expand Down
109 changes: 0 additions & 109 deletions astroquery/sdss/sqlcl.py

This file was deleted.