SDSS

Sloan Digital Sky Survey imaging and spectroscopy.

  • Module name: sdss

  • Python class: astroquery.sdss.SDSS

  • Functions: 18

Call any function below with the astroquery_execute MCP tool. Descriptions are taken from the upstream astroquery/astropy docstrings.

Function

Summary

clear_cache

Removes all cache files.

get_images

Download an image from SDSS.

get_images_async

Download an image from SDSS.

get_spectra

Download spectrum from SDSS.

get_spectra_async

Download spectrum from SDSS.

get_spectral_template

Download spectral templates from SDSS DR-2.

get_spectral_template_async

Download spectral templates from SDSS DR-2.

query_crossid

Queries the service and returns a table object.

query_crossid_async

Query using the cross-identification web interface.

query_photoobj

Queries the service and returns a table object.

query_photoobj_async

Used to query the PhotoObjAll table with run, rerun, camcol and field

query_region

Queries the service and returns a table object.

query_region_async

Used to query a region around given coordinates. Either radius or

query_specobj

Queries the service and returns a table object.

query_specobj_async

Used to query the SpecObjAll table with plate, mjd and fiberID values.

query_sql

Queries the service and returns a table object.

query_sql_async

Query the SDSS database.

reset_cache_location

Resets the cache location to the default astropy cache

Functions

clear_cache

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="clear_cache",
    params={},
)
SDSSClass.clear_cache()

Removes all cache files.

get_images

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="get_images",
    params={},
)
SDSSClass.get_images(*, coordinates=None, radius=<Quantity 2. arcsec>, matches=None, run=None, rerun=301, camcol=None, field=None, band='g', timeout=60, cache=True, get_query_payload=False, data_release=17, show_progress=True)

Download an image from SDSS.

Querying SDSS for images will return the entire plate. For subsequent analyses of individual objects

The query can be made with one the following groups of parameters (whichever comes first is used):

  • matches (result of a call to query_region);

  • coordinates, radius;

  • run, rerun, camcol, field.

See below for examples.

Parameters:
  • coordinates (str or astropy.coordinates object) – The target around which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate astropy.coordinates object. ICRS coordinates may also be entered as strings as specified in the astropy.coordinates module.

  • radius (str or Quantity object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units may also be used. Defaults to 2 arcsec.

  • matches (Table) – Result of query_region.

  • run (integer, optional) – Length of a strip observed in a single continuous image observing scan.

  • rerun (integer, optional) – Reprocessing of an imaging run. Defaults to 301 which is the most recent rerun.

  • camcol (integer, optional) – Output of one camera column of CCDs.

  • field (integer, optional) – Part of a camcol of size 2048 by 1489 pixels.

  • band (str or list) – Could be individual band, or list of bands. Options: 'u', 'g', 'r', 'i', or 'z'.

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

  • data_release (int, optional) – The data release of the SDSS to use.

  • show_progress (bool, optional) – If False, do not display download progress.

Examples

Using results from a call to query_region:

>>> from astropy import coordinates as coords
>>> from astroquery.sdss import SDSS
>>> co = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
>>> result = SDSS.query_region(co)
>>> imgs = SDSS.get_images(matches=result)

Using coordinates directly:

>>> imgs = SDSS.get_images(co)

Fetch the images from all runs with camcol 3 and field 164:

>>> imgs = SDSS.get_images(camcol=3, field=164)

Fetch only images from run 1904, camcol 3 and field 164:

>>> imgs = SDSS.get_images(run=1904, camcol=3, field=164)
Returns:

list

Return type:

List of HDUList objects.

get_images_async

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="get_images_async",
    params={},
)
SDSSClass.get_images_async(coordinates=None, radius=<Quantity 2. arcsec>, matches=None, run=None, rerun=301, camcol=None, field=None, band='g', timeout=60, cache=True, get_query_payload=False, data_release=17, show_progress=True)

Download an image from SDSS.

Querying SDSS for images will return the entire plate. For subsequent analyses of individual objects

The query can be made with one the following groups of parameters (whichever comes first is used):

  • matches (result of a call to query_region);

  • coordinates, radius;

  • run, rerun, camcol, field.

See below for examples.

Parameters:
  • coordinates (str or astropy.coordinates object) – The target around which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate astropy.coordinates object. ICRS coordinates may also be entered as strings as specified in the astropy.coordinates module.

  • radius (str or Quantity object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units may also be used. Defaults to 2 arcsec.

  • matches (Table) – Result of query_region.

  • run (integer, optional) – Length of a strip observed in a single continuous image observing scan.

  • rerun (integer, optional) – Reprocessing of an imaging run. Defaults to 301 which is the most recent rerun.

  • camcol (integer, optional) – Output of one camera column of CCDs.

  • field (integer, optional) – Part of a camcol of size 2048 by 1489 pixels.

  • band (str or list) – Could be individual band, or list of bands. Options: 'u', 'g', 'r', 'i', or 'z'.

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

  • data_release (int, optional) – The data release of the SDSS to use.

  • show_progress (bool, optional) – If False, do not display download progress.

Returns:

list

Return type:

List of HDUList objects.

Examples

Using results from a call to query_region:

>>> from astropy import coordinates as coords
>>> from astroquery.sdss import SDSS
>>> co = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
>>> result = SDSS.query_region(co)
>>> imgs = SDSS.get_images(matches=result)

Using coordinates directly:

>>> imgs = SDSS.get_images(co)

Fetch the images from all runs with camcol 3 and field 164:

>>> imgs = SDSS.get_images(camcol=3, field=164)

Fetch only images from run 1904, camcol 3 and field 164:

>>> imgs = SDSS.get_images(run=1904, camcol=3, field=164)

get_spectra

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="get_spectra",
    params={},
)
SDSSClass.get_spectra(*, coordinates=None, radius=<Quantity 2. arcsec>, matches=None, plate=None, fiberID=None, mjd=None, timeout=60, get_query_payload=False, data_release=17, cache=True, show_progress=True)

Download spectrum from SDSS.

The query can be made with one the following groups of parameters (whichever comes first is used):

  • matches (result of a call to query_region);

  • coordinates, radius;

  • plate, mjd, fiberID.

See below for examples.

Parameters:
  • coordinates (str or astropy.coordinates object) – The target around which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate astropy.coordinates object. ICRS coordinates may also be entered as strings as specified in the astropy.coordinates module.

  • radius (str or Quantity object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units may also be used. Defaults to 2 arcsec.

  • matches (Table) – Result of query_region.

  • plate (integer, optional) – Plate number.

  • fiberID (integer, optional) – Fiber number.

  • mjd (integer, optional) – Modified Julian Date indicating the date a given piece of SDSS data was taken.

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • data_release (int, optional) – The data release of the SDSS to use. With the default server, this only supports DR8 or later.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

  • show_progress (bool, optional) – If False, do not display download progress.

Examples

Using results from a call to query_region:

>>> from astropy import coordinates as coords
>>> from astroquery.sdss import SDSS
>>> co = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
>>> result = SDSS.query_region(co, spectro=True)
>>> spec = SDSS.get_spectra(matches=result)

Using coordinates directly:

>>> spec = SDSS.get_spectra(co)

Fetch the spectra from all fibers on plate 751 with mjd 52251:

>>> specs = SDSS.get_spectra(plate=751, mjd=52251)
Returns:

list

Return type:

List of HDUList objects.

get_spectra_async

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="get_spectra_async",
    params={},
)
SDSSClass.get_spectra_async(*, coordinates=None, radius=<Quantity 2. arcsec>, matches=None, plate=None, fiberID=None, mjd=None, timeout=60, get_query_payload=False, data_release=17, cache=True, show_progress=True)

Download spectrum from SDSS.

The query can be made with one the following groups of parameters (whichever comes first is used):

  • matches (result of a call to query_region);

  • coordinates, radius;

  • plate, mjd, fiberID.

See below for examples.

Parameters:
  • coordinates (str or astropy.coordinates object) – The target around which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate astropy.coordinates object. ICRS coordinates may also be entered as strings as specified in the astropy.coordinates module.

  • radius (str or Quantity object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units may also be used. Defaults to 2 arcsec.

  • matches (Table) – Result of query_region.

  • plate (integer, optional) – Plate number.

  • fiberID (integer, optional) – Fiber number.

  • mjd (integer, optional) – Modified Julian Date indicating the date a given piece of SDSS data was taken.

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • data_release (int, optional) – The data release of the SDSS to use. With the default server, this only supports DR8 or later.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

  • show_progress (bool, optional) – If False, do not display download progress.

Returns:

list – A list of context-managers that yield readable file-like objects. The function returns the spectra for only one of matches, or coordinates and radius, or plate, mjd and fiberID.

Return type:

list

Examples

Using results from a call to query_region:

>>> from astropy import coordinates as coords
>>> from astroquery.sdss import SDSS
>>> co = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
>>> result = SDSS.query_region(co, spectro=True)
>>> spec = SDSS.get_spectra(matches=result)

Using coordinates directly:

>>> spec = SDSS.get_spectra(co)

Fetch the spectra from all fibers on plate 751 with mjd 52251:

>>> specs = SDSS.get_spectra(plate=751, mjd=52251)

get_spectral_template

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="get_spectral_template",
    params={},
)
SDSSClass.get_spectral_template(kind='qso', *, timeout=60, show_progress=True)

Download spectral templates from SDSS DR-2.

Location: http://classic.sdss.org/dr7/algorithms/spectemplates/

There 32 spectral templates available from DR-2, from stellar spectra, to galaxies, to quasars. To see the available templates, do:

from astroquery.sdss import SDSS print SDSS.AVAILABLE_TEMPLATES

Parameters:
  • kind (str or list) – Which spectral template to download? Options are stored in the dictionary astroquery.sdss.SDSS.AVAILABLE_TEMPLATES

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • show_progress (bool, optional) – If False, do not display download progress.

Examples

>>> qso = SDSS.get_spectral_template(kind='qso')
>>> Astar = SDSS.get_spectral_template(kind='star_A')
>>> Fstar = SDSS.get_spectral_template(kind='star_F')
Returns:

list

Return type:

List of HDUList objects.

get_spectral_template_async

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="get_spectral_template_async",
    params={},
)
SDSSClass.get_spectral_template_async(kind='qso', *, timeout=60, show_progress=True)

Download spectral templates from SDSS DR-2.

Location: http://classic.sdss.org/dr7/algorithms/spectemplates/

There 32 spectral templates available from DR-2, from stellar spectra, to galaxies, to quasars. To see the available templates, do:

from astroquery.sdss import SDSS print SDSS.AVAILABLE_TEMPLATES

Parameters:
  • kind (str or list) – Which spectral template to download? Options are stored in the dictionary astroquery.sdss.SDSS.AVAILABLE_TEMPLATES

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • show_progress (bool, optional) – If False, do not display download progress.

Examples

>>> qso = SDSS.get_spectral_template(kind='qso')
>>> Astar = SDSS.get_spectral_template(kind='star_A')
>>> Fstar = SDSS.get_spectral_template(kind='star_F')
Returns:

list

Return type:

List of HDUList objects.

query_crossid

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="query_crossid",
    params={},
)
SDSSClass.query_crossid(*args, **kwargs)

Queries the service and returns a table object.

Query using the cross-identification web interface.

This query returns the nearest `primary object`_.

Note that there is a server-side limit of 3 arcmin on radius.

Parameters:
  • coordinates (str or astropy.coordinates object or (list or Column) of coordinates) –

    The target(s) around which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate astropy.coordinates object. ICRS coordinates may also be entered as strings as specified in the astropy.coordinates module.

    Example: ra = np.array([220.064728084,220.064728467,220.06473483]) dec = np.array([0.870131920218,0.87013210119,0.870138329659]) coordinates = SkyCoord(ra, dec, frame=’icrs’, unit=’deg’)

  • radius (str or Quantity object or Angle object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units or Angle object from astropy.coordinates may also be used. Defaults to 5 arcsec. The maximum allowed value is 3 arcmin.

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • fields (list, optional) – SDSS PhotoObj or SpecObj quantities to return. If None, defaults to quantities required to find corresponding spectra and images of matched objects (e.g. plate, fiberID, mjd, etc.).

  • photoobj_fields (list, optional) – PhotoObj quantities to return. If photoobj_fields is None and specobj_fields is None then the value of fields is used

  • specobj_fields (list, optional) – SpecObj quantities to return. If photoobj_fields is None and specobj_fields is None then the value of fields is used

  • obj_names (str, or list or Column, optional) – Target names. If given, every coordinate should have a corresponding name, and it gets repeated in the query result. It generates unique object names by default.

  • spectro (bool, optional) – Look for spectroscopic match in addition to photometric match? If True, objects will only count as a match if photometry and spectroscopy exist. If False, will look for photometric matches only.

  • region (bool, optional) – Normally cross-id only returns the closest primary object. Setting this to True will return all objects.

  • field_help (str or bool, optional) – Field name to check whether a valid PhotoObjAll or SpecObjAll field name. If True or it is an invalid field name all the valid field names are returned as a dict.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • data_release (int, optional) – The data release of the SDSS to use.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

Raises:
  • TypeError – If the radius keyword could not be parsed as an angle.

  • ValueError – If the radius exceeds 3 arcmin, or if the sizes of coordinates and obj_names do not match.

Returns:

table

Return type:

A `~astropy.table.Table object.`

query_crossid_async

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="query_crossid_async",
    params={"coordinates": "<coordinates>"},
)
SDSSClass.query_crossid_async(coordinates, *, radius=<Quantity 5. arcsec>, timeout=60, fields=None, photoobj_fields=None, specobj_fields=None, obj_names=None, spectro=False, region=False, field_help=False, get_query_payload=False, data_release=17, cache=True)

Query using the cross-identification web interface.

This query returns the nearest `primary object`_.

Note that there is a server-side limit of 3 arcmin on radius.

Parameters:
  • coordinates (str or astropy.coordinates object or (list or Column) of coordinates) –

    The target(s) around which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate astropy.coordinates object. ICRS coordinates may also be entered as strings as specified in the astropy.coordinates module.

    Example: ra = np.array([220.064728084,220.064728467,220.06473483]) dec = np.array([0.870131920218,0.87013210119,0.870138329659]) coordinates = SkyCoord(ra, dec, frame=’icrs’, unit=’deg’)

  • radius (str or Quantity object or Angle object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units or Angle object from astropy.coordinates may also be used. Defaults to 5 arcsec. The maximum allowed value is 3 arcmin.

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • fields (list, optional) – SDSS PhotoObj or SpecObj quantities to return. If None, defaults to quantities required to find corresponding spectra and images of matched objects (e.g. plate, fiberID, mjd, etc.).

  • photoobj_fields (list, optional) – PhotoObj quantities to return. If photoobj_fields is None and specobj_fields is None then the value of fields is used

  • specobj_fields (list, optional) – SpecObj quantities to return. If photoobj_fields is None and specobj_fields is None then the value of fields is used

  • obj_names (str, or list or Column, optional) – Target names. If given, every coordinate should have a corresponding name, and it gets repeated in the query result. It generates unique object names by default.

  • spectro (bool, optional) – Look for spectroscopic match in addition to photometric match? If True, objects will only count as a match if photometry and spectroscopy exist. If False, will look for photometric matches only.

  • region (bool, optional) – Normally cross-id only returns the closest primary object. Setting this to True will return all objects.

  • field_help (str or bool, optional) – Field name to check whether a valid PhotoObjAll or SpecObjAll field name. If True or it is an invalid field name all the valid field names are returned as a dict.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • data_release (int, optional) – The data release of the SDSS to use.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

Raises:
  • TypeError – If the radius keyword could not be parsed as an angle.

  • ValueError – If the radius exceeds 3 arcmin, or if the sizes of coordinates and obj_names do not match.

Returns:

result – The result of the query as a Table object.

Return type:

Table

query_photoobj

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="query_photoobj",
    params={},
)
SDSSClass.query_photoobj(*args, **kwargs)

Queries the service and returns a table object.

Used to query the PhotoObjAll table with run, rerun, camcol and field values.

At least one of run, camcol or field parameters must be specified.

Parameters:
  • run (integer, optional) – Length of a strip observed in a single continuous image observing scan.

  • rerun (integer, optional) – Reprocessing of an imaging run. Defaults to 301 which is the most recent rerun.

  • camcol (integer, optional) – Output of one camera column of CCDs.

  • field (integer, optional) – Part of a camcol of size 2048 by 1489 pixels.

  • fields (list, optional) – SDSS PhotoObj or SpecObj quantities to return. If None, defaults to quantities required to find corresponding spectra and images of matched objects (e.g. plate, fiberID, mjd, etc.).

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • field_help (str or bool, optional) – Field name to check whether a valid PhotoObjAll or SpecObjAll field name. If True or it is an invalid field name all the valid field names are returned as a dict.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • data_release (int, optional) – The data release of the SDSS to use.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

Examples

>>> from astroquery.sdss import SDSS
>>> result = SDSS.query_photoobj(run=5714, camcol=6)
>>> print(result[:5])
      ra           dec             objid        run  rerun camcol field
------------- ------------- ------------------- ---- ----- ------ -----
30.4644529079 7.86460794626 1237670017266024498 5714   301      6    75
38.7635496073 7.47083098197 1237670017269628978 5714   301      6   130
22.2574304026 8.43175488904 1237670017262485671 5714   301      6    21
23.3724928784 8.32576993103 1237670017262944491 5714   301      6    28
25.4801226435 8.27642390025 1237670017263927330 5714   301      6    43
Returns:

table

Return type:

A `~astropy.table.Table object.`

query_photoobj_async

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="query_photoobj_async",
    params={},
)
SDSSClass.query_photoobj_async(*, run=None, rerun=301, camcol=None, field=None, fields=None, timeout=60, get_query_payload=False, field_help=False, data_release=17, cache=True)

Used to query the PhotoObjAll table with run, rerun, camcol and field values.

At least one of run, camcol or field parameters must be specified.

Parameters:
  • run (integer, optional) – Length of a strip observed in a single continuous image observing scan.

  • rerun (integer, optional) – Reprocessing of an imaging run. Defaults to 301 which is the most recent rerun.

  • camcol (integer, optional) – Output of one camera column of CCDs.

  • field (integer, optional) – Part of a camcol of size 2048 by 1489 pixels.

  • fields (list, optional) – SDSS PhotoObj or SpecObj quantities to return. If None, defaults to quantities required to find corresponding spectra and images of matched objects (e.g. plate, fiberID, mjd, etc.).

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • field_help (str or bool, optional) – Field name to check whether a valid PhotoObjAll or SpecObjAll field name. If True or it is an invalid field name all the valid field names are returned as a dict.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • data_release (int, optional) – The data release of the SDSS to use.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

Examples

>>> from astroquery.sdss import SDSS
>>> result = SDSS.query_photoobj(run=5714, camcol=6)
>>> print(result[:5])
      ra           dec             objid        run  rerun camcol field
------------- ------------- ------------------- ---- ----- ------ -----
30.4644529079 7.86460794626 1237670017266024498 5714   301      6    75
38.7635496073 7.47083098197 1237670017269628978 5714   301      6   130
22.2574304026 8.43175488904 1237670017262485671 5714   301      6    21
23.3724928784 8.32576993103 1237670017262944491 5714   301      6    28
25.4801226435 8.27642390025 1237670017263927330 5714   301      6    43
Returns:

result – The result of the query as a Table object.

Return type:

Table

query_region

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="query_region",
    params={},
)
SDSSClass.query_region(*args, **kwargs)

Queries the service and returns a table object.

Used to query a region around given coordinates. Either radius or width must be specified.

When called with keyword radius, a radial or “cone” search is performed, centered on each of the given coordinates. In this mode, internally, this function is equivalent to the object cross-ID (query_crossid), with slightly different parameters. Note that in this mode there is a server-side limit of 3 arcmin on radius.

When called with keyword width, and optionally a different height, a rectangular search is performed, centered on each of the given coordinates. In this mode, internally, this function is equivalent to a general SQL query (query_sql). The shape of the rectangle is not corrected for declination (i.e. no \(\cos \delta\) correction); conceptually, this means that the rectangle will become increasingly trapezoidal-shaped at high declination.

In both radial and rectangular modes, this function returns all objects within the search area; this could potentially include duplicate observations of the same object.

Parameters:
  • coordinates (str or astropy.coordinates object or (list or Column) of coordinates) –

    The target(s) around which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate astropy.coordinates object. ICRS coordinates may also be entered as strings as specified in the astropy.coordinates module.

    Example: ra = np.array([220.064728084,220.064728467,220.06473483]) dec = np.array([0.870131920218,0.87013210119,0.870138329659]) coordinates = SkyCoord(ra, dec, frame=’icrs’, unit=’deg’)

  • radius (str or Quantity object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units may also be used. The maximum allowed value is 3 arcmin.

  • width (str or Quantity object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units may also be used.

  • height (str or Quantity object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units may also be used. If not specified, it will be set to the same value as width.

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • fields (list, optional) – SDSS PhotoObj or SpecObj quantities to return. If None, defaults to quantities required to find corresponding spectra and images of matched objects (e.g. plate, fiberID, mjd, etc.).

  • photoobj_fields (list, optional) – PhotoObj quantities to return. If photoobj_fields is None and specobj_fields is None then the value of fields is used

  • specobj_fields (list, optional) – SpecObj quantities to return. If photoobj_fields is None and specobj_fields is None then the value of fields is used

  • obj_names (str, or list or Column, optional) – Target names. If given, every coordinate should have a corresponding name, and it gets repeated in the query result.

  • spectro (bool, optional) – Look for spectroscopic match in addition to photometric match? If True, objects will only count as a match if photometry and spectroscopy exist. If False, will look for photometric matches only.

  • field_help (str or bool, optional) – Field name to check whether a valid PhotoObjAll or SpecObjAll field name. If True or it is an invalid field name all the valid field names are returned as a dict.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • data_release (int, optional) – The data release of the SDSS to use.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

Raises:
  • TypeError – If the radius, width or height keywords could not be parsed as an angle.

  • ValueError – If both radius and width are set (or neither), or if the radius exceeds 3 arcmin, or if the sizes of coordinates and obj_names do not match, or if the units of width or height could not be parsed.

Examples

>>> from astroquery.sdss import SDSS
>>> from astropy import coordinates as coords
>>> co = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
>>> result = SDSS.query_region(co)
>>> print(result[:5])
      ra           dec             objid        run  rerun camcol field
------------- ------------- ------------------- ---- ----- ------ -----
2.02344282607 14.8398204075 1237653651835781245 1904   301      3   163
2.02344283666 14.8398204143 1237653651835781244 1904   301      3   163
2.02344596595 14.8398237229 1237652943176138867 1739   301      3   315
2.02344596303 14.8398237521 1237652943176138868 1739   301      3   315
2.02344772021 14.8398201105 1237653651835781243 1904   301      3   163
Returns:

table

Return type:

A `~astropy.table.Table object.`

query_region_async

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="query_region_async",
    params={"coordinates": "<coordinates>"},
)
SDSSClass.query_region_async(coordinates, *, radius=None, width=None, height=None, timeout=60, fields=None, photoobj_fields=None, specobj_fields=None, obj_names=None, spectro=False, field_help=False, get_query_payload=False, data_release=17, cache=True)

Used to query a region around given coordinates. Either radius or width must be specified.

When called with keyword radius, a radial or “cone” search is performed, centered on each of the given coordinates. In this mode, internally, this function is equivalent to the object cross-ID (query_crossid), with slightly different parameters. Note that in this mode there is a server-side limit of 3 arcmin on radius.

When called with keyword width, and optionally a different height, a rectangular search is performed, centered on each of the given coordinates. In this mode, internally, this function is equivalent to a general SQL query (query_sql). The shape of the rectangle is not corrected for declination (i.e. no \(\cos \delta\) correction); conceptually, this means that the rectangle will become increasingly trapezoidal-shaped at high declination.

In both radial and rectangular modes, this function returns all objects within the search area; this could potentially include duplicate observations of the same object.

Parameters:
  • coordinates (str or astropy.coordinates object or (list or Column) of coordinates) –

    The target(s) around which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate astropy.coordinates object. ICRS coordinates may also be entered as strings as specified in the astropy.coordinates module.

    Example: ra = np.array([220.064728084,220.064728467,220.06473483]) dec = np.array([0.870131920218,0.87013210119,0.870138329659]) coordinates = SkyCoord(ra, dec, frame=’icrs’, unit=’deg’)

  • radius (str or Quantity object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units may also be used. The maximum allowed value is 3 arcmin.

  • width (str or Quantity object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units may also be used.

  • height (str or Quantity object, optional) – The string must be parsable by Angle. The appropriate Quantity object from astropy.units may also be used. If not specified, it will be set to the same value as width.

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • fields (list, optional) – SDSS PhotoObj or SpecObj quantities to return. If None, defaults to quantities required to find corresponding spectra and images of matched objects (e.g. plate, fiberID, mjd, etc.).

  • photoobj_fields (list, optional) – PhotoObj quantities to return. If photoobj_fields is None and specobj_fields is None then the value of fields is used

  • specobj_fields (list, optional) – SpecObj quantities to return. If photoobj_fields is None and specobj_fields is None then the value of fields is used

  • obj_names (str, or list or Column, optional) – Target names. If given, every coordinate should have a corresponding name, and it gets repeated in the query result.

  • spectro (bool, optional) – Look for spectroscopic match in addition to photometric match? If True, objects will only count as a match if photometry and spectroscopy exist. If False, will look for photometric matches only.

  • field_help (str or bool, optional) – Field name to check whether a valid PhotoObjAll or SpecObjAll field name. If True or it is an invalid field name all the valid field names are returned as a dict.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • data_release (int, optional) – The data release of the SDSS to use.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

Raises:
  • TypeError – If the radius, width or height keywords could not be parsed as an angle.

  • ValueError – If both radius and width are set (or neither), or if the radius exceeds 3 arcmin, or if the sizes of coordinates and obj_names do not match, or if the units of width or height could not be parsed.

Examples

>>> from astroquery.sdss import SDSS
>>> from astropy import coordinates as coords
>>> co = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
>>> result = SDSS.query_region(co)
>>> print(result[:5])
      ra           dec             objid        run  rerun camcol field
------------- ------------- ------------------- ---- ----- ------ -----
2.02344282607 14.8398204075 1237653651835781245 1904   301      3   163
2.02344283666 14.8398204143 1237653651835781244 1904   301      3   163
2.02344596595 14.8398237229 1237652943176138867 1739   301      3   315
2.02344596303 14.8398237521 1237652943176138868 1739   301      3   315
2.02344772021 14.8398201105 1237653651835781243 1904   301      3   163
Returns:

result – The result of the query as a Table object.

Return type:

Table

query_specobj

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="query_specobj",
    params={},
)
SDSSClass.query_specobj(*args, **kwargs)

Queries the service and returns a table object.

Used to query the SpecObjAll table with plate, mjd and fiberID values.

At least one of plate, mjd or fiberID parameters must be specified.

Parameters:
  • plate (integer, optional) – Plate number.

  • mjd (integer, optional) – Modified Julian Date indicating the date a given piece of SDSS data was taken.

  • fiberID (integer, optional) – Fiber number.

  • fields (list, optional) – SDSS PhotoObj or SpecObj quantities to return. If None, defaults to quantities required to find corresponding spectra and images of matched objects (e.g. plate, fiberID, mjd, etc.).

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • field_help (str or bool, optional) – Field name to check whether a valid PhotoObjAll or SpecObjAll field name. If True or it is an invalid field name all the valid field names are returned as a dict.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • data_release (int, optional) – The data release of the SDSS to use.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

Examples

>>> from astroquery.sdss import SDSS
>>> result = SDSS.query_specobj(plate=2340,
...     fields=['ra', 'dec','plate', 'mjd', 'fiberID', 'specobjid'])
>>> print(result[:5])
      ra           dec      plate  mjd  fiberID      specobjid
------------- ------------- ----- ----- ------- -------------------
49.2020613611 5.20883041368  2340 53733      60 2634622337315530752
48.3745360119 5.26557511598  2340 53733     154 2634648175838783488
47.1604269095 5.48241410994  2340 53733     332 2634697104106219520
48.6634992214 6.69459110287  2340 53733     553 2634757852123654144
48.0759195428 6.18757403485  2340 53733     506 2634744932862027776
Returns:

table

Return type:

A `~astropy.table.Table object.`

query_specobj_async

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="query_specobj_async",
    params={},
)
SDSSClass.query_specobj_async(*, plate=None, mjd=None, fiberID=None, fields=None, timeout=60, get_query_payload=False, field_help=False, data_release=17, cache=True)

Used to query the SpecObjAll table with plate, mjd and fiberID values.

At least one of plate, mjd or fiberID parameters must be specified.

Parameters:
  • plate (integer, optional) – Plate number.

  • mjd (integer, optional) – Modified Julian Date indicating the date a given piece of SDSS data was taken.

  • fiberID (integer, optional) – Fiber number.

  • fields (list, optional) – SDSS PhotoObj or SpecObj quantities to return. If None, defaults to quantities required to find corresponding spectra and images of matched objects (e.g. plate, fiberID, mjd, etc.).

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • field_help (str or bool, optional) – Field name to check whether a valid PhotoObjAll or SpecObjAll field name. If True or it is an invalid field name all the valid field names are returned as a dict.

  • get_query_payload (bool, optional) – If True, this will return the data the query would have sent out, but does not actually do the query.

  • data_release (int, optional) – The data release of the SDSS to use.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

Examples

>>> from astroquery.sdss import SDSS
>>> result = SDSS.query_specobj(plate=2340,
...     fields=['ra', 'dec','plate', 'mjd', 'fiberID', 'specobjid'])
>>> print(result[:5])
      ra           dec      plate  mjd  fiberID      specobjid
------------- ------------- ----- ----- ------- -------------------
49.2020613611 5.20883041368  2340 53733      60 2634622337315530752
48.3745360119 5.26557511598  2340 53733     154 2634648175838783488
47.1604269095 5.48241410994  2340 53733     332 2634697104106219520
48.6634992214 6.69459110287  2340 53733     553 2634757852123654144
48.0759195428 6.18757403485  2340 53733     506 2634744932862027776
Returns:

result – The result of the query as an Table object.

Return type:

Table

query_sql

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="query_sql",
    params={},
)
SDSSClass.query_sql(*args, **kwargs)

Queries the service and returns a table object.

Query the SDSS database.

Parameters:
  • sql_query (str) – An SQL query

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • data_release (int, optional) – The data release of the SDSS to use.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

Examples

>>> from astroquery.sdss import SDSS
>>> query = "select top 10                        z, ra, dec, bestObjID                      from                        specObj                      where                        class = 'galaxy'                        and z > 0.3                        and zWarning = 0"
>>> res = SDSS.query_sql(query)
>>> print(res[:5])
    z         ra       dec         bestObjID
--------- --------- --------- -------------------
0.3000011 16.411075 4.1197892 1237678660894327022
0.3000012 49.459411  0.847754 1237660241924063461
0.3000027 156.25024 7.6586271 1237658425162858683
0.3000027 256.99461 25.566255 1237661387086693265
 0.300003 175.65125  34.37548 1237665128003731630
Returns:

table

Return type:

A `~astropy.table.Table object.`

query_sql_async

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="query_sql_async",
    params={"sql_query": "<sql_query>"},
)
SDSSClass.query_sql_async(sql_query, *, timeout=60, data_release=17, cache=True, **kwargs)

Query the SDSS database.

Parameters:
  • sql_query (str) – An SQL query

  • timeout (float, optional) – Time limit (in seconds) for establishing successful connection with remote server. Defaults to SDSSClass.TIMEOUT.

  • data_release (int, optional) – The data release of the SDSS to use.

  • cache (bool) – Defaults to True. If set overrides global caching behavior. See caching documentation.

Examples

>>> from astroquery.sdss import SDSS
>>> query = "select top 10                        z, ra, dec, bestObjID                      from                        specObj                      where                        class = 'galaxy'                        and z > 0.3                        and zWarning = 0"
>>> res = SDSS.query_sql(query)
>>> print(res[:5])
    z         ra       dec         bestObjID
--------- --------- --------- -------------------
0.3000011 16.411075 4.1197892 1237678660894327022
0.3000012 49.459411  0.847754 1237660241924063461
0.3000027 156.25024 7.6586271 1237658425162858683
0.3000027 256.99461 25.566255 1237661387086693265
 0.300003 175.65125  34.37548 1237665128003731630
Returns:

result – The result of the query as a Table object.

Return type:

Table

reset_cache_location

Call via MCP

astroquery_execute(
    module_name="sdss",
    function_name="reset_cache_location",
    params={},
)
SDSSClass.reset_cache_location()

Resets the cache location to the default astropy cache