Closed cdeil closed 11 years ago
I think that means NED returned "empty". That means the wrong exception is being raised, AND the example isn't a great one. The example should probably be a much smaller area (say, 0.5 deg at most). The Exception could have been any of a dozen things, but I suspect a timeout error or the like
I can't reproduce this in latest:
In [8]: >>> from astroquery.ned import Ned
In [9]: >>> import astropy.units as u
In [10]: >>> import astropy.coordinates as coord
In [11]: >>> result_table = Ned.query_region(coord.FK4Coordinates(ra=56.38, dec=38.43,
....: ... unit=(u.deg, u.deg)), radius=5 * u.deg, equinox='B1950.0')
In [12]: result_table
Out[12]:
<Table rows=9014 names=('No.','Object Name','RA(deg)','DEC(deg)','Type','Velocity','Redshift','Redshift Flag','Magnitude and Filter','Distance (arcmin)','References','Notes','Photometry Points','Positions','Redshift Points','Diameter Points','Associations')>
masked_array(data = [ (1, 'NVSS J032629+385759', 51.62125, 38.96661, 'RadioS', --, --, '', '0.86', 299.951, 0, 0, 1, 0, 0, 0, 0)
(2, 'NVSS J032630+385402', 51.62908, 38.90072, 'RadioS', --, --, '', '0.66', 299.565, 0, 0, 1, 0, 0, 0, 0)
(3, 'CGCG 525-033', 51.63563, 38.66205, 'G', 17481.0, 0.05831, '', '15.6', 299.617, 6, 0, 15, 3, 1, 2, 0)
...,
(9012, 'NVSS J041743+385340', 64.43129, 38.8945, 'RadioS', --, --, '', '0.64', 299.157, 0, 0, 1, 0, 0, 0, 0)
(9013, '2MASX J04174705+3901470', 64.44604, 39.02975, 'G', --, --, '', '', 299.935, 0, 0, 9, 0, 0, 2, 0)
(9014, '2MASX J04174722+3900170', 64.44679, 39.00469, 'G', --, --, '', '', 299.937, 0, 0, 9, 0, 0, 2, 0)],
mask = [ (False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False)
(False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False)
(False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)
...,
(False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False)
(False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False)
(False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False)],
fill_value = (999999, 'N/A', 1e+20, 1e+20, '?', 1e+20, 1e+20, '?', '?', 1e+20, 999999, 999999, 999999, 999999, 999999, 999999, 999999),
dtype = [('No.', '<i4'), ('Object Name', 'S30'), ('RA(deg)', '<f8'), ('DEC(deg)', '<f8'), ('Type', 'O'), ('Velocity', '<f8'), ('Redshift', '<f8'), ('Redshift Flag', 'O'), ('Magnitude and Filter', 'O'), ('Distance (arcmin)', '<f8'), ('References', '<i4'), ('Notes', '<i4'), ('Photometry Points', '<i4'), ('Positions', '<i4'), ('Redshift Points', '<i4'), ('Diameter Points', '<i4'), ('Associations', '<i4')])
In [13]: result_table.pprint()
No. Object Name RA(deg) DEC(deg) Type Velocity ... Notes Photometry Points Positions Redshift Points Diameter Points Associations
---- ----------------------- ---------- ---------- ------ ---------- ... ----- ----------------- --------- --------------- --------------- ------------
1 NVSS J032629+385759 51.62125 38.96661 RadioS -- ... 0 1 0 0 0 0
2 NVSS J032630+385402 51.62908 38.90072 RadioS -- ... 0 1 0 0 0 0
3 CGCG 525-033 51.63563 38.66205 G 17481.0 ... 0 15 3 1 2 0
4 2MASX J03263334+3837013 51.63892 38.61714 G -- ... 0 9 0 0 2 0
5 NVSS J032641+382502 51.67188 38.41742 RadioS -- ... 0 1 0 0 0 0
6 2MASX J03264256+3902594 51.67725 39.04989 G -- ... 0 9 0 0 2 0
7 2MASX J03264282+3922284 51.67842 39.37461 G -- ... 0 9 0 0 2 0
8 2MASX J03264358+3843424 51.68167 38.72856 G -- ... 0 9 0 0 2 0
9 NVSS J032647+384744 51.69854 38.79558 RadioS -- ... 0 1 0 0 0 0
10 2MASX J03264846+3853004 51.70192 38.88342 G -- ... 0 9 0 0 2 0
11 NVSS J032649+380707 51.70513 38.11878 RadioS -- ... 0 1 0 0 0 0
12 2MASX J03264957+3936224 51.70669 39.60618 G 6996.0 ... 0 9 1 1 2 0
13 NVSS J032650+384349 51.71 38.73031 RadioS -- ... 0 1 0 0 0 0
14 2MASX J03265105+3901073 51.71275 39.01861 G -- ... 0 9 0 0 2 0
15 B3 0323+390 51.71517 39.23811 RadioS -- ... 0 2 1 0 0 0
16 2MASX J03265308+3923259 51.72117 39.39053 G -- ... 0 9 0 0 2 0
17 UGC 02738 51.72379 39.53119 G -- ... 2 9 1 0 5 0
18 NVSS J032659+394134 51.74904 39.69297 RadioS -- ... 0 1 0 0 0 0
19 2MASX J03270217+3830349 51.75912 38.50967 G -- ... 0 9 0 0 2 0
20 NVSS J032703+392225 51.76617 39.37381 RadioS -- ... 0 1 0 0 0 0
21 NVSS J032704+375857 51.76879 37.98264 RadioS -- ... 0 1 0 0 0 0
22 NVSS J032704+390943 51.76904 39.16211 RadioS -- ... 0 1 0 0 0 0
23 2MASX J03270507+3829509 51.77117 38.49761 G -- ... 0 9 0 0 2 0
24 2MASX J03270540+3936229 51.77258 39.60639 G -- ... 0 9 0 0 2 0
... ... ... ... ... ... ... ... ... ... ... ... ...
8991 NVSS J041707+384955 64.28183 38.83217 RadioS -- ... 0 1 0 0 0 0
8992 NVSS J041708+390133 64.2845 39.02589 RadioS -- ... 0 1 0 0 0 0
8993 NVSS J041709+384735 64.28896 38.79306 RadioS -- ... 0 1 0 0 0 0
8994 87GB 041347.6+393734 64.29742 39.74756 RadioS -- ... 0 3 2 0 0 0
8995 NVSS J041711+375814 64.29829 37.97058 RadioS -- ... 0 1 0 0 0 0
8996 2MASX J04171738+3803090 64.32237 38.05244 G -- ... 0 9 0 0 2 0
8997 NVSS J041718+383858 64.32696 38.64969 RadioS -- ... 0 1 0 0 0 0
8998 B3 0413+394 64.32825 39.53881 RadioS -- ... 0 6 3 0 0 0
8999 2XMM J041722.7+380841 64.34482 38.14477 XrayS -- ... 0 0 0 0 0 0
9000 2XMM J041725.0+380706 64.35449 38.11858 XrayS -- ... 0 0 0 0 0 0
9001 NVSS J041725+392701 64.35671 39.45044 RadioS -- ... 0 1 0 0 0 0
9002 2MASX J04172708+3926260 64.36275 39.44044 G -- ... 0 9 0 0 2 0
9003 NVSS J041727+392316 64.36325 39.38789 RadioS -- ... 0 1 0 0 0 0
9004 NVSS J041730+385808 64.37504 38.96906 RadioS -- ... 0 1 0 0 0 0
9005 2MASX J04173284+3830281 64.38696 38.50778 G -- ... 0 9 0 0 2 0
9006 87GB 041411.6+390055 64.39467 39.14 RadioS -- ... 0 3 2 0 0 0
9007 B3 0414+393 64.39539 39.42602 RadioS -- ... 0 1 1 0 0 0
9008 2MASX J04173572+3906291 64.39888 39.10811 G -- ... 0 8 0 0 2 0
9009 B3 0414+389 64.41151 39.1165 RadioS -- ... 0 1 1 0 0 0
9010 2MASX J04174129+3841541 64.42208 38.6985 G -- ... 0 9 0 0 2 0
9011 NVSS J041742+391310 64.42617 39.2195 RadioS -- ... 0 1 0 0 0 0
9012 NVSS J041743+385340 64.43129 38.8945 RadioS -- ... 0 1 0 0 0 0
9013 2MASX J04174705+3901470 64.44604 39.02975 G -- ... 0 9 0 0 2 0
9014 2MASX J04174722+3900170 64.44679 39.00469 G -- ... 0 9 0 0 2 0
so perhaps it's fixed?
I also can't reproduce the original problem.
Now it does work for me if I choose e.g. a radius of 0.5 deg, but with 5 deg I don't get a result or timeout, even though I waited several minutes and the timeout should have occured after 60 seconds.
Can you reproduce this issue of timeout not occuring?
In [6]: %time Ned.query_region(coord.FK4Coordinates(ra=56.38, dec=38.43, unit=(u.deg, u.deg)), radius=5 * u.deg, equinox='B1950.0')
^CERROR: KeyboardInterrupt [socket]
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-6-d34be53bfbf3> in <module>()
----> 1 get_ipython().magic(u"time Ned.query_region(coord.FK4Coordinates(ra=56.38, dec=38.43, unit=(u.deg, u.deg)), radius=5 * u.deg, equinox='B1950.0')")
/Users/deil/Library/Python/2.7/lib/python/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2153 magic_name, _, magic_arg_s = arg_s.partition(' ')
2154 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2155 return self.run_line_magic(magic_name, magic_arg_s)
2156
2157 #-------------------------------------------------------------------------
/Users/deil/Library/Python/2.7/lib/python/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2074 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2075 with self.builtin_trap:
-> 2076 result = fn(*args,**kwargs)
2077 return result
2078
/Users/deil/Library/Python/2.7/lib/python/site-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns)
/Users/deil/Library/Python/2.7/lib/python/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
189 # but it's overkill for just that one bit of state.
190 def magic_deco(arg):
--> 191 call = lambda f, *a, **k: f(*a, **k)
192
193 if callable(arg):
/Users/deil/Library/Python/2.7/lib/python/site-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns)
1038 if mode=='eval':
1039 st = clock2()
-> 1040 out = eval(code, glob, local_ns)
1041 end = clock2()
1042 else:
<timed eval> in <module>()
/Users/deil/Library/Python/2.7/lib/python/site-packages/astroquery-0.0.dev1142-py2.7.egg/astroquery/utils/class_or_instance.pyc in <lambda>(*args, **kwds)
23 f = lambda *args, **kwds: self.fn(obj, *args, **kwds)
24 else:
---> 25 f = lambda *args, **kwds: self.fn(cls, *args, **kwds)
26 functools.update_wrapper(f, self.fn)
27 return f
/Users/deil/Library/Python/2.7/lib/python/site-packages/astroquery-0.0.dev1142-py2.7.egg/astroquery/ned/core.pyc in query_region(self, coordinates, radius, equinox, get_query_payload, verbose)
135 # for NED's object near name/ near region
136 response = self.query_region_async(coordinates, radius=radius, equinox=equinox,
--> 137 get_query_payload=get_query_payload)
138 if get_query_payload:
139 return response
/Users/deil/Library/Python/2.7/lib/python/site-packages/astroquery-0.0.dev1142-py2.7.egg/astroquery/utils/class_or_instance.pyc in <lambda>(*args, **kwds)
23 f = lambda *args, **kwds: self.fn(obj, *args, **kwds)
24 else:
---> 25 f = lambda *args, **kwds: self.fn(cls, *args, **kwds)
26 functools.update_wrapper(f, self.fn)
27 return f
/Users/deil/Library/Python/2.7/lib/python/site-packages/astroquery-0.0.dev1142-py2.7.egg/astroquery/ned/core.pyc in query_region_async(self, coordinates, radius, equinox, get_query_payload)
195 if get_query_payload:
196 return request_payload
--> 197 response = commons.send_request(Ned.OBJ_SEARCH_URL, request_payload, Ned.TIMEOUT, request_type='GET')
198 return response
199
/Users/deil/Library/Python/2.7/lib/python/site-packages/astroquery-0.0.dev1142-py2.7.egg/astroquery/utils/commons.pyc in send_request(url, data, timeout, request_type, **kwargs)
51 try:
52 if request_type == 'GET':
---> 53 response = requests.get(url, params=data, timeout=timeout, **kwargs)
54 return response
55 elif request_type == 'POST':
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.pyc in get(url, **kwargs)
53
54 kwargs.setdefault('allow_redirects', True)
---> 55 return request('get', url, **kwargs)
56
57
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.pyc in request(method, url, **kwargs)
42
43 session = sessions.Session()
---> 44 return session.request(method=method, url=url, **kwargs)
45
46
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.pyc in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert)
333 'allow_redirects': allow_redirects,
334 }
--> 335 resp = self.send(prep, **send_kwargs)
336
337 return resp
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.pyc in send(self, request, **kwargs)
436 start = datetime.utcnow()
437 # Send the request
--> 438 r = adapter.send(request, **kwargs)
439 # Total elapsed time of the request (approximately)
440 r.elapsed = datetime.utcnow() - start
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/adapters.pyc in send(self, request, stream, timeout, verify, cert, proxies)
338
339 if not stream:
--> 340 r.content
341
342 return r
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.pyc in content(self)
592 self._content = None
593 else:
--> 594 self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
595
596 except AttributeError:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.pyc in generate()
539 def generate():
540 while 1:
--> 541 chunk = self.raw.read(chunk_size, decode_content=True)
542 if not chunk:
543 break
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/response.pyc in read(self, amt, decode_content, cache_content)
169 else:
170 cache_content = False
--> 171 data = self._fp.read(amt)
172 if amt != 0 and not data: # Platform-specific: Buggy versions of Python.
173 # Close the connection when no data is returned
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc in read(self, amt)
541
542 if self.chunked:
--> 543 return self._read_chunked(amt)
544
545 if amt is None:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc in _read_chunked(self, amt)
610 return ''.join(value)
611 else:
--> 612 value.append(self._safe_read(chunk_left))
613 amt -= chunk_left
614
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc in _safe_read(self, amt)
656 s = []
657 while amt > 0:
--> 658 chunk = self.fp.read(min(amt, MAXAMOUNT))
659 if not chunk:
660 raise IncompleteRead(''.join(s), amt)
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.pyc in read(self, size)
378 # fragmentation issues on many platforms.
379 try:
--> 380 data = self._sock.recv(left)
381 except error, e:
382 if e.args[0] == EINTR:
KeyboardInterrupt:
I got a successful result again:
In [24]: Ned.query_region(coord.FK4Coordinates(ra=56.38, dec=38.43, unit=(u.deg, u.deg)), radius=5 * u.deg, equinox='B1950.0')
Out[24]:
<Table rows=9014 names=('No.','Object Name','RA(deg)','DEC(deg)','Type','Velocity','Redshift','Redshift Flag','Magnitude and Filter','Distance (arcmin)','References','Notes','Photometry Points','Positions','Redshift Points','Diameter Points','Associations')>
masked_array(data = [ (1, 'NVSS J032629+385759', 51.62125, 38.96661, 'RadioS', --, --, '', '0.86', 299.951, 0, 0, 1, 0, 0, 0, 0)
(2, 'NVSS J032630+385402', 51.62908, 38.90072, 'RadioS', --, --, '', '0.66', 299.565, 0, 0, 1, 0, 0, 0, 0)
(3, 'CGCG 525-033', 51.63563, 38.66205, 'G', 17481.0, 0.05831, '', '15.6', 299.617, 6, 0, 15, 3, 1, 2, 0)
...,
(9012, 'NVSS J041743+385340', 64.43129, 38.8945, 'RadioS', --, --, '', '0.64', 299.157, 0, 0, 1, 0, 0, 0, 0)
(9013, '2MASX J04174705+3901470', 64.44604, 39.02975, 'G', --, --, '', '', 299.935, 0, 0, 9, 0, 0, 2, 0)
(9014, '2MASX J04174722+3900170', 64.44679, 39.00469, 'G', --, --, '', '', 299.937, 0, 0, 9, 0, 0, 2, 0)],
mask = [ (False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False)
(False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False)
(False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)
...,
(False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False)
(False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False)
(False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False)],
fill_value = (999999, 'N/A', 1e+20, 1e+20, '?', 1e+20, 1e+20, '?', '?', 1e+20, 999999, 999999, 999999, 999999, 999999, 999999, 999999),
dtype = [('No.', '<i4'), ('Object Name', 'S30'), ('RA(deg)', '<f8'), ('DEC(deg)', '<f8'), ('Type', 'O'), ('Velocity', '<f8'), ('Redshift', '<f8'), ('Redshift Flag', 'O'), ('Magnitude and Filter', 'O'), ('Distance (arcmin)', '<f8'), ('References', '<i4'), ('Notes', '<i4'), ('Photometry Points', '<i4'), ('Positions', '<i4'), ('Redshift Points', '<i4'), ('Diameter Points', '<i4'), ('Associations', '<i4')])
Ha, the reason mine worked is a matter of seconds:
In [25]: %time Ned.query_region(coord.FK4Coordinates(ra=56.38, dec=38.43, unit=(u.deg, u.deg)), radius=5 * u.deg, equinox='B1950.0')
CPU times: user 1.88 s, sys: 101 ms, total: 1.98 s
Wall time: 57.1 s
Out[25]:
...truncated ...
With a larger area, I did get a timeout:
In [26]: %time Ned.query_region(coord.FK4Coordinates(ra=56.38, dec=38.43, unit=(u.deg, u.deg)), radius=6 * u.deg, equinox='B1950.0')
ERROR: timeout: timed out [socket]
...truncated...
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 476, in readline
data = self._sock.recv(self._rbufsize)
timeout: timed out
But you're NOT getting this timeout error? Something is amiss... I don't know how to track this one down though. Any ideas?
Yesterday I didn't get the timeout error, but maybe I did something wrong, I re-tried several times now and do get the timeout error reliably.
I wanted to update docs/ned.rst
to use 0.5 deg search radius instead of 5 deg as you suggested.
But using the 10x smaller search radius I now get 16752 instead of 936 rows. Did the NED behaviour change or am I doing something wrong?
In [1]: %paste
>>> from astroquery.ned import Ned
>>> import astropy.units as u
>>> result_table = Ned.query_region("3c 273", radius=0.5 * u.deg)
>>> print(result_table)
## -- End pasted text --
WARNING: Module readline was already imported from /Users/deil/Library/Python/2.7/lib/python/site-packages/IPython/utils/rlineimpl.pyc, but /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/readline is being added to sys.path [pkg_resources]
No. Object Name RA(deg) ... Redshift Points Diameter Points Associations
----- ------------------------ ---------- ... --------------- --------------- ------------
1 SDSS J122706.99+020351.7 186.77913 ... 0 4 0
2 SDSS J122707.55+020344.1 186.78149 ... 0 4 0
3 SDSS J122707.58+015939.3 186.7816 ... 0 4 0
4 SDSS J122707.63+020159.0 186.78181 ... 0 4 0
5 SDSS J122707.65+020248.0 186.78191 ... 0 4 0
6 SDSS J122707.80+020141.1 186.78251 ... 0 3 0
7 SDSS J122708.15+015843.0 186.784 ... 0 3 0
8 SDSS J122708.35+020726.8 186.78479 ... 0 4 0
9 SDSS J122708.41+020413.2 186.78506 ... 0 4 0
10 SDSS J122708.53+020624.9 186.78556 ... 0 4 0
11 SDSS J122708.55+015940.9 186.78563 ... 2 4 0
12 SDSS J122708.64+020815.0 186.786 ... 0 4 0
13 SDSS J122708.69+020003.1 186.78623 ... 0 4 0
... ... ... ... ... ... ...
16740 SDSS J123104.63+020318.9 187.76932 ... 0 4 0
16741 SDSS J123104.84+020049.6 187.77021 ... 0 3 0
16742 SDSS J123104.87+020317.9 187.77032 ... 0 3 0
16743 NVSS J123104+020415 187.77071 ... 0 0 0
16744 SDSS J123105.06+020402.3 187.77108 ... 0 3 0
16745 SDSS J123105.07+020447.5 187.77116 ... 0 4 0
16746 SDSS J123105.10+020326.8 187.77127 ... 0 4 0
16747 SDSS J123105.28+020246.8 187.77204 ... 2 4 0
16748 NVSS J123105+020023 187.77208 ... 0 0 0
16749 SDSS J123105.96+020002.0 187.77484 ... 0 4 0
16750 SDSS J123106.00+020424.6 187.77504 ... 0 4 0
16751 SDSS J123106.41+020408.1 187.77674 ... 0 4 0
16752 SDSS J123106.72+020355.8 187.77802 ... 0 4 0
In [2]:
I think this was fixed... @cdeil, reopen if I lied.
The
Ned.query_region
example in the tutorial gives an error for me.Can someone reproduce?