Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions astroquery/alma/core.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function
import time
import sys
import os.path
import webbrowser
import getpass
import warnings
import keyring
import numpy as np
import re
Expand All @@ -16,20 +13,19 @@
from bs4 import BeautifulSoup

from astropy.extern.six.moves.urllib_parse import urljoin
from astropy.extern.six import BytesIO,iteritems
from astropy.extern.six import iteritems
from astropy.extern import six
from astropy.table import Table, Column
from astropy import log
from astropy.utils.console import ProgressBar
from astropy import units as u
import astropy.io.votable as votable

from ..exceptions import (LoginError, RemoteServiceError, TableParseError,
from ..exceptions import (RemoteServiceError, TableParseError,
InvalidQueryError)
from ..utils import schema, system_tools
from ..utils import commons
from ..utils import commons, system_tools
from ..utils.process_asyncs import async_to_sync
from ..query import BaseQuery, QueryWithLogin, suspend_cache
from ..query import QueryWithLogin
from . import conf

__doctest_skip__ = ['AlmaClass.*']
Expand Down Expand Up @@ -140,13 +136,13 @@ def query_async(self, payload, cache=True, public=True, science=True):
response.raise_for_status()

return response

def validate_query(self, payload, cache=True):
"""
Use the ALMA query validator service to check whether the keywords are
valid
"""

# Check that the keywords specified are allowed
self._validate_payload(payload)

Expand Down Expand Up @@ -606,7 +602,7 @@ def download_and_extract_files(self, urls, delete=True, regex='.*\.fits$',
"A partially completed download list is "
"in Alma.partial_file_list")
raise ex

fitsfilelist = self.get_files_from_tarballs([tarball_name],
regex=regex, path=path,
verbose=verbose)
Expand Down Expand Up @@ -806,7 +802,7 @@ def _parse_staging_request_page(self, data_list_page):
else 1)
try:
columns['size'].append(float(size)*u.Unit(unit))
except ValueError:
except ValueError:
# size is probably a string?
columns['size'].append(-1*u.byte)
log.log(level=5, msg="Found a new-style entry. "
Expand Down
2 changes: 1 addition & 1 deletion astroquery/atomic/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def _get_default_form_values(self, form):
# ignore the submit and reset buttons
if elem.get('type') in ['submit', 'reset']:
continue
# check boxes: enabled boxes have the value "on" if not specificed
# check boxes: enabled boxes have the value "on" if not specified
# otherwise. Found out by debugging, perhaps not documented.
if elem.get('type') == 'checkbox' and elem.get('checked') in ["", "checked"]:
value = elem.get('value', 'on')
Expand Down
2 changes: 1 addition & 1 deletion astroquery/besancon/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _parse_result(self, response, verbose=False, retrieve_file=True):
raise ValueError("Errors: " + "\n".join(errors))

if verbose:
print("File is %s and can be aquired from %s" % (filename,
print("File is %s and can be acquired from %s" % (filename,
self.url_download
+ '/' + filename))

Expand Down
6 changes: 3 additions & 3 deletions astroquery/cosmosim/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def _generate_response_dict(self,response):
Returns
-------
response_dict : dict
A dictionary of some of the repspnse object's methods
A dictionary of some of the response object's methods
"""

R = response
Expand Down Expand Up @@ -644,14 +644,14 @@ def general_job_info(self,jobid=None,output=False):
def delete_job(self,jobid=None,squash=None):
"""
A public function which deletes a stored job from the server in any phase.
If no jobid is given, it attemps to use the most recent job (if it exists
If no jobid is given, it attempts to use the most recent job (if it exists
in this session). If jobid is specified, then it deletes the corresponding job,
and if it happens to match the existing current job, that variable gets deleted.

Parameters
----------
jobid : string
The jobid of the sql query. If no jobid is given, it attemps to use the most recent job (if it exists in this session).
The jobid of the sql query. If no jobid is given, it attempts to use the most recent job (if it exists in this session).
output : bool
Print output of response(s) to the terminal

Expand Down
3 changes: 2 additions & 1 deletion astroquery/eso/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

__doctest_skip__ = ['EsoClass.*']


def _check_response(content):
"""
Check the response from an ESO service query for various types of error
Expand Down Expand Up @@ -551,7 +552,7 @@ def retrieve_data(self, datasets, cache=True):
fileLink = "http://dataportal.eso.org/dataPortal"+fileId.attrs['value'].split()[1]
filename = self._request("GET", fileLink, save=True)
files.append(system_tools.gunzip(filename))
self._session.redirect_cache.clear() # EMpty the redirect cache of this request session
self._session.redirect_cache.clear() # Empty the redirect cache of this request session
log.info("Done!")
if (not return_list) and (len(files)==1):
files = files[0]
Expand Down
6 changes: 3 additions & 3 deletions astroquery/irsa/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def query_region(self, coordinates=None, catalog=None, spatial='Cone',
may also be used.
polygon : list, [Required for spatial is ``'Polygon'``]
A list of ``(ra, dec)`` pairs (as tuples), in decimal degrees,
outlinining the polygon to search in. It can also be a list of
outlining the polygon to search in. It can also be a list of
`astropy.coordinates` object or strings that can be parsed by
`astropy.coordinates.ICRS`.
get_query_payload : bool, optional
Expand Down Expand Up @@ -202,7 +202,7 @@ def query_region_async(self, coordinates=None, catalog=None,
may also be used.
polygon : list, [Required for spatial is ``'Polygon'``]
A list of ``(ra, dec)`` pairs (as tuples), in decimal degrees,
outlinining the polygon to search in. It can also be a list of
outlining the polygon to search in. It can also be a list of
`astropy.coordinates` object or strings that can be parsed by
`astropy.coordinates.ICRS`.
get_query_payload : bool, optional
Expand Down Expand Up @@ -257,7 +257,7 @@ def _parse_spatial(self, spatial, coordinates, radius=None, width=None,
may also be used.
polygon : list, [Required for spatial is ``'Polygon'``]
A list of ``(ra, dec)`` pairs as tuples of
`astropy.coordinates.Angle`s outlinining the polygon to search in.
`astropy.coordinates.Angle`s outlining the polygon to search in.
It can also be a list of `astropy.coordinates` object or strings
that can be parsed by `astropy.coordinates.ICRS`.

Expand Down
16 changes: 8 additions & 8 deletions astroquery/irsa_dust/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_images(self, coordinate, radius=None,
----------
coordinate : str
Can be either the name of an object or a coordinate string
If a name, must be resolveable by NED, SIMBAD, 2MASS, or SWAS.
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
Expand Down Expand Up @@ -102,7 +102,7 @@ def get_images_async(self, coordinate, radius=None,
----------
coordinate : str
Can be either the name of an object or a coordinate string
If a name, must be resolveable by NED, SIMBAD, 2MASS, or SWAS.
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
Expand Down Expand Up @@ -137,14 +137,14 @@ def get_images_async(self, coordinate, radius=None,
def get_image_list(self, coordinate, radius=None, image_type=None,
timeout=TIMEOUT):
"""
Query function that performes coordinate-based query and returns a list
Query function that performs coordinate-based query and returns a list
of URLs to the Irsa-Dust images.

Parameters
-----------
coordinate : str
Can be either the name of an object or a coordinate string
If a name, must be resolveable by NED, SIMBAD, 2MASS, or SWAS.
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
Expand Down Expand Up @@ -181,7 +181,7 @@ def get_extinction_table(self, coordinate, radius=None, timeout=TIMEOUT):
----------
coordinate : str
Can be either the name of an object or a coordinate string
If a name, must be resolveable by NED, SIMBAD, 2MASS, or SWAS.
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
Expand Down Expand Up @@ -217,7 +217,7 @@ def get_extinction_table_async(self, coordinate, radius=None,
----------
coordinate : str
Can be either the name of an object or a coordinate string
If a name, must be resolveable by NED, SIMBAD, 2MASS, or SWAS.
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str, optional
Expand Down Expand Up @@ -253,7 +253,7 @@ def get_query_table(self, coordinate, radius=None,
----------
coordinate : str
Can be either the name of an object or a coordinate string
If a name, must be resolveable by NED, SIMBAD, 2MASS, or SWAS.
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
Expand Down Expand Up @@ -300,7 +300,7 @@ def _args_to_payload(self, coordinate, radius=None):
----------
coordinate : str
Can be either the name of an object or a coordinate string
If a name, must be resolveable by NED, SIMBAD, 2MASS, or SWAS.
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
Expand Down
4 changes: 1 addition & 3 deletions astroquery/lamda/core.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import json
import numpy as np
from astropy.table import Table
from astropy import table
from astropy import log
from astropy.utils.console import ProgressBar
Expand Down Expand Up @@ -138,7 +136,7 @@ def get_molecules(self, cache=True):
f.write(s)

return molecule_dict

@property
def molecule_dict(self):
if not hasattr(self, '_molecule_dict'):
Expand Down
6 changes: 3 additions & 3 deletions astroquery/lcogt/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def query_object_async(self, objstr, catalog=None, cache=True,
get_query_payload=False):
"""
Serves the same function as `query_object`, but
only collects the reponse from the LCOGT IPAC archive and returns.
only collects the response from the LCOGT IPAC archive and returns.

Parameters
----------
Expand Down Expand Up @@ -170,7 +170,7 @@ def query_region_async(self, coordinates=None, catalog=None,
may also be used.
polygon : list, [Required for spatial is ``'Polygon'``]
A list of ``(ra, dec)`` pairs (as tuples), in decimal degrees,
outlinining the polygon to search in. It can also be a list of
outlining the polygon to search in. It can also be a list of
`astropy.coordinates` object or strings that can be parsed by
`astropy.coordinates.ICRS`.
get_query_payload : bool, optional
Expand Down Expand Up @@ -230,7 +230,7 @@ def _parse_spatial(self, spatial, coordinates, radius=None, width=None,
may also be used.
polygon : list, [Required for spatial is ``'Polygon'``]
A list of ``(ra, dec)`` pairs as tuples of
`astropy.coordinates.Angle`s outlinining the polygon to search in.
`astropy.coordinates.Angle`s outlining the polygon to search in.
It can also be a list of `astropy.coordinates` object or strings
that can be parsed by `astropy.coordinates.ICRS`.

Expand Down
1 change: 0 additions & 1 deletion astroquery/lcogt/tests/test_lcogt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from __future__ import print_function
import os
import re
import requests
import numpy as np

from astropy.tests.helper import pytest
Expand Down
33 changes: 17 additions & 16 deletions astroquery/nasa_ads/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,41 @@

"""

import warnings
from astropy.table import Table

from ..query import BaseQuery
from ..utils import commons, async_to_sync
from ..utils.class_or_instance import class_or_instance

from .utils import _get_data_from_xml
from . import conf
from astropy.table import Table, Column

from ..utils.class_or_instance import class_or_instance
from ..utils import commons, async_to_sync
from .utils import *

from xml.dom import minidom

__all__ = ['ADS', 'ADSClass']


@async_to_sync
class ADSClass(BaseQuery):

SERVER = conf.server
QUERY_ADVANCED_PATH = conf.advanced_path
QUERY_SIMPLE_PATH = conf.simple_path
TIMEOUT = conf.timeout

QUERY_SIMPLE_URL = SERVER + QUERY_SIMPLE_PATH
QUERY_ADVANCED_URL = SERVER + QUERY_ADVANCED_PATH

def __init__(self, *args):
""" set some parameters """
pass

@class_or_instance
def query_simple(self, query_string, get_query_payload=False, get_raw_response=False):
self.query_string = query_string
request_payload = self._args_to_payload(query_string)

response = commons.send_request(self.QUERY_SIMPLE_URL, request_payload, self.TIMEOUT)

# primarily for debug purposes, but also useful if you want to send
Expand All @@ -50,17 +51,17 @@ def query_simple(self, query_string, get_query_payload=False, get_raw_response=F
return response
# parse the XML response into AstroPy Table
resulttable = self._parse_response(response.encode(results.encoding).decode('utf-8'))

return resulttable

def _parse_response(self, response):
xmlrepr = minidom.parseString(response.text)
# Check if there are any results!

# get the list of hits
hitlist = xmlrepr.childNodes[0].childNodes
hitlist = hitlist[1::2] # every second hit is a "line break"

# Grab the various fields
titles = _get_data_from_xml(hitlist, 'title')
bibcode = _get_data_from_xml(hitlist, 'bibcode')
Expand All @@ -84,13 +85,13 @@ def _parse_response(self, response):
t['page'] = page
t['score'] = score
t['citations'] = citations
t['abstract'] = abstract
t['abstract'] = abstract
t['doi'] = doi
t['eprintid'] = eprintid
t['eprintid'] = eprintid
t['authors'] = authors

return t

def _args_to_payload(self, query_string):
# convert arguments to a valid requests payload
# i.e. a dictionary
Expand Down
4 changes: 2 additions & 2 deletions astroquery/ned/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def get_image_list(self, object_name, item='image', get_query_payload=False):

def extract_image_urls(self, html_in):
"""
Helper function that uses reges to extract the image urls from the given HTML.
Helper function that uses regexps to extract the image urls from the given HTML.

Parameters
----------
Expand Down Expand Up @@ -470,7 +470,7 @@ def get_table(self, object_name, table='photometry', get_query_payload=False,
Specifies the type of data-table that must be fetched for the given object. Defaults to
'photometry'.
output_table_format : int, [optional for photometry]
specifies teh format of the output table. Must be 1, 2 or 3.
specifies the format of the output table. Must be 1, 2 or 3.
Defaults to 1. These options stand for:
(1) Data as Published and Homogenized (mJy)
(2) Data as Published
Expand Down
2 changes: 1 addition & 1 deletion astroquery/nrao/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def _args_to_payload(self, **kwargs):
The type of query to perform. "OBSSUMMARY" is the default, but it
is only valid for VLA/VLBA observations. ARCHIVE will not work at all
because it relies on XML data. OBSERVATION will provide full details
of the soruces observed and under what configurations.
of the sources observed and under what configurations.
source_id : str, optional
A source name (to be parsed by SIMBAD or NED)
get_query_payload : bool, optional
Expand Down
Loading