Open elinor-lev opened 6 years ago
I can't reproduce this. Could you give us some more information: what astroquery version are you using? What python version?
However, I get an error when I run this script, it's just a different error. There is no match, and the exception astroquery returns is not very useful.
The error is this:
Error: No table info found for heasarc%5Fswift. This may be an error in your specification or our database may be unavailable. The database reports an error condition.
but the traceback I got was an IORegistryError: Format could not be identified.
I'm using conda 4.5.0, python 2.7.11, and astroquery 0.3.7 (installed using conda). Swift is one of the missions HEASARC has on its query page, but perhaps it's not listed that way in the module. I tried getting a list of missions from the object but again it says it doesn't have that attribute:
table = heasarc.query_mission_list()
AttributeError: 'HeasarcClass' object has no attribute 'query_mission_list'
OK, your astroquery is definitely broken, and I don't know why. Try pip installing the latest version - the conda version must just be broken.
As for the SWIFT issue, the problem is that SWIFT is many missions:
Archive name Table_Description
str7 str27 str80
------- ---------- ----------------------------------------------
HEASARC swbatagn60 Swift BAT 60-Month Survey of Active Galactic Nuclei Catalog
HEASARC swbatsfxt Swift BAT 100-Month Supergiant Fast X-Ray Transient Catalog
HEASARC swiftbalog Swift BAT Instrument Log
HEASARC swiftgrb Swift Gamma Ray Bursts Catalog
HEASARC swiftmastr Swift Master Catalog
HEASARC swifttdrss Swift TDRSS Messages
HEASARC swiftuvlog Swift UVOT Instrument Log
HEASARC swiftxrlog Swift XRT Instrument Log
You should see that as part of the list returned by query_mission_list
if you get astroquery to work at all.
it does the same thing for pip install (installs v 0.3.7). Perhaps it's related to the python 2.7 version?
Maybe, I'll check, but I'd be very surprised. In the meantime, try installing the latest version ('bleeding edge') using the instructions here: https://astroquery.readthedocs.io/en/latest/#using-pip
Thanks, that solved it.
I can confirm that this is not a python2.7 issue.
The only possibility I can think of is that @async_to_sync
is not running, but I have no idea how that would have occurred. I'm glad the latest version solves this.
This issue will remain open, though, but the remaining problem is that we need to validate the mission prior to sending requests, and we need better error handling when the server returns an error message.
I'm going to hack on astroquery.heasarc tomorrow at Python in Astronomy, so I'll work on fixing this bug on error handling! @keflavich what do you mean about "validate the mission"?
@abigailStev validate the mission ID passed in the query. So, for example:
table = heasarc.query_region(coords, mission='swift', radius='40000 degree')
should return an exception along the lines of "swift
is not a valid mission. Please look at query_mission_list
to see a list of valid missions.". Better yet, try to suggest an appropriate mission name using a regex match.
@keflavich , I am using the latest version of astroquery (0.4.2.dev6304) and I am getting an error similar to @elinor-lev :
IORegistryError: Format could not be identified based on the file name or contents, please provide a 'format' argument. '
The relevant code is:
mission = 'swiftuvlog'
coords = SkyCoord(ra=107.18696, dec=-70.5000, unit="deg")
table = heasarc.query_region(coords, mission=mission, radius='50 arcmin')
I am getting this error irrespective of the mission.
@amanpkaur that results in some sort of generic error message:
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>HEASARC Browse: Error from Browse</title>
<link rel="stylesheet" href="/W3Browse/w3browsetable.css" title="colortable style" type="text/css" media="screen">
<link rel="alternate stylesheet" href="/W3Browse/w3browse.css" title="scrolltable style" type="text/css" media="screen">
<link rel="stylesheet" type="text/css" href="/W3Browse/plotting/codebase/dhtmlx.css"/>
<link rel="stylesheet" href="/W3Browse/w3browseprint.css" title="print style" type="text/css" media="print">
<script type='text/javascript' src="/W3Browse/plotting/codebase/dhtmlx.js"></script>
<script type='text/javascript' src="/W3Browse/tips/tips.js"></script>
<script type='text/javascript' src="/W3Browse/w3main.js"></script>
<script type='text/javascript' src="/W3Browse/w3summaryhtml.js"></script>
<!--<script type='text/javascript' src="/xamin/js/browseplot.js"></script>
<script type="text/javascript" src="/xamin/js/keywordQuery.js"></script>
<script type="text/javascript" src="/xamin/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javaScript" src="/xamin/extjs/ext-all-debug.js"></script>-->
<script language='JavaScript' type='text/javascript'>
//--- Prevent submit when return key is pressed
function noenter(evt) {
//return !(window.event && window.event.keyCode == 13);
evt = (evt) ? evt : event;
var charCode = (evt.charCode) ? evt.charCode :
((evt.which) ? evt.which : evt.keyCode);
if (charCode == 13 || charCode == 3) {
return false;
} else {
return true;
}
}
</script>
<style type="text/css">
table.w3b_missions {
border:1px !important;
}
table.w3b_missions td {
font-size: .95em;
/*background-color: #F4F4F4; */
}
</style>
<script>
var myPop;
var myForm;
function showPlotNotes(inp) {
if (!myPop) {
myPop = new dhtmlXPopup();
myPop.attachHTML("Browse and Xamin data may be up to 12 hours out of sync.<br> Some complex Browse query constraints may be ignored in Xamin.");
}
if (myPop.isVisible()) {
myPop.hide();
} else {
var x = window.dhx4.absLeft(inp);
var y = window.dhx4.absTop(inp);
var w = inp.offsetWidth;
var h = inp.offsetHeight;
myPop.show(x,y,w,h);
}
}
function hidePopup() {
if (myPop) myPop.hide();
}
</script>
</head>
<body bgcolor="#ffffff" text="#090909"
link="#0505ff" vlink="#ff0000" alink="#c0f0c0" onLoad="pageLoaded();changeLink()">
<script type='text/javascript' src="/W3Browse/wz_tooltip.js"></script>
<table width="100%" border="1">
<tr><td>
<table width="100%" cellspacing="0">
<tr class='standard'>
<td width="10%" align="left"> <a href="/docs/archive.html"><b>Archive</b></a></td>
<!--<td align="center" class="larger">Error from Browse</td>-->
<td align="center" >Error from Browse</td>
<td align="right">
<a href="/W3Browse/w3btipsarchive.html" ><img src="/Images/w3b/tiparchive.jpg" border="0" alt="Tips Archive"></a>
<a href="/hera"><img border="0" alt="You are using the Hera-enabled Browse" height="32" width="45" src="/Images/w3b/test/hera_white_on_gold-red_oval.gif"></a> <a target="helpwin" href="/W3Browse/w3browse-help.html"><img border="0" alt="Help" src="/Images/w3b/help.gif" height="30" width="30"></a></td>
</tr>
</table>
</td></tr>
</table>
<br><h2>An error occurred while initiating a database query.</h2><br><b>General Help</b> can be found on the <a href='/W3Browse/w3browse-help.html'>Browse Help Page</a><br><b>Coordinate Format Help</b> can be found in the <a href='/W3Browse/w3browse-help.html#name_coords'>Explanation of Name/Coordinates Input Formats section</a><br><b>Parameter Search Help</b> can be found in the <a href='/W3Browse/w3browse-help.html#Parameter_Search'>Search by Parameter section</a></table></table></table><p>
<span style='font-size:90%'>Page maintainer:
<a href="/cgi-bin/Feedback?selected=w3browse" target="feedback"> Browse Feedback</a></span>
</body>
</html>
See if you can get this search to work through the web interface; this looks like a real bug.
Yep, it returns the error message as implemented in the html file
Ah, ok, so that's an upstream issue =(
Ah, ok, so that's an upstream issue =(
What should I do in this regard?
Actually, I think there is no upstream issue here. You've just queried a table that has no results. The error message is not helpful, but there are no sources. Try: heasarc.query_region(coords, mission='swiftmastr', radius=50*u.arcmin)
instead.
Actually, I think there is no upstream issue here. You've just queried a table that has no results. The error message is not helpful, but there are no sources. Try:
heasarc.query_region(coords, mission='swiftmastr', radius=50*u.arcmin)
instead.
It seemed that I had to add "u" to the radius
keyword for the search to work. It works for now for swiftmastr
catalog, but fails for swiftxrlog
and `swiftuvlog'. These are present in the mission list, but I am not sure what is happening. I can work around the master catalog for now, but it would be good to know what is the issue with these two tables. Thanks a lot for your prompt responses and help!
I tried querying all swift objects using the HEASRC service and query_region, as listed in the docs, but it claims it does not have that attribute:
from astroquery.heasarc import Heasarc
from astropy.coordinates import SkyCoord
heasarc = Heasarc()
mission = 'swift'
coords = SkyCoord('00h00m00.0s +00d00m00.0s', frame='icrs')
table = heasarc.query_region(coords, mission=mission, radius='40000 degree')
Traceback (most recent call last):
File "", line 6, in
table = heasarc.query_region(coords, mission=mission, radius='40000 degree')
AttributeError: 'HeasarcClass' object has no attribute 'query_region'