|
2 | 2 |
|
3 | 3 | from io import StringIO, BytesIO
|
4 | 4 |
|
5 |
| -from astropy.io import ascii, votable |
| 5 | +from astropy.io import votable |
6 | 6 | import astropy.units as u
|
7 | 7 | from astropy.table import Table
|
8 | 8 | from requests import HTTPError
|
9 | 9 |
|
10 |
| - |
11 | 10 | from astroquery.query import BaseQuery
|
12 | 11 | from astroquery.exceptions import InvalidQueryError
|
13 | 12 | from astroquery.utils import url_helpers, prepend_docstr_nosections, async_to_sync
|
@@ -78,7 +77,7 @@ def query(self, cat1, cat2, max_distance,
|
78 | 77 | if get_query_payload:
|
79 | 78 | return response
|
80 | 79 |
|
81 |
| - return Table.read(BytesIO(response.content), format='votable') |
| 80 | + return Table.read(BytesIO(response.content), format='votable', use_names_over_ids=True) |
82 | 81 |
|
83 | 82 | @prepend_docstr_nosections("\n" + query.__doc__)
|
84 | 83 | def query_async(self, cat1, cat2, max_distance, colRA1=None, colDec1=None,
|
@@ -190,22 +189,5 @@ def get_available_tables(self, cache=True):
|
190 | 189 | content = response.text
|
191 | 190 | return content.splitlines()
|
192 | 191 |
|
193 |
| - def _parse_text(self, text): |
194 |
| - """ |
195 |
| - Parse a CSV text file that has potentially duplicated header names |
196 |
| - """ |
197 |
| - header = text.split("\n")[0] |
198 |
| - colnames = header.split(",") |
199 |
| - for column in colnames: |
200 |
| - if colnames.count(column) > 1: |
201 |
| - counter = 1 |
202 |
| - while colnames.count(column) > 0: |
203 |
| - colnames[colnames.index(column)] = column + "_{counter}".format(counter=counter) |
204 |
| - counter += 1 |
205 |
| - new_text = ",".join(colnames) + "\n" + "\n".join(text.split("\n")[1:]) |
206 |
| - result = ascii.read(new_text, format='csv', fast_reader=False) |
207 |
| - |
208 |
| - return result |
209 |
| - |
210 | 192 |
|
211 | 193 | XMatch = XMatchClass()
|
0 commit comments