Welcome to hscquery’s documentation!¶
hscquery
is a Python 2/3 module for querying the
Hyper Suprime-Cam Subaru Strategic Program database. HSC-SSP
Based on the python script developed by michitaro, NAOJ / HSC Collaboration. Source
Dependencies¶
hscquery
depends on astropy
and future
packages.
Example¶
A simple example of using hscquery
:
from hscquery import HSC
from astropy import units as u
from astropy.coordinates import SkyCoord
coords = SkyCoord(34.0, -5.0, unit='deg')
radius = 5.0 * u.arcsec
h = HSC(survey='wide')
data = h.query_region(coords, radius)
print data
hscquery module¶
Module for accessing the Hyper Suprime-Cam Subaru Strategic Program database.
A valid account for the HSC Archive is needed to use this module. See HSC Online Registration.
Based on the python script developed by michitaro, NAOJ / HSC Collaboration. [Source]
-
class
HSC
(survey='wide', release_version='pdr1', columns='object_id, ra, dec', user=None, password_env='HSCPASSW')[source]¶ Bases:
future.types.newobject.newobject
Main class for accessing the HSC-SSP database.
Parameters: - survey (str, optional) – Available surveys: ‘wide’, ‘deep’, ‘udeep’. By default is ‘wide’.
- release_version (str, optional) – For the moment, only ‘pdr1’ is available (Public Data Release 1)
- columns (str, optional) – List of selected columns for query results. See the HSP-SSP schema for details. By default is ‘object_id, ra, dec’.
- user (str or None, optional) – Account name in the HSC-SSP database. If None, when an
HSC
object is initiated, the user can introduced the account name. - password_env (str, optional) – The account’s password can be stored in a system enviroment variable.
By default the password is searched at
HSCPASSW
. If this environment variable doesn’t exist, the user is asked to introduce his password. Use the password_env option with caution, since your password can be easily exposed!
-
query_region
(coords, radius, catalog='forced')[source]¶ Returns an astropy
Table
object with all sources from catalog catalog within radius radius around sky position coords.Parameters: - coords (
SkyCoord
) – Search around this position. - radius (
Quantity
) – Search radius (angular units) - catalog (str, optional) –
Available options: ‘forced’, ‘meas’, ‘specz’, or ‘random’. See the HSP-SSP schema for details. By default is ‘forced’.
- coords (
-
send_query
(sql, output_format='csv', output_file=None, delete_job=True)[source]¶ Send an SQL query sql.
If output_file is
None
, a preview of the results is shown. Otherwise, results are saved in a file with name output_file and in the format defined by output_format.Parameters: - sql (str) – SQL query.
- output_format (str, optional) – Available formats: ‘csv’, ‘csv.gz’, ‘sqlite3’, or ‘fits’.
- output_file (str or
None
) – Name of the file for storing the query results. IfNone
, a preview of the results is shown. - delete_job (bool) – Delete job and results from the user space. By default is
True
.