How to use the astroquery.utils.commons.FileContainer function in astroquery

To help you get started, we’ve selected a few astroquery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github astropy / astroquery / astroquery / alfalfa / core.py View on Github external
Returns
        -------
        result : A file context manager

        See Also
        --------
        get_catalog : method that downloads ALFALFA catalog
        query_region : find object in catalog closest to supplied
            position (use this to determine AGC number first)

        """

        agc = str(agc).zfill(6)

        link = "%s/A%s.fits" % (self.FITS_PREFIX, agc)
        result = commons.FileContainer(link, show_progress=show_progress)
        return result
github astropy / astroquery / astroquery / irsa_dust / core.py View on Github external
`~astropy.coordinates.Angle`. Defaults to 5 degrees.
        timeout : int, optional
            Time limit for establishing successful connection with remote
            server. Defaults to `~astroquery.irsa_dust.IrsaDustClass.TIMEOUT`.

        Returns
        -------
        result : A context manager that yields a file like readable object.
        """
        url = self.DUST_SERVICE_URL
        request_payload = self._args_to_payload(coordinate, radius=radius)
        response = self._request("POST", url, data=request_payload,
                                 timeout=timeout)
        xml_tree = utils.xml(response.text)
        result = SingleDustResult(xml_tree, coordinate)
        return commons.FileContainer(result.ext_detail_table(),
                                     show_progress=show_progress)
github astropy / astroquery / astroquery / skyview / core.py View on Github external
projection=None, pixels=None, scaling=None,
                         sampler=None, resolver=None, deedger=None, lut=None,
                         grid=None, gridlabels=None, radius=None, height=None,
                         width=None, cache=True, show_progress=True):
        """
        Returns
        -------
        A list of context-managers that yield readable file-like objects
        """
        image_urls = self.get_image_list(position, survey, coordinates,
                                         projection, pixels, scaling, sampler,
                                         resolver, deedger, lut, grid,
                                         gridlabels, radius=radius,
                                         height=height, width=width,
                                         cache=cache)
        return [commons.FileContainer(url, encoding='binary',
                                      show_progress=show_progress)
                for url in image_urls]
github astropy / astroquery / astroquery / gama / core.py View on Github external
def get_gama_datafile(result, **kwargs):
    """Turn a URL into an HDUList object."""
    fitsfile = commons.FileContainer(result,
                                     encoding='binary',
                                     **kwargs)
    hdulist = fitsfile.get_fits()
    return Table(hdulist[1].data)
github astropy / astroquery / astroquery / ned / core.py View on Github external
object_name : str
            name of the identifier to query.
        get_query_payload : bool, optional
            if set to `True` then returns the dictionary sent as the HTTP
            request.  Defaults to `False`

        Returns
        --------
        A list of context-managers that yield readable file-like objects

        """
        image_urls = self.get_image_list(object_name, item='spectra',
                                         get_query_payload=get_query_payload)
        if get_query_payload:
            return image_urls
        return [commons.FileContainer(U, encoding='binary',
                                      show_progress=show_progress)
                for U in image_urls]
github astropy / astroquery / astroquery / wfau / core.py View on Github external
programme_id = self.programme_id

        image_urls = self.get_image_list(coordinates, waveband=waveband,
                                         frame_type=frame_type,
                                         image_width=image_width,
                                         image_height=image_height,
                                         database=database, radius=radius,
                                         programme_id=programme_id,
                                         get_query_payload=get_query_payload)
        if get_query_payload:
            return image_urls

        if verbose:
            print("Found {num} targets".format(num=len(image_urls)))

        return [commons.FileContainer(U, encoding='binary',
                                      remote_timeout=self.TIMEOUT,
                                      show_progress=show_progress)
                for U in image_urls]