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
Add gaiatap module in order to access to the European Space Agency Gaia Archive #836
Conversation
Thanks you @jcsegovia for this awesome contribution. We'll try to review it in details soon. |
I'm pinging @eteq and @andycasey as participants of previous discussions about Gaia TAP. |
A few quick, mainly stylistic comments I have to start with. I think the example directories are superfluous at their current place. However a narrative documentation is missing. Could you rework it under We follow the naming conventions of functions and methods are lower case (in the tests, too) while classes are CamelCase. We have our testing suite set up with py.test. While unittest is compatible with it, I see issues when using python 3.6. It's basically only the esasky module that use unittest and as a workaround for the py3.6 issue, I'm planning to refactor it to be pure pytest. If it's not too controversial, would it be possible to rework the tests here, too to be pure pytest? |
Oh, and I think it would make sense to rename the module to |
Thanks. Currently, we have created gaiatap/gaiatap.rst with the explanations. I think it should be moved to docs/gaia/gaia.rst Changes:
Question: shall we change 'private' method names also? About TAP: fine with us to move to a more generic place. |
Sorry, I forgot unittest: OK, we can remove unittest, but it will take a bit of time because we are using some mocking capabilities. |
@jcsegovia - Thanks, it sounds good. Before you do much work on it, it may be worth waiting for comments from @keflavich, he may have a few generic points too that I missed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments.
astroquery/gaiatap/core.py
Outdated
return self.__gaiatap.query_object_async(coordinate, radius=radius, width=width, height=height, verbose=verbose) | ||
|
||
def query_region(self, coordinate, radius=None, width=None): | ||
print ("Not available") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For these 'not available' methods, could you just leave them commented out for now? I wouldn't want users tricked into thinking that method is available when it's not yet.
Also, we prefer to raise NotImplementedError()
rather than print a statement like this
astroquery/gaiatap/core.py
Outdated
------- | ||
A Job object | ||
""" | ||
return self.__gaiatap.launch_async_job(query, name=name, output_file=output_file, output_format=output_format, verbose=verbose, dump_to_file=dump_to_file, background=background, upload_resource=upload_resource, upload_table_name=upload_table_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor style issue: could you make sure these long lines are wrapped at 80 characters, or at least close to 80?
if jobs is None: | ||
print ("No jobs") | ||
else: | ||
for j in jobs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you just print(jobs)
here? Or is the formatting ugly in this case?
#python 2 | ||
from urllib import urlencode as urlEncode | ||
|
||
class DummyConnHandler: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be class DummyConnHandler(object):
""" | ||
import os | ||
|
||
def get_pakcage_data(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pakcage->package
assert r.getMethod() == 'POST', "Request method. Expected %s, found %s" % ('POST', r.getMethod()) | ||
assert r.getContext() == context, "Request context. Expected %s, found %s" % (context, r.getContext()) | ||
assert r.getBody() == data, "Request body. Expected %s, found %s" % (data, str(r.getBody())) | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a pass
statement here and in other surrounding functions is unnecessary
astroquery/gaiatap/gaiatap.rst
Outdated
--------------------------- | ||
|
||
Authenticated users are able to access to TAP+ capabilities (shared tables, persistent jobs, etc.) | ||
In order to authenticate a user, ``login`` or ``login_gui`` methods must be called. After a successful |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should include a note here that Tkinter
is required for the login gui
@jcsegovia Thanks for this contribution, it is awesome! I've left a handful of minor comments above. @bsipocz's comments were spot on - we would certainly prefer to stick with an all-pytest framework if that is possible. In particular, I couldn't quite tell from skimming the code - do any of your tests require a remote connection? If so, we need to disable those by default and only enable them when the I won't be able to do a complete review of this module, as it is huge and has a lot of capabilities I don't fully understand. But, I'm happy to have it! |
@jcsegovia I edited your comment above to have a checklist for the items to be changed. |
@bsipocz, @keflavich: thank you very much for your inputs. About remote connection for tests: no we do not need it. Out tests are run in a isolated (mocked) environment. We are working on the implementation of these changes... Thanks again! |
@bsipocz , @keflavich where do you want me to put tap.rst? Currently, it is under astroquery/docs/tap/tap.rst (I haven't seen an astroquery/docs/utils section...) Also, in which index.rst section shall I put tap? |
Good questions. I think |
@jcsegovia - Probably the index page could use a bit of reorganizing, until that happens tap could go under "Other" I think: http://astroquery.readthedocs.io/en/latest/#other |
Also I've just noticed that all the svn files are getting included. |
@bsipocz .svn entries: my fault (sorry). They are removed. |
@jcsegovia - I've pushed directly to this branch a few tweaks to the organization of the docs pages to make sure the tests pass. Once CI is all green, I'll merge. |
Thank you @jcsegovia again for this contribution! |
@bsipocz , @keflavich thank you for your help and support. |
I am Juan-Carlos Segovia, a software engineer working for the European Space Agency.
(You can contact me at: juan.carlos.segovia@sciops.esa.int or juancarlos.segovia@gmail.com)
The ESAC Space Data Centre (ESDC) has developed a module to access the European Space Agency Gaia Archive.
We would like to add this module to astroquery library.
Gaia Archive access is based on a TAP+ REST service.
TAP+ is an extension of Table Access Protocol (TAP: http://www.ivoa.net/documents/TAP/) specified by the International Virtual Observatory Alliance (IVOA: http://www.ivoa.net).
The gaiatap module allows the access to the archive using astroquery API (query_object), and also, provides some TAP+ capabilities.
Please, will you be so kind to review and check gaiatap module?
Thank you very much.
Best regards,
Juan-Carlos Segovia Serrato
ESAC Science Data Centre
Science Archives and Computer Engineering Unit
Operations Department, Directorate of Science
European Space Astronomy Centre (ESAC)
European Space Agency (ESA)
email: juan.carlos.segovia@sciops.esa.int
Phone: (34)-91-8131-175 - 70175 internal
Fax: (34)-91-8131-308
European Space Astronomy Centre (ESAC)
Camino Bajo del Castillo s/n
Urb. Villafranca del Castillo
28692 Villanueva de la Cañada, Madrid, Spain.