diff --git a/astroquery/alma/core.py b/astroquery/alma/core.py index d4a06474dc..90960c732c 100644 --- a/astroquery/alma/core.py +++ b/astroquery/alma/core.py @@ -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 @@ -16,7 +13,7 @@ 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 @@ -24,12 +21,11 @@ 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.*'] @@ -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) @@ -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) @@ -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. " diff --git a/astroquery/atomic/core.py b/astroquery/atomic/core.py index 16d3e0fd9a..8fa93d74b2 100644 --- a/astroquery/atomic/core.py +++ b/astroquery/atomic/core.py @@ -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') diff --git a/astroquery/besancon/core.py b/astroquery/besancon/core.py index 31279d2ba0..c70c903e08 100644 --- a/astroquery/besancon/core.py +++ b/astroquery/besancon/core.py @@ -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)) diff --git a/astroquery/cosmosim/core.py b/astroquery/cosmosim/core.py index 3c34b135d1..a3c2122b08 100644 --- a/astroquery/cosmosim/core.py +++ b/astroquery/cosmosim/core.py @@ -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 @@ -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 diff --git a/astroquery/eso/core.py b/astroquery/eso/core.py index 7af427c83c..8635650832 100644 --- a/astroquery/eso/core.py +++ b/astroquery/eso/core.py @@ -22,6 +22,7 @@ __doctest_skip__ = ['EsoClass.*'] + def _check_response(content): """ Check the response from an ESO service query for various types of error @@ -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] diff --git a/astroquery/irsa/core.py b/astroquery/irsa/core.py index 1e621281f0..56ca6ac947 100644 --- a/astroquery/irsa/core.py +++ b/astroquery/irsa/core.py @@ -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 @@ -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 @@ -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`. diff --git a/astroquery/irsa_dust/core.py b/astroquery/irsa_dust/core.py index ba27e2ff6e..a2e0b18e06 100644 --- a/astroquery/irsa_dust/core.py +++ b/astroquery/irsa_dust/core.py @@ -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. `_ radius : str / `~astropy.units.Quantity`, optional @@ -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. `_ radius : str / `~astropy.units.Quantity`, optional @@ -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. `_ radius : str / `~astropy.units.Quantity`, optional @@ -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. `_ radius : str / `~astropy.units.Quantity`, optional @@ -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. `_ radius : str, optional @@ -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. `_ radius : str / `~astropy.units.Quantity`, optional @@ -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 `_ radius : str / `~astropy.units.Quantity`, optional diff --git a/astroquery/lamda/core.py b/astroquery/lamda/core.py index 077deb900b..39b111e3eb 100644 --- a/astroquery/lamda/core.py +++ b/astroquery/lamda/core.py @@ -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 @@ -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'): diff --git a/astroquery/lcogt/core.py b/astroquery/lcogt/core.py index f97cc8f35c..adcfbcf3a4 100644 --- a/astroquery/lcogt/core.py +++ b/astroquery/lcogt/core.py @@ -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 ---------- @@ -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 @@ -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`. diff --git a/astroquery/lcogt/tests/test_lcogt.py b/astroquery/lcogt/tests/test_lcogt.py index 50aca01823..d042f37710 100644 --- a/astroquery/lcogt/tests/test_lcogt.py +++ b/astroquery/lcogt/tests/test_lcogt.py @@ -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 diff --git a/astroquery/nasa_ads/core.py b/astroquery/nasa_ads/core.py index b93f155b4d..744f9127f0 100644 --- a/astroquery/nasa_ads/core.py +++ b/astroquery/nasa_ads/core.py @@ -6,20 +6,21 @@ """ -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): @@ -27,19 +28,19 @@ class ADSClass(BaseQuery): 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 @@ -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') @@ -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 diff --git a/astroquery/ned/core.py b/astroquery/ned/core.py index cd2a19eb80..b07733fcd8 100644 --- a/astroquery/ned/core.py +++ b/astroquery/ned/core.py @@ -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 ---------- @@ -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 diff --git a/astroquery/nrao/core.py b/astroquery/nrao/core.py index defcda4c24..213f4117fd 100644 --- a/astroquery/nrao/core.py +++ b/astroquery/nrao/core.py @@ -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 diff --git a/astroquery/nvas/core.py b/astroquery/nvas/core.py index 749474bee9..a8899227de 100644 --- a/astroquery/nvas/core.py +++ b/astroquery/nvas/core.py @@ -58,7 +58,7 @@ def get_images(self, coordinates, radius=0.25 * u.arcmin, max_rms=10000, Gets the UVfits files instead of the IMfits files when set to `True`. Defaults to `False`. verbose : bool, optional - When `True` print out additional messgages. Defaults to `True`. + When `True` print out additional messages. Defaults to `True`. get_query_payload : bool, optional if set to `True` then returns the dictionary sent as the HTTP request. Defaults to `False`. @@ -102,7 +102,7 @@ def get_images_async(self, coordinates, radius=0.25 * u.arcmin, max_rms=10000, Gets the UVfits files instead of the IMfits files when set to `True`. Defaults to `False`. verbose : bool, optional - When `True` print out additional messgages. Defaults to `True`. + When `True` print out additional messages. Defaults to `True`. get_query_payload : bool, optional if set to `True` then returns the dictionary sent as the HTTP request. Defaults to `False`. @@ -172,7 +172,7 @@ def get_image_list(self, coordinates, radius=0.25 * u.arcmin, max_rms=10000, def extract_image_urls(self, html_in, get_uvfits=False): """ - 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 ---------- diff --git a/astroquery/open_exoplanet_catalogue/utils.py b/astroquery/open_exoplanet_catalogue/utils.py index 80e20e0348..dd207735c5 100644 --- a/astroquery/open_exoplanet_catalogue/utils.py +++ b/astroquery/open_exoplanet_catalogue/utils.py @@ -2,7 +2,7 @@ class Number(object): - """ Number class for values containing errors. Math operations use + """ Number class for values containing errors. Math operations use the value given. Checking for no 'value' must use "==". Numbers with upper or lower limits as assumed to have no value. @@ -23,7 +23,7 @@ class Number(object): 0.5 >>> num = Number(None, upperlimit=10) - >>> str(num) + >>> str(num) '<10.0' >>> num == None @@ -105,7 +105,7 @@ def __str__(self): def machine_readable(self, separator="\t", missingval="None"): """ - Creates a string intedned for a machine to read (ex, gnuplot) + Creates a string intended for a machine to read (ex, gnuplot) prints as follows value(separator)errorplus(separator)errorminus(separator)upperlimit(separator)lowerlimit @@ -125,23 +125,23 @@ def machine_readable(self, separator="\t", missingval="None"): temp = "" if hasattr(self, "value") and self.value is not None: - temp += str(self.value) + separator + temp += str(self.value) + separator else: temp += missingval + separator if hasattr(self, "errorplus") and self.errorplus is not None: - temp += str(self.errorplus) + separator + temp += str(self.errorplus) + separator else: temp += missingval + separator if hasattr(self, "errorminus") and self.errorminus is not None: - temp += str(self.errorminus) + separator + temp += str(self.errorminus) + separator else: temp += missingval + separator if hasattr(self, "upperlimit") and self.upperlimit is not None: - temp += str(self.upperlimit) + separator + temp += str(self.upperlimit) + separator else: temp += missingval + separator if hasattr(self, "lowerlimit") and self.lowerlimit is not None: - temp += str(self.lowerlimit) + separator + temp += str(self.lowerlimit) + separator else: temp += missingval + separator return temp.strip(separator) diff --git a/astroquery/query.py b/astroquery/query.py index 37c56e395b..d2f0652a67 100644 --- a/astroquery/query.py +++ b/astroquery/query.py @@ -5,14 +5,12 @@ import pickle import hashlib import os -import warnings import requests -import itertools from astropy.extern import six from astropy.config import paths from astropy import log -from astropy.utils.console import ProgressBar,ProgressBarOrSpinner +from astropy.utils.console import ProgressBarOrSpinner import astropy.utils.data from . import version diff --git a/astroquery/sdss/core.py b/astroquery/sdss/core.py index 1a0fcc5c1a..50b3deb4fe 100644 --- a/astroquery/sdss/core.py +++ b/astroquery/sdss/core.py @@ -525,7 +525,7 @@ def get_spectra_async(self, coordinates=None, radius=2. * u.arcsec, for row in matches: link = ('{base}/{instrument}/spectro/redux/{run2d}/spectra' '/{plate:04d}/spec-{plate:04d}-{mjd}-{fiber:04d}.fits') - # _parse_result returns bytes for instrunments, requiring a decode + # _parse_result returns bytes for instruments, requiring a decode link = link.format(base=SDSS.SPECTRO_OPTICAL, instrument=row['instrument'].decode().lower(), run2d=row['run2d'], plate=row['plate'], diff --git a/astroquery/sha/core.py b/astroquery/sha/core.py index ffc174e147..3b7f55ad35 100644 --- a/astroquery/sha/core.py +++ b/astroquery/sha/core.py @@ -128,8 +128,8 @@ def query(coord=None, ra=None, dec=None, size=None, naifid=None, pid=None, return response response.raise_for_status() # Parse output - # requests returns unicde strings, encode back to ascii - # because of '|foo|bar|' delimeters, remove first and last empty columns + # requests returns unicode strings, encode back to ascii + # because of '|foo|bar|' delimiters, remove first and last empty columns raw_data = [line for line in response.text.split('\n')] field_widths = [len(s) + 1 for s in raw_data[0].split('|')][1:-1] col_names = [s.strip() for s in raw_data[0].split('|')][1:-1] @@ -159,7 +159,7 @@ def save_file(url, out_dir='sha_tmp/', out_name=None): SHA query include columns:: accessUrl -> The URL to be used to retrieve an image or table - withAnc1 -> The URL to be used to retrive the image or spectra + withAnc1 -> The URL to be used to retrieve the image or spectra with important ancillary products (mask, uncertainty, etc.) as a zip archive @@ -208,7 +208,7 @@ def get_file(url): SHA query include columns:: accessUrl -> The URL to be used to retrieve an image or table - withAnc1 -> The URL to be used to retrive the image or spectra + withAnc1 -> The URL to be used to retrieve the image or spectra with important ancillary products (mask, uncertainty, etc.) as a zip archive diff --git a/astroquery/simbad/core.py b/astroquery/simbad/core.py index 7649ab6f69..07d562ecc4 100644 --- a/astroquery/simbad/core.py +++ b/astroquery/simbad/core.py @@ -352,7 +352,7 @@ def query_object(self, object_name, wildcard=False, verbose=False): def query_object_async(self, object_name, wildcard=False): """ Serves the same function as `query_object`, but - only collects the reponse from the Simbad server and returns. + only collects the response from the Simbad server and returns. Parameters ---------- @@ -397,7 +397,7 @@ def query_objects(self, object_names, wildcard=False, verbose=False): def query_objects_async(self, object_names, wildcard=False): """ Same as `query_objects`, but - only collects the reponse from the Simbad server and returns. + only collects the response from the Simbad server and returns. Parameters ---------- @@ -430,7 +430,7 @@ def query_region(self, coordinates, radius=None, the equinox of the coordinates. If missing set to default 2000.0. epoch : str, optional - the epoch of the input coordiantes. Must be specified as + the epoch of the input coordinates. Must be specified as [J|B] . If missing, set to default J2000. Returns @@ -448,7 +448,7 @@ def query_region_async(self, coordinates, radius=None, equinox=None, epoch=None): """ Serves the same function as `query_region`, but - only collects the reponse from the Simbad server and returns. + only collects the response from the Simbad server and returns. Parameters ---------- @@ -461,7 +461,7 @@ def query_region_async(self, coordinates, radius=None, equinox=None, the equinox of the coordinates. If missing set to default 2000.0. epoch : str, optional - the epoch of the input coordiantes. Must be specified as + the epoch of the input coordinates. Must be specified as [J|B] . If missing, set to default J2000. Returns @@ -499,7 +499,7 @@ def query_catalog(self, catalog, verbose=False): def query_catalog_async(self, catalog): """ Serves the same function as `query_catalog`, but - only collects the reponse from the Simbad server and returns. + only collects the response from the Simbad server and returns. Parameters ---------- @@ -539,7 +539,7 @@ def query_bibobj(self, bibcode, verbose=False): def query_bibobj_async(self, bibcode): """ Serves the same function as `query_bibobj`, but - only collects the reponse from the Simbad server and returns. + only collects the response from the Simbad server and returns. Parameters ---------- @@ -584,7 +584,7 @@ def query_bibcode(self, bibcode, wildcard=False, verbose=False): def query_bibcode_async(self, bibcode, wildcard=False): """ Serves the same function as `query_bibcode`, but - only collects the reponse from the Simbad server and returns. + only collects the response from the Simbad server and returns. Parameters ---------- @@ -628,7 +628,7 @@ def query_objectids(self, object_name, verbose=False): def query_objectids_async(self, object_name): """ Serves the same function as `query_objectids`, but - only collects the reponse from the Simbad server and returns. + only collects the response from the Simbad server and returns. Parameters ---------- @@ -724,7 +724,7 @@ def _parse_result(self, result, resultclass, verbose=False): response with the .table property/method, then return the resulting table. If data is not retrieved or the resulting table is empty, return None. In case of problems, save - intermediate results for furthur debugging. + intermediate results for further debugging. """ self.last_response = result try: diff --git a/astroquery/skyview/core.py b/astroquery/skyview/core.py index bb0e31add7..f73fa3e275 100644 --- a/astroquery/skyview/core.py +++ b/astroquery/skyview/core.py @@ -34,7 +34,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') @@ -50,7 +50,7 @@ def _get_default_form_values(self, form): if option.get('selected') == '': value = option.get('value', option.text.strip()) res.append((elem.get('name'), value)) - return {k:v + return {k:v for (k, v) in res if v not in [None, u'None', u'null'] and v } @@ -167,7 +167,7 @@ def get_images(self, position, survey, coordinates=None, projection=None, grid : bool overlay a coordinate grid on the image if True gridlabels : bool - annotate the grid with coordinates postions if True + annotate the grid with coordinates positions if True radius : `~astropy.units.Quantity` or None The radius of the specified field. Overrides width and height. width : `~astropy.units.Quantity` or None @@ -287,7 +287,7 @@ def survey_dict(self): response = self._request('GET', self.URL) page = BeautifulSoup(response.content, "html.parser") surveys = page.findAll('select', {'name':'survey'}) - + self._survey_dict = {sel['id']:[x.text for x in sel.findAll('option')] for sel in surveys} return self._survey_dict diff --git a/astroquery/splatalogue/utils.py b/astroquery/splatalogue/utils.py index 45ef76f012..7122b0fdbd 100644 --- a/astroquery/splatalogue/utils.py +++ b/astroquery/splatalogue/utils.py @@ -46,7 +46,7 @@ def merge_frequencies(table, prefer='measured', theor_kwd='Freq-GHz', table : table The Splatalogue table prefer: 'measured' or 'theoretical' - Which of the two colums to prefer if there is a conflict + Which of the two columns to prefer if there is a conflict """ if prefer == 'measured': diff --git a/astroquery/ukidss/core.py b/astroquery/ukidss/core.py index 76e2a9e0db..30feef91a3 100644 --- a/astroquery/ukidss/core.py +++ b/astroquery/ukidss/core.py @@ -102,7 +102,7 @@ def _login(self, username, password, community): community : str """ - # Construct cookie holder, URL openenr, and retrieve login page + # Construct cookie holder, URL opener, and retrieve login page self.session = requests.session() credentials = {'user': username, 'passwd': password, @@ -386,7 +386,7 @@ def get_image_list(self, coordinates, waveband='all', frame_type='stack', def extract_urls(self, html_in): """ - Helper function that uses reges to extract the image urls from the + Helper function that uses regexps to extract the image urls from the given HTML. Parameters @@ -525,7 +525,7 @@ def _parse_result(self, response, verbose=False): response : `requests.Response` The HTTP response object verbose : bool, optional - Defaults to `False`. If `True it displaya warnings whenever the + Defaults to `False`. If `True` it displays warnings whenever the VOtable returned from the service doesn't conform to the standard. Returns @@ -597,7 +597,7 @@ def _get_databases(self): def list_databases(self): """ - List the databases available from the UKIDSS WFCAM archive + List the databases available from the UKIDSS WFCAM archive. """ self.databases = set(self.all_databases + self._get_databases()) return self.databases @@ -690,7 +690,7 @@ def clean_catalog(ukidss_catalog, clean_band='K_1', badclass=-9999, def verify_programme_id(pid, query_type='catalog'): """ - Verify the programme ID is valid for the query being executed + Verify the programme ID is valid for the query being executed. Parameters ---------- diff --git a/astroquery/utils/system_tools.py b/astroquery/utils/system_tools.py index 328d1d3a46..c97a6f94d0 100644 --- a/astroquery/utils/system_tools.py +++ b/astroquery/utils/system_tools.py @@ -33,7 +33,7 @@ def gunzip(filename): Returns ------- filename : str - Name of the decompressed file (or input filname if gzip is not available). + Name of the decompressed file (or input filename if gzip is not available). """ if __is_gzip_found and not filename.endswith('.fz'): # ".fz" denotes RICE rather than gzip compression subprocess.call(["gzip", "-d", "{0}".format(filename)], stdout=DEVNULL, stderr=DEVNULL) @@ -44,7 +44,7 @@ def gunzip(filename): # If astropy#2793 is merged, this should be replaced with astropy.in_ipynb def in_ipynb(): try: - cfg = get_ipython().config + cfg = get_ipython().config app = cfg['IPKernelApp'] # ipython 1.0 console has no 'parent_appname', # but ipynb does diff --git a/astroquery/vizier/core.py b/astroquery/vizier/core.py index 6732c7c36e..fa5a4ea1ed 100644 --- a/astroquery/vizier/core.py +++ b/astroquery/vizier/core.py @@ -610,7 +610,7 @@ def _parse_result(self, response, get_catalog_names=False, verbose=False, (only for VOTABLE queries) The behavior if a VOTABLE cannot be parsed. Default is 'warn', which will try to parse the table, then if an exception is raised, - it will be printent but the masked table will be returned + it will be printed but the masked table will be returned. Returns ------- @@ -656,7 +656,7 @@ def parse_vizier_tsvfile(data, verbose=False): data : ascii str An ascii string containing the vizier-formatted list of tables """ - + # http://stackoverflow.com/questions/4664850/find-all-occurrences-of-a-substring-in-python split_indices = [m.start() for m in re.finditer('\n\n#', data)] # we want to slice out chunks of the file each time @@ -712,7 +712,7 @@ def parse_vizier_votable(data, verbose=False, invalid='warn', def _parse_angle(angle): """ - Retuns the Vizier-formatted units and values for box/radius + Returns the Vizier-formatted units and values for box/radius dimensions in case of region queries. Parameters diff --git a/docs/index.rst b/docs/index.rst index 4554acadbc..7e19908cef 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -41,7 +41,7 @@ or cloned and installed from source: $ # If you have a github account: $ git clone git@github.com:astropy/astroquery.git - $ # If you do not: + $ # If you do not: $ git clone https://github.com/astropy/astroquery.git $ cd astroquery $ python setup.py install @@ -57,7 +57,7 @@ The following packages are required for astroquery installation & use: * `astropy `__ (>=0.4) * `requests `_ * `keyring `_ (required for the - `~astroquery.eso` and `~astroquery.alma` modules) + `~astroquery.eso` and `~astroquery.alma` and `~astroquery.cosmosim` modules) * `Beautiful Soup `_ Using astroquery @@ -219,7 +219,7 @@ Other There are other astronomically significant services, e.g. line list and atomic/molecular cross section and collision rate services, that don't fit the -above categories. +above categories. .. toctree:: :maxdepth: 1 diff --git a/docs/irsa/irsa.rst b/docs/irsa/irsa.rst index 9ffcd029f8..9ccd403eb4 100644 --- a/docs/irsa/irsa.rst +++ b/docs/irsa/irsa.rst @@ -40,7 +40,7 @@ a look at all the available catalogs: ... 'xmm_cat_s05': "SWIRE XMM_LSS Region Spring '05 Spitzer Catalog"} -This returns a dictinary of catalog names with their description. If you would +This returns a dictionary of catalog names with their description. If you would rather just print out this information: .. code-block:: python @@ -151,7 +151,7 @@ these queries is ``polygon``. This is a list of coordinate pairs that define a convex polygon. The coordinates may be specified as usual by using the appropriate `astropy.coordinates` object (Again ICRS coordinates may be directly passed as properly formatted strings). In addition to using a list of -`astropy.coordinates` objects, one additional convenient means of specifiying +`astropy.coordinates` objects, one additional convenient means of specifying the coordinates is also available - Coordinates may also be entered as a list of tuples, each tuple containing the ra and dec values in degrees. Each of these options is illustrated below: diff --git a/docs/irsa/irsa_dust.rst b/docs/irsa/irsa_dust.rst index 3bc0f0f26e..5313b59977 100644 --- a/docs/irsa/irsa_dust.rst +++ b/docs/irsa/irsa_dust.rst @@ -14,8 +14,8 @@ This module can be used to query the `IRSA Dust Extinction Service`_. Fetch images ------------ -Retrieve the image cut-outs for the specified oject name or coordinates. The -images fetched in the FITS format and the result is returned as a list of +Retrieve the image cut-outs for the specified object name or coordinates. The +images fetched in the FITS format and the result is returned as a list of `~astropy.io.fits.HDUList` objects. For all image queries, the radius may be optionally specified. If missing the radius defaults to 5 degrees. Note that radius may be specified in any appropriate unit, however it must fall in the range of 2 to @@ -25,7 +25,7 @@ specified in any appropriate unit, however it must fall in the range of 2 to >>> from astroquery.irsa_dust import IrsaDust >>> image_list = IrsaDust.get_images("m81") - + Downloading http://irsa.ipac.caltech.edu//workspace/TMP_pdTImE_1525/DUST/m81.v0001/p414Dust.fits |===========================================| 331k/331k (100.00%) 15s Downloading http://irsa.ipac.caltech.edu//workspace/TMP_pdTImE_1525/DUST/m81.v0001/p414i100.fits @@ -58,7 +58,7 @@ images: >>> image - + [[]] The image types that are available can also be listed out any time: @@ -71,7 +71,7 @@ The image types that are available can also be listed out any time: ['ebv', 'temperature', '100um'] The target may also be specified via coordinates passed as strings. Examples of acceptable coordinate -strings can be found on this `IRSA DUST coordinates description page`_. +strings can be found on this `IRSA DUST coordinates description page`_. .. code-block:: python @@ -86,7 +86,7 @@ strings can be found on this `IRSA DUST coordinates description page`_. |==============================| 57k/ 57k (100.00%) 00s Downloading http://irsa.ipac.caltech.edu//workspace/TMP_46IWzq_9460/DUST/17h44m34s_-27d59m13s.v0001/p118temp.fits |==============================| 57k/ 57k (100.00%) 00s - + A list having the download links for the FITS image may also be fetched, rather than the actual images, via the :meth:`~astroquery.irsa_dust.IrsaDustClass.get_image_list` method. This also @@ -111,7 +111,7 @@ Fetching the extinction table This fetches the extinction table as a `~astropy.table.Table`. The input parameters are the same as in the queries discussed above, namely the target string and optionally a radius -value: +value: .. code-block:: python @@ -121,7 +121,7 @@ value: >>> # "22h57m57.5s +26d09m00.09s Equatorial B1950" >>> C = coord.SkyCoord("22h57m57.5s +26d09m00.09s", frame='fk4') >>> table = IrsaDust.get_extinction_table(C) - + Downloading http://irsa.ipac.caltech.edu//workspace/TMP_UkhZqQ_9824/DUST/22h57m57.5s_+26d09m00.09s_Equatorial_B1950.v0001/extinction.tbl |===========================================| 1.3k/1.3k (100.00%) 00s @@ -175,7 +175,7 @@ with all the four sections will be returned. ---------------- ... ------- E(B-V) Reddening ... 0.1099 - + Reference/API ============= diff --git a/docs/release_notice_v0.2.rst b/docs/release_notice_v0.2.rst index 4c4a4ad986..39ad749327 100644 --- a/docs/release_notice_v0.2.rst +++ b/docs/release_notice_v0.2.rst @@ -46,8 +46,8 @@ Liedtke was our student this summer. He changed astroquery from using lxml to BeautifulSoup, especially in the ESO package. He also added support for the services xMatch, SkyView and Atomic Line List. Documentation has been added for the packages xmatch and atomic (though note that extensive documentation -exists in form of docstrings for all packages he added, inlcuding SkyView). All +exists in form of docstrings for all packages he added, including SkyView). All new services have tests that can be run both off- and online. --- +-- Adam Ginsburg, Christoph Deil, and Thomas Robitaille diff --git a/docs/simbad/simbad.rst b/docs/simbad/simbad.rst index 3d9ad45c13..a5b6a9c8e8 100644 --- a/docs/simbad/simbad.rst +++ b/docs/simbad/simbad.rst @@ -19,7 +19,7 @@ Query an Identifier This is useful if you want to query a known identifier. For instance to query -the messier object m1: +the messier object m1: .. code-block:: python @@ -27,7 +27,7 @@ the messier object m1: >>> result_table = Simbad.query_object("m1") >>> print(result_table) - MAIN_ID RA DEC RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH COO_BIBCODE + MAIN_ID RA DEC RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH COO_BIBCODE ------- ----------- ----------- ------- -------- ------------ ------------ ------------- -------- -------------- ------------------- M 1 05 34 31.94 +22 00 52.2 6 6 nan nan 0 C R 2011A&A...533A..10L @@ -40,7 +40,7 @@ through 9: >>> result_table = Simbad.query_object("m [1-9]", wildcard=True) >>> print(result_table) - MAIN_ID RA DEC RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH COO_BIBCODE + MAIN_ID RA DEC RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH COO_BIBCODE ------- ----------- ----------- ------- -------- ------------ ------------ ------------- -------- -------------- ------------------- M 1 05 34 31.94 +22 00 52.2 6 6 nan nan 0 C R 2011A&A...533A..10L M 2 21 33 27.02 -00 49 23.7 6 6 100.000 100.000 0 C O 2010AJ....140.1830G @@ -49,7 +49,7 @@ through 9: M 5 15 18 33.22 +02 04 51.7 6 6 nan nan 0 C O 2010AJ....140.1830G M 6 17 40 20 -32 15.2 4 4 nan nan 0 E O 2009MNRAS.399.2146W M 7 17 53 51 -34 47.6 4 4 nan nan 0 E O 2009MNRAS.399.2146W - M 8 18 03 37 -24 23.2 4 4 18000.000 18000.000 179 E + M 8 18 03 37 -24 23.2 4 4 18000.000 18000.000 179 E M 9 17 19 11.78 -18 30 58.5 6 6 nan nan 0 D 2002MNRAS.332..441F Wildcards are supported by other queries as well - where this is the case, @@ -61,7 +61,7 @@ their functions: >>> from astroquery.simbad import Simbad >>> Simbad.list_wildcards() - + * : Any string of characters (including an empty one) [^0-9] : Any (one) character not in the list. @@ -85,7 +85,7 @@ available in Astropy. >>> result_table = Simbad.query_region("m81") >>> print(result_table) - MAIN_ID RA DEC RA_PREC DEC_PREC ... COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH COO_BIBCODE + MAIN_ID RA DEC RA_PREC DEC_PREC ... COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH COO_BIBCODE -------------------------- ------------- ------------- ------- -------- ... ------------- -------- -------------- ------------------- [VV2006c] J095534.0+043546 09 55 33.9854 +04 35 46.438 8 8 ... 0 B O 2009A&A...505..385A ... @@ -100,7 +100,7 @@ the `~astropy.units.Quantity` object: >>> from astroquery.simbad import Simbad >>> import astropy.units as u >>> result_table = Simbad.query_region("m81", radius=0.1 * u.deg) - >>> # another way to specify the radius. + >>> # another way to specify the radius. >>> result_table = Simbad.query_region("m81", radius='0d6m0s') >>> print(result_table) @@ -123,7 +123,7 @@ the `~astropy.units.Quantity` object: [BBC91] S02S 09 56 07.1 ... PSK 489 09 56 36.55 ... 2003AJ....126.1286L PSK 7 09 54 37.0 ... - + @@ -132,7 +132,7 @@ object. Limited support for entering the coordinates directly as a string also exists - only for ICRS coordinates (though these may just as well be specified by the `~astropy.coordinates.ICRS` object) -.. code-block:: python +.. code-block:: python >>> from astroquery.simbad import Simbad >>> import astropy.coordinates as coord @@ -159,9 +159,9 @@ by the `~astropy.coordinates.ICRS` object) TYC 9390-157-1 05 35 55.233 ... 2000A&A...355L..27H PKS J0557-8122 05 57 26.80 ... 2003MNRAS.342.1117M PKS 0602-813 05 57 30.7 ... - -For other coordinate systems, use the appropriate `astropy.coordinates` object: + +For other coordinate systems, use the appropriate `astropy.coordinates` object: .. code-block:: python @@ -173,7 +173,7 @@ For other coordinate systems, use the appropriate `astropy.coordinates` object: ... radius='0d0m2s') >>> print(result_table) - MAIN_ID RA ... COO_WAVELENGTH COO_BIBCODE + MAIN_ID RA ... COO_WAVELENGTH COO_BIBCODE ------------------- ------------- ... -------------- ------------------- NAME Barnard's star 17 57 48.4980 ... O 2007A&A...474..653V @@ -215,10 +215,10 @@ to 2000.0. So here is a query with all the options utilized: TYC 608-432-1 00 51 05.289 ... 2000A&A...355L..27H TYC 607-418-1 00 49 09.636 ... 2000A&A...355L..27H - + Query a catalogue ----------------- - + Queries can also be formulated to return all the objects from a catalogue. For instance to query the ESO catalog: @@ -230,7 +230,7 @@ instance to query the ESO catalog: >>> result_table = limitedSimbad.query_catalog('eso') >>> print(result_table) - MAIN_ID RA ... COO_WAVELENGTH COO_BIBCODE + MAIN_ID RA ... COO_WAVELENGTH COO_BIBCODE ----------------------- ------------ ... -------------- ------------------- 2MASS J08300740-4325465 08 30 07.41 ... I 2003yCat.2246....0C NGC 2573 01 41 35.091 ... I 2006AJ....131.1163S @@ -252,7 +252,7 @@ This retrieves the reference corresponding to a bibcode. >>> result_table = Simbad.query_bibcode('2005A&A.430.165F') >>> print(result_table) - References + References ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2005A&A...430..165F -- ? Astron. Astrophys., 430, 165-186 (2005) @@ -270,7 +270,7 @@ from a given journal in a given year: >>> result_table = Simbad.query_bibcode('2013A&A*', wildcard=True) >>> print(result_table) - References + References ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2013A&A...549A...1G -- ? Astron. Astrophys., 549A, 1-1 (2013) @@ -320,7 +320,7 @@ associated with an object. >>> from astroquery.simbad import Simbad >>> result_table = Simbad.query_objectids("Polaris") >>> print(result_table) - ID + ID -------------------- ADS 1477 AP ** STF 93A @@ -379,7 +379,7 @@ article specified by the bibcode: >>> result_table = Simbad.query_bibobj('2005A&A.430.165F') >>> print(result_table) - MAIN_ID RA DEC RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH COO_BIBCODE + MAIN_ID RA DEC RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH COO_BIBCODE --------- ------------ ------------ ------- -------- ------------ ------------ ------------- -------- -------------- ------------------- NGC 524 01 24 47.707 +09 32 19.65 7 7 nan nan 0 B I 2006AJ....131.1163S NGC 3593 11 14 37.002 +12 49 04.87 7 7 nan nan 0 B I 2006AJ....131.1163S @@ -388,7 +388,7 @@ article specified by the bibcode: NGC 5179 13 29 30.875 +11 44 44.54 7 7 nan nan 0 B I 2006AJ....131.1163S NGC 5713 14 40 11.528 -00 17 21.16 7 7 nan nan 0 B I 2006AJ....131.1163S -Query based on any criteria +Query based on any criteria ---------------------------- @@ -420,20 +420,20 @@ See that link for details of how these queries are formed. SNR G000.3+00.0 17 46 14.9 -28 37 15 5 5 3000.000 3000.000 1 D SNR G001.0-00.1 17 48.5 -28 09 3 3 nan nan 0 E R 2009BASI...37...45G NAME SGR A EAST 17 45 47 -29 00.2 4 4 18000.000 18000.000 1 E - + Customizing the default settings ================================ There may be times when you wish to change the defaults that have been set for -the Simbad queries. +the Simbad queries. Changing the row limit ---------------------- To fetch all the rows in the result, the row limit must be set to 0. However for some -queries, results are likely to be very large, in such cases it may be best to +queries, results are likely to be very large, in such cases it may be best to limit the rows to a smaller number. If you want to do this only for the current python session then: @@ -449,14 +449,14 @@ Changing the timeout -------------------- -The timeout is the time limit in seconds for estabishing connection with the +The timeout is the time limit in seconds for establishing connection with the Simbad server and by default it is set to 100 seconds. You may want to modify this - again you can do this at run-time if you want to adjust it only for the current session. To make it persistent, you must modify the setting in the Astroquery configuration file. .. code-block:: python - + >>> from astroquery.simbad import Simbad >>> Simbad.TIMEOUT = 60 # sets the timeout to 60s @@ -473,14 +473,14 @@ also want to be fetched in the result. To see the list of the fields: >>> from astroquery.simbad import Simbad >>> Simbad.list_votable_fields() - col0 col1 col2 + col0 col1 col2 ----------------- ------------ -------------- dim main_id propermotions dim_angle measurements ra(opt) dim_bibcode mesplx ra_prec dim_incl mespm rot dim_majaxis mk rv_value - + The above shows just a small snippet of the table that is returned and has all the fields sorted lexicographically column-wise. For more information on a @@ -496,7 +496,7 @@ particular field: To set additional fields to be returned in the VOTable: .. code-block:: python - + >>> from astroquery.simbad import Simbad >>> customSimbad = Simbad() @@ -506,7 +506,7 @@ To set additional fields to be returned in the VOTable: ['main_id', 'coordinates'] - # To set other fields + # To set other fields >>> customSimbad.add_votable_fields('mk', 'rot', 'bibcodelist(1800-2014)') >>> customSimbad.get_votable_fields() @@ -520,17 +520,17 @@ Continuing from the above example: >>> customSimbad.remove_votable_fields('mk', 'coordinates') >>> customSimbad.get_votable_fields() - + ['rot', 'main_id'] - + # reset back to defaults - + >>> customSimbad.reset_votable_fields() >>> customSimbad.get_votable_fields() ['main_id', 'coordinates'] - + Reference/API ============= diff --git a/docs/testing.rst b/docs/testing.rst index a1de1c543c..4a30f0b7ee 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -23,7 +23,7 @@ The testing directory structure should look like:: ------------------ This file should contain only tests that do not require an internet connection. -It also containts the tricky monkeypatching components. At a minimum, monkeypatching +It also contains the tricky monkeypatching components. At a minimum, monkeypatching requires a few methods that are defined locally in the test file for each module. Monkeypatching @@ -58,7 +58,7 @@ This function, when called, changes the `requests.get` method (i.e., the ``get`` method of the ``requests`` module) to call the ``get_mockreturn`` function, defined below. ``@pytest.fixture`` means that, if any function in this ``test_module.py`` file accepts ``patch_get`` as an argument, ``patch_get`` will be called prior to -running that function. +running that function. ``get_mockreturn`` is simple but important: this is where you define a function to return the appropriate data stored in the ``data/`` directory as a readable @@ -73,7 +73,7 @@ object within the ``MockResponse`` class: ``data_path`` is a simple function that looks for the ``data`` directory local to the ``test_module.py`` file. - + .. code-block:: python def data_path(filename): diff --git a/docs/ukidss/ukidss.rst b/docs/ukidss/ukidss.rst index 1c2ccfa39d..5d478a7ffc 100644 --- a/docs/ukidss/ukidss.rst +++ b/docs/ukidss/ukidss.rst @@ -22,7 +22,7 @@ data. .. code-block:: python >>> from astroquery.ukidss import Ukidss - + # perform any query as a class method - no instantiation required >>> images = Ukidss.get_images("m1") @@ -37,7 +37,7 @@ data. .. code-block:: python >>> from astroquery.ukidss import Ukidss - + # Now first instantiate a Ukidss object with login credentials >>> u_obj = Ukidss(username='xyz', password='secret', # doctest: +SKIP @@ -59,7 +59,7 @@ permitted only for image queries. >>> u_obj = Ukidss(username='xyz', password='secret', # doctest: +SKIP ... community='your_community', database='UKIDSSDR8PLUS', # doctest: +SKIP ... programme_id='GPS') # doctest: +SKIP - >>> + >>> At any given time you may if you wish check your login status (continuing from the above example): @@ -67,7 +67,7 @@ the above example): .. code-block:: python >>> u_obj.logged_in() # doctest: +SKIP - + True If you want to change your programme_id and database after you have already instantiated the @@ -105,7 +105,7 @@ Get images around a target You can fetch images around the specified target or coordinates. When a target name is used rather than the coordinates, this will be resolved to coordinates -using astropy name resolving methods that utilze online services like +using astropy name resolving methods that utilize online services like SESAME. Coordinates may be entered using the suitable object from `astropy.coordinates`. The images are returned as a list of `~astropy.io.fits.HDUList` objects. @@ -121,7 +121,7 @@ SESAME. Coordinates may be entered using the suitable object from |===========================================| 174k/174k (100.00%) 07s >>> print(images) - + [[, ]] Note if you have logged in using the procedure described earlier and assuming @@ -144,7 +144,7 @@ with appropriate units or as a string that is parsable by images will be retrieved. Note that in this case the image height and width parameters will no longer be effective. -.. code-block:: python +.. code-block:: python >>> from astroquery.ukidss import Ukidss >>> import astropy.units as u @@ -183,7 +183,7 @@ is set by default to 'UKIDSSDR7PLUS'. Some more parameters you can set are the and the ``waveband`` that decides the color filter to download. This must be chosen from :: - 'all' 'J' 'H' 'K' 'H2' 'Z' 'Y' 'Br' + 'all' 'J' 'H' 'K' 'H2' 'Z' 'Y' 'Br' Note that rather than fetching the actual images, you could also get the URLs of the downloadable images. To do this simply replace the call to @@ -196,7 +196,7 @@ parameters. Let us now see a complete example to illustrate these points. >>> from astroquery.ukidss import Ukidss >>> import astropy.units as u - >>> import astropy.coordinates as coord + >>> import astropy.coordinates as coord >>> image_urls = Ukidss.get_image_list(coord.SkyCoord(ra=83.633083, ... dec=22.0145, unit=(u.deg, u.deg), frame='icrs'), ... frame_type='interleave', @@ -231,13 +231,13 @@ results are returned in a `~astropy.table.Table`. ... unit=(u.deg, u.deg), ... frame='galactic'), ... radius=6 * u.arcsec) - + Downloading http://surveys.roe.ac.uk/wsa/tmp/tmp_sql/results1_4_45_58_24651.xml |===========================================| 4.6k/4.6k (100.00%) 00s >>> print(table) - sourceID framesetID RA ... H2AperMag3Err distance + sourceID framesetID RA ... H2AperMag3Err distance ------------ ------------ ------------- ... ------------- --------------- 438758381345 438086690175 272.615581037 ... -9.99999e+08 0.0864656469768 438758381157 438086690175 272.6178395 ... -9.99999e+08 0.0717893063941 @@ -248,7 +248,7 @@ results are returned in a `~astropy.table.Table`. 438758399832 438086690175 272.617034836 ... -9.99999e+08 0.0665854385804 438758414982 438086690175 272.616576986 ... -9.99999e+08 0.0214102038115 - + Reference/API =============