astroquery
astroquery copied to clipboard
BUG: CASDA query at 0 DEC exactly
Hi,
I've noticed that astroquery.casda.Casda.query_region fails if the sky coordinates are given at exactly 0 declination.
I'm not sure why, as the error message is not very descriptive, but it doesn't seem to be an integer vs float issue at least, and it also doesn't seem to be this particular region of sky, as a tiny deviation from 0 DEC does work:
This is using
astroquery.__version__
'0.4.10.dev9924'
The plot thickens, actually, as any order of magnitude smaller than 1e-3 DEC also fails
and with the 0.4.10 release, this is the error trace:
ValueError Traceback (most recent call last)
File /usr/local/lib/python3.12/site-packages/astroquery/casda/core.py:220, in CasdaClass._parse_result(self, response, verbose)
219 data = BytesIO(response.content)
--> 220 table = Table.read(data)
221 return table
File /usr/local/lib/python3.12/site-packages/astropy/table/connect.py:62, in TableRead.__call__(self, *args, **kwargs)
60 descriptions = kwargs.pop("descriptions", None)
---> 62 out = self.registry.read(cls, *args, **kwargs)
64 # For some readers (e.g., ascii.ecsv), the returned `out` class is not
65 # guaranteed to be the same as the desired output `cls`. If so,
66 # try coercing to desired class without copying (io.registry.read
67 # would normally do a copy). The normal case here is swapping
68 # Table <=> QTable.
File /usr/local/lib/python3.12/site-packages/astropy/io/registry/core.py:221, in UnifiedInputRegistry.read(self, cls, format, cache, *args, **kwargs)
220 reader = self.get_reader(format, cls)
--> 221 data = reader(*args, **kwargs)
223 if not isinstance(data, cls):
224 # User has read with a subclass where only the parent class is
225 # registered. This returns the parent class, so try coercing
226 # to desired subclass.
File /usr/local/lib/python3.12/site-packages/astropy/io/votable/connect.py:123, in read_table_votable(input, table_id, use_names_over_ids, verify, **kwargs)
122 else:
--> 123 raise ValueError("No table found")
124 elif isinstance(input, TableElement):
ValueError: No table found
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In[12], line 1
----> 1 result = casda.query_region(SkyCoord(171.75*u.deg,0.0001*u.deg), radius=30*u.arcmin)
File /usr/local/lib/python3.12/site-packages/astroquery/utils/class_or_instance.py:25, in class_or_instance.__get__.<locals>.f(*args, **kwds)
23 def f(*args, **kwds):
24 if obj is not None:
---> 25 return self.fn(obj, *args, **kwds)
26 else:
27 return self.fn(cls, *args, **kwds)
File /usr/local/lib/python3.12/site-packages/astroquery/utils/process_asyncs.py:29, in async_to_sync.<locals>.create_method.<locals>.newmethod(self, *args, **kwargs)
27 if kwargs.get('get_query_payload') or kwargs.get('field_help'):
28 return response
---> 29 result = self._parse_result(response, verbose=verbose)
30 self.table = result
31 return result
File /usr/local/lib/python3.12/site-packages/astroquery/casda/core.py:225, in CasdaClass._parse_result(self, response, verbose)
221 return table
222 except ValueError as e:
223 # catch common errors here, but never use bare excepts
224 # return raw result/ handle in some way
--> 225 log.info("Failed to convert query result to table", e)
226 return response
File /usr/local/lib/python3.12/logging/__init__.py:1539, in Logger.info(self, msg, *args, **kwargs)
1530 """
1531 Log 'msg % args' with severity 'INFO'.
1532
(...) 1536 logger.info("Houston, we have a %s", "notable problem", exc_info=1)
1537 """
1538 if self.isEnabledFor(INFO):
-> 1539 self._log(INFO, msg, args, **kwargs)
File /usr/local/lib/python3.12/logging/__init__.py:1684, in Logger._log(self, level, msg, args, exc_info, extra, stack_info, stacklevel)
1681 exc_info = sys.exc_info()
1682 record = self.makeRecord(self.name, level, fn, lno, msg, args,
1683 exc_info, func, extra, sinfo)
-> 1684 self.handle(record)
File /usr/local/lib/python3.12/logging/__init__.py:1700, in Logger.handle(self, record)
1698 if isinstance(maybe_record, LogRecord):
1699 record = maybe_record
-> 1700 self.callHandlers(record)
File /usr/local/lib/python3.12/logging/__init__.py:1762, in Logger.callHandlers(self, record)
1760 found = found + 1
1761 if record.levelno >= hdlr.level:
-> 1762 hdlr.handle(record)
1763 if not c.propagate:
1764 c = None #break out
File /usr/local/lib/python3.12/logging/__init__.py:1028, in Handler.handle(self, record)
1026 self.acquire()
1027 try:
-> 1028 self.emit(record)
1029 finally:
1030 self.release()
File /usr/local/lib/python3.12/site-packages/astropy/logger.py:588, in StreamHandler.emit(self, record)
585 # Make lazy interpretation intentional to leave the option to use
586 # special characters without escaping in log messages.
587 if record.args:
--> 588 record.message = f"{record.msg % record.args} [{record.origin:s}]"
589 else:
590 record.message = f"{record.msg} [{record.origin:s}]"
TypeError: not all arguments converted during string formatting
I'll have a look at this later, it feels to be a potential upstream, astropy issue.
Either case I also cc @jd-au, too