Query VizieR using the batch mode.
The Python cdsclient package gather scripts to query large tables : wise, 2mass, sdss, Gaia, ... the package includes:
The vizquery program is a facility to query remotely VizieR. This program is part of the cdsclient package, and can run on any linux/unix platform. It reads the query parameters on its standard input, and writes the results of the query on the standard output in various formats including VOTable or FITS
Note : it may happen that all specifications are not fully implemented; if some features are missing or not working, please contact us (click on the enveloppe at the bottom of this page)
Please refer to the cdsclient pages which includes all the details for the installation of vizquery.
Without any argument, displays a short help:
Usage: vizquery [-mime={html|ascii|votable|fits|binfits|tsv|csv|xml|acl|text}] [-site=site] [{asu_constraints...|input_file_with_contraints}] Constraints are given in ASU form (-list can be used for a list of targets) vizquery -mime=text -source=I/239/hip_main HIP=1..10 by default constraints are asked on standard input. (details at: http://vizier.cds.unistra.fr/doc/vizquery.htx Sites are: vizier.cds.unistra.fr (cds) (fr) vizier.cfa.harvard.edu (cfa) (us) vizier.hia.nrc.ca (cadc) (ca) vizier.nao.ac.jp (adac) (jp) data.bao.ac.cn (bejing) (cn) vizier.ast.cam.ac.uk (cambridge) (uk) www.ukirt.jach.hawaii.edu (ukirt) (hawaii) vizier.inasan.ru (moscow) (ru) |
html | is the format used by the various browsers like Firefox, Mozilla or Internet Explorer, and presents the results in nicely formatted tables; however such a presentation requires a large amount of bytes, and is not quite easy to interpret by a program. |
ascii | is also meant to be used by browsers, but here tables are presented as column-aligned bytes separated by blanks. It generates less bytes than the html output, but still includes HTML tags like links. |
votable | is the format defined for the Virtual Observatory; its structure is defined in the VOTable Documentation (the corresponding cgi is /viz-bin/votable) |
fits | is the ascii tabular format defined in the context of the Flexible Image Transport System (the corresponding cgi is /viz-bin/asu-fits). |
binfits | is the binary tabular format defined in the context of the Flexible Image Transport System (BINTABLE extension) (the corresponding cgi is /viz-bin/asu-binfits). |
tsv | is an ascii format where each column is separated from the next one by a tab character (with hexadecimal representation 09, and sometimes named Control-I) (the corresponding cgi is /viz-bin/asu-tsv). |
csv | is a format similar to tsv, but the character
used to separated the columns is the semicolon ;
Other punctuation characters may be used to separate
the columns – by just specifying the punctuation as the
mime type: for instance |
astrores | is a mixture of XML and TSV format also known as Astrores; it is the original format developped for the communication to the Aladin integrator (the corresponding cgi is /viz-bin/asu-xml). |
acl | is the format required by SkyCat and used e.g. by Gemini tools (the corresponding cgi is /viz-bin/asu-acl). |
text | is a simple aligned asci text output (text/plain mime type) (the corresponding cgi is /viz-bin/asu-txt). |
When no constraint is given as arguments or via a file, the query specifications are assumed to be in the standard input (i.e. typed at the terminal or included in the script with the Unix <<sentinel convention).
Each line of the input to may contain the following:
The full syntax of the way to specify constraints (what is at the right of the leftmost equal sign) is detailed in the Qualification Syntax.
Long lists of contraints on one parameter – typically a list of targets (positions on the sky) or values asked in one column of a table – can be stored in a plain ascii file and referred in the -list argument.
Assuming that the file
will deliver the sources found in the PPMXL catalog
around each of the positions specified, with their distance
from the sources specified in the
If a constraint other than the position is supplied in a file,
the name of the column of the table corresponding to the parameter
is specified after the list, as in the example below
Note that lists are more generic than just lists of targets:
the
An example of a query of a list of targets is given below.
where
The examples are shown in 2 dialects: either a single command line possibly referencing a file, or with the use of a delimiter ====End to indicate to the shell where the standard input starts and ends. This delimiter can be changed to any other valid delimiter (word excluding the characters meaningful to the shell like spaces, asterisks, brackets, questions marks, ampersand, ...); alternatively if the query arguments are saved in a file named e.g. myQueryArguments , the standard shell redirection can be used and the first example could be written
Alternatively, with the ASU commands in the standard input:
Alternatively, with the ASU commands in the standard input:
The traditional way is:
A probably simpler way, assuming that the file
The simpler way would be, if
vizquery -mime=csv <<====End
# Query All Columns of 2MASS and Tycho-2 Catalogues around HD 226868
-source=2MASS,USNO-A2
-out.all
-out.add=_r
-sort=_r
-c=HD 226868
-c.rm=2
====End
vizquery -mime=csv <<====End
# Retrieve Hiparcos stars closer than 20pc (Plx > 50mas)
# and order the results by decreasing parallax
# (i.e. increasing distance from the Sun)
-source=HIP/hip_main
-out.max=9999
-oc.form=D
-out=Plx, _RAJ2000, _DEJ2000, HIP, Vmag, B-V
-sort=-Plx
Plx=>50
====End
vizquery -mime=votable <<====End
### Example of a list of Targets for vizquery usage
#######################
-source=USNO-B1
# VizieR uses catalog numbers -- would work also with
#-source=I/284
-out.max=9999
#-out.add=_1 asks to insert my target as the first output column
-out.add=_1
# I need the distance of the found objects, too.
-out.add=_r
# Be as concise as possible -- don't create a new table for each target
-out.form=mini
# My output looks better sorted by increasing distance to each target.
-sort=_r
# Max distance to the target: 1arcmin
-c.rm=1
# Now comes the list of my targets:
-c=<<====MyList
# Some random position in (RA,Dec)
123.5-12.68 ; random position
# The First Quasar
3C 273
# The only supernova brighter than 6mag
SN 1987A
# 2 bright stars used for checking
alpha Cen
alpha UMi
====MyList
====End
vizquery -mime=votable <<====End
### Example of a list of Targets for vizquery usage
#######################
-source=HIP/hip_main
#-out.add=_1 asks to insert my Hipparcos number as leftmost column.
-out.add=_1
# Be as concise as possible -- don't create a new table for each star
-out.form=mini
# Get all parameters of the Hipparcos main table
-out.all
# Now comes the list of my Hipparcos numbers:
HIP=<<====myHIPsample
# In fact, I want just Hipparcos stars 1 to 10,
# 101 to 110, 1001 to 1010, 10001 to 10010, and 100001 to 100010
1..10
101..110
1001..1010
10001..10010
100001..100010
====myHIPsample
====End
last update: 13 Feb 2024