gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 3e7cced: Query: new --range option to limit ro


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 3e7cced: Query: new --range option to limit rows of the query
Date: Sat, 19 Sep 2020 18:40:14 -0400 (EDT)

branch: master
commit 3e7cced0b075eda2bdb7e9bec4cff389ebdbc5ae
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Query: new --range option to limit rows of the query
    
    Until now, when constructing the query automatically, query would return
    the full range of the requested columns within the given spatial range. But
    in many situations, we don't need all the rows, we only need rows with
    certain values in some columns.
    
    With this commit there is now a new '--range' option that is designed for
    this purpose. It can be called multiple times to set ranges in multiple
    columns.
    
    Also, the book, the Query program has been moved into the "Data containers"
    chapter, because it fits better into the context of this chapter.
---
 bin/query/args.h  |  40 +++++--
 bin/query/main.h  |   1 +
 bin/query/query.c |  33 +++--
 bin/query/ui.c    |  16 +++
 bin/query/ui.h    |   3 +-
 doc/gnuastro.texi | 353 +++++++++++++++++++++++++++++-------------------------
 6 files changed, 262 insertions(+), 184 deletions(-)

diff --git a/bin/query/args.h b/bin/query/args.h
index cda9718..4832af9 100644
--- a/bin/query/args.h
+++ b/bin/query/args.h
@@ -47,19 +47,6 @@ struct argp_option program_options[] =
       ui_parse_database
     },
     {
-      "dataset",
-      UI_KEY_DATASET,
-      "STR",
-      0,
-      "Name of dataset in database (e.g., 'gaiadr2').",
-      GAL_OPTIONS_GROUP_INPUT,
-      &p->datasetstr,
-      GAL_TYPE_STRING,
-      GAL_OPTIONS_RANGE_ANY,
-      GAL_OPTIONS_NOT_MANDATORY,
-      GAL_OPTIONS_NOT_SET,
-    },
-    {
       "query",
       UI_KEY_QUERY,
       "STR",
@@ -84,6 +71,19 @@ struct argp_option program_options[] =
       UI_GROUP_BYCENTER,
     },
     {
+      "dataset",
+      UI_KEY_DATASET,
+      "STR",
+      0,
+      "Name of dataset in database.",
+      UI_GROUP_BYCENTER,
+      &p->datasetstr,
+      GAL_TYPE_STRING,
+      GAL_OPTIONS_RANGE_ANY,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+    },
+    {
       "center",
       UI_KEY_CENTER,
       "FLT[,...]",
@@ -126,6 +126,20 @@ struct argp_option program_options[] =
       gal_options_parse_csv_float64
     },
     {
+      "range",
+      UI_KEY_RANGE,
+      "STR,FLT:FLT",
+      0,
+      "Range of selected targets in given column.",
+      UI_GROUP_BYCENTER,
+      &p->range,
+      GAL_TYPE_STRING,
+      GAL_OPTIONS_RANGE_ANY,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      gal_options_parse_name_and_float64s
+    },
+    {
       "column",
       UI_KEY_COLUMN,
       "STR",
diff --git a/bin/query/main.h b/bin/query/main.h
index f1e3942..f763300 100644
--- a/bin/query/main.h
+++ b/bin/query/main.h
@@ -48,6 +48,7 @@ struct queryparams
   char             *datasetstr;  /* ID of dataset in database to use.  */
   gal_data_t           *center;  /* Center position of query.          */
   gal_data_t           *radius;  /* Radius around center.              */
+  gal_data_t            *range;  /* Range of magnitudes to query.      */
   gal_data_t            *width;  /* Width of box around center.        */
   char                  *query;  /* Raw query string.                  */
   gal_list_str_t      *columns;  /* Columns to extract from database.  */
diff --git a/bin/query/query.c b/bin/query/query.c
index 86d0d7f..2a86bce 100644
--- a/bin/query/query.c
+++ b/bin/query/query.c
@@ -131,8 +131,9 @@ query_gaia_sanitycheck(struct queryparams *p)
 void
 query_gaia(struct queryparams *p)
 {
-  char *regionstr;
+  gal_data_t *tmp;
   double *center, *darray;
+  char *tmpstr, *regionstr, *rangestr=NULL;
   char *command, *columns, allcols[]="*", *querystr;
 
   /* Make sure everything is fine. */
@@ -158,24 +159,42 @@ query_gaia(struct queryparams *p)
       if(p->radius)
         {
           darray=p->radius->array;
-          if( asprintf(&regionstr, "CIRCLE('ICRS', %.8f, %.8f, %g) )",
+          if( asprintf(&regionstr, "CIRCLE('ICRS', %.8f, %.8f, %g)",
                        center[0], center[1], darray[0])<0 )
-            error(EXIT_FAILURE, 0, "%s: asprintf allocation ('regionstr')", 
__func__);
+            error(EXIT_FAILURE, 0, "%s: asprintf allocation ('regionstr')",
+                  __func__);
         }
       else if(p->width)
         {
           darray=p->width->array;
-          if( asprintf( &regionstr, "BOX('ICRS', %.8f, %.8f, %.8f, %.8f) )",
+          if( asprintf( &regionstr, "BOX('ICRS', %.8f, %.8f, %.8f, %.8f)",
                         center[0], center[1], darray[0],
                         p->width->size==1 ? darray[0] : darray[1] )<0 )
-            error(EXIT_FAILURE, 0, "%s: asprintf allocation ('regionstr')", 
__func__);
+            error(EXIT_FAILURE, 0, "%s: asprintf allocation ('regionstr')",
+                  __func__);
         }
 
+      /* Set the range criteria on the requested columns. */
+      if(p->range)
+        for(tmp=p->range; tmp!=NULL; tmp=tmp->next)
+          {
+            darray=tmp->array;
+            if( asprintf(&tmpstr, "%s%sAND %s>=%g AND %s<=%g",
+                         rangestr==NULL ? "" : rangestr,
+                         rangestr==NULL ? "" : " ",
+                         tmp->name, darray[0], tmp->name, darray[1]) < 0 )
+              error(EXIT_FAILURE, 0, "%s: asprintf allocation ('tmpstr')",
+                    __func__);
+            free(rangestr);
+            rangestr=tmpstr;
+          }
+
       /* Write the automatically generated query string. */
       if( asprintf(&querystr,  "SELECT %s "
                    "FROM %s "
-                   "WHERE 1=CONTAINS( POINT('ICRS', ra, dec), %s )", columns,
-                   p->datasetstr, regionstr)<0 )
+                   "WHERE 1=CONTAINS( POINT('ICRS', ra, dec), %s ) %s",
+                   columns, p->datasetstr, regionstr,
+                   rangestr ? rangestr : "")<0 )
         error(EXIT_FAILURE, 0, "%s: asprintf allocation ('querystr')", 
__func__);
 
       /* Clean up. */
diff --git a/bin/query/ui.c b/bin/query/ui.c
index 653a909..27ff1ea 100644
--- a/bin/query/ui.c
+++ b/bin/query/ui.c
@@ -259,6 +259,7 @@ static void
 ui_read_check_only_options(struct queryparams *p)
 {
   size_t i;
+  gal_data_t *tmp;
 
   /* See if database has been specified. */
   if(p->database==0)
@@ -288,6 +289,21 @@ ui_read_check_only_options(struct queryparams *p)
         error(EXIT_FAILURE, 0, "the '--radius' option value cannot be 
negative");
     }
 
+  /* If magnitude is given, it should only be two values. */
+  i=0;
+  if(p->range)
+    for(tmp=p->range; tmp!=NULL; tmp=tmp->next)
+      {
+        ++i;
+        if(tmp->size!=2)
+          error(EXIT_FAILURE, 0, "two values (separated by ',' or ':') "
+                "should be given to '--range'. But %zu values were given "
+                "to the %zu%s call of this option (recall that the first "
+                "value should be the column name in the given dataset)",
+                tmp->size, i,
+                i==1 ? "st" : i==2 ? "nd" : i==3 ? "rd" : "th");
+      }
+
   /* Sanity checks on  width (if we are in the center-mode). */
   if(p->width && p->center)
     {
diff --git a/bin/query/ui.h b/bin/query/ui.h
index de26fcf..145bfb7 100644
--- a/bin/query/ui.h
+++ b/bin/query/ui.h
@@ -42,7 +42,7 @@ enum program_args_groups
 
 /* Available letters for short options:
 
-   a b e f g i j k m n p t u v x y z
+   a b e f i j k m n p t u v x y z
    A B E G H J L R W X Y
 */
 enum option_keys_enum
@@ -53,6 +53,7 @@ enum option_keys_enum
   UI_KEY_DATASET         = 's',
   UI_KEY_CENTER          = 'C',
   UI_KEY_RADIUS          = 'r',
+  UI_KEY_RANGE           = 'g',
   UI_KEY_COLUMN          = 'c',
   UI_KEY_WIDTH           = 'w',
 
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 0a96bfb..7e071ac 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -380,6 +380,7 @@ Data containers
 * Sort FITS files by night::    Installed script to sort FITS files by obs 
night.
 * ConvertType::                 Convert data to various formats.
 * Table::                       Read and Write FITS tables to plain text.
+* Query::                       Import data from external databases.
 
 Fits
 
@@ -405,6 +406,10 @@ Table
 * Column arithmetic::           How to do operations on table columns.
 * Invoking asttable::           Options and arguments to Table.
 
+Query
+
+* Invoking astquery::           Inputs, outputs and configuration of Query.
+
 Data manipulation
 
 * Crop::                        Crop region(s) from a dataset.
@@ -568,7 +573,6 @@ Noise basics
 High-level calculations
 
 * CosmicCalculator::            Calculate cosmological variables
-* Query::                       Import data from external databases
 
 CosmicCalculator
 
@@ -582,10 +586,6 @@ Invoking CosmicCalculator
 * CosmicCalculator basic cosmology calculations::  Like distance modulus, 
distances and etc.
 * CosmicCalculator spectral line calculations::  How they get affected by 
redshift.
 
-Query
-
-* Invoking astquery::           Inputs, outputs and configuration of Query.
-
 Library
 
 * Review of library fundamentals::  Guide on libraries and linking.
@@ -8126,6 +8126,7 @@ It can be used to select certain table columns in a FITS 
table and see them as a
 * Sort FITS files by night::    Installed script to sort FITS files by obs 
night.
 * ConvertType::                 Convert data to various formats.
 * Table::                       Read and Write FITS tables to plain text.
+* Query::                       Import data from external databases.
 @end menu
 
 
@@ -9395,7 +9396,7 @@ Note that this behavior is ideal for gray-scale images, 
if you want a color imag
 
 @end table
 
-@node Table,  , ConvertType, Data containers
+@node Table, Query, ConvertType, Data containers
 @section Table
 
 Tables are the products of processing astronomical images and spectra.
@@ -9940,6 +9941,188 @@ Finally, if you already have a FITS table by other 
means (for example by downloa
 
 
 
+
+
+
+@node Query,  , Table, Data containers
+@section Query
+
+@cindex Query
+There are many astronomical databases available for downloading astronomical 
data.
+Each has its own interface, which is usually very well documented in their own 
webpages.
+However, remembering the exact URLs and interface of each database is not 
easily possible and using the graphic web interface (which is commonly easier 
to use), is not an automatic process.
+
+Gnuastro's Query program is designed to address these problems: it has a 
common high-level interface for general operations that are common between its 
recognized databases.
+For example, importing a catalog of objects within a certain distance of a 
given coordinate.
+
+@menu
+* Invoking astquery::           Inputs, outputs and configuration of Query.
+@end menu
+
+@node Invoking astquery,  , Query, Query
+@subsection Invoking Query
+
+Query provides a high-level interface to downloading subsets of data from 
databases.
+The executable name is @file{astquery} with the following general template
+
+@example
+$ astquery [OPTION...] ...
+@end example
+
+@noindent
+One line examples:
+
+@example
+## Import all the columns of all entries in the Gaia DR2 catalog within
+## 20 arc-minutes of the given coordinate.
+$ astquery --database=gaia --dataset=dr2 --output=my-gaia.fits \
+           --center=113.8729761,31.9027152 --radius=20/60
+
+## Similar to above, but return all objects within a square box of
+## 30 arcminutes (can also be rectangular, see '--width').
+$ astquery --database=gaia --dataset=dr2 --output=my-gaia.fits \
+           --center=113.8729761,31.9027152 --width=30/60
+
+## Similar to above, but for objects with magnitude range 10 to 15
+$ astquery --database=gaia --dataset=dr2 --output=my-gaia.fits \
+           --center=113.8729761,31.9027152 --width=30/60 \
+           --range=phot_g_mean_mag,10:15
+
+## Similar to first example, but only import the ID, RA, Dec and G-band
+## magnitude of the sources (not all the columns).
+$ astquery --database=gaia --dataset=dr2 --output=my-gaia.fits \
+           --center=113.8729761,31.9027152 --radius=0.1 \
+           --column=source_id,ra,dec,phot_g_mean_mag
+
+## Use a custom query to extract entries in the Gaia DR2 catalog.
+## The 'XXXX YYYY' can be a query of any size on the command-line.
+$ astquery --database=gaia --query="XXXX YYYY" --output=my-gaia.fits
+@end example
+
+Query doesn't take any input argument, because the main goal is to retreive 
data from external sources.
+The main input to Query is the @option{--database} option which specifies 
which database should be contacted for submitting the query.
+The name of the downloaded output file can optionally be set with 
@option{--output}.
+If @option{--output} is not set, an automatically generated name will be used.
+
+There are two methods to query the database: 1) with @option{--query} you can 
directly give a raw query statement that is recognized by the database, 2) with 
the @option{--center} and @option{--radius}, the low-level query will 
constructed automatically for the particular database.
+The former is very low level and will require some knowledge of the database's 
query language, but of course, it is much more powerful.
+The latter is much more limited in terms of capabilities (the only constraint 
is the location of the objects compared to the given center), but doesn't 
require any knowledge of the database's query language.
+
+@cartouche
+@noindent
+@strong{Under development, request for feedback:} Query is a new member of the 
Gnuastro family of programs.
+It currently requires that the @command{curl} executable (for the cURL 
downloading program) to be present on the host and the number of databases it 
supports is still limited, see the list under the @option{--database} option 
below.
+More downloader tools, and databases will be added in the near future as it is 
used more often, so please don't hesitate to suggest any that you may need.
+@end cartouche
+
+@table @option
+
+@item -d STR
+@itemx --database=STR
+Identifer for the database for sending the query.
+The current list of databases are listed here:
+
+@table @code
+@item gaia
+@cindex Gaia catalog
+@cindex Catalog, Gaia
+The Gaia project (@url{https://www.cosmos.esa.int/web/gaia}) database which is 
a large collection of star positions on the celestial sphere, as well as 
peculiar velocities, paralloxes and magnitudes in some bands among many others.
+Besides scientific studies (like studying resolved stellar populations in the 
Galaxy and its halo), Gaia is also invaluable for raw data calibrations, like 
astrometry.
+The query given to this database will be submitted to 
@code{https://gea.esac.esa.int/tap-server/tap/sync}.
+@end table
+
+@item -Q "STR"
+@itemx --query="STR"
+Directly specify the query to be passed onto the database.
+The queries will generally contain space and other meta-characters, so we 
recommend placing the query within quotations.
+
+@item -s STR
+@itemx --dataset=STR
+The dataset to query within the database for the automatically generated query 
(not compatible with @option{--query}).
+The reason for this is that many databases have different types of datasets, 
for example different data releases (DRs), or various high-level calculations 
on subsets of the database elements.
+For example when @option{--database=gaia}, you can set @option{--dataset=dr2} 
to only select objects within the second data release (DR2).
+
+You can either use the database's official name of the datasets, for example 
@code{gaiadr2.gaia_source} for the second data release of the Gaia database, or 
a simplified version that maps to it (@code{dr2}) for easy typing on the 
command-line.
+Below is a list of the simplified names for the databases that have them.
+
+@table @code
+@item gaia
+@itemize
+@item
+@code{dr2 --> gaiadr2.gaia_source}
+@item
+@code{dr2 --> gaiadr1.gaia_source}
+@item
+@code{tyco2 --> public.tyco2}
+@item
+@code{hipparcos --> public.hipparcos}
+@end itemize
+@end table
+
+@item -C FLT,FLT
+@itemx --center=FLT,FLT
+The center to use for the automatically generated query (not compatible with 
@option{--query}).
+All objects within a certain distance of the requested center position will be 
requested from the dataset.
+The distance can be specified with the @option{--radius} option.
+
+@item -r FLT
+@itemx --radius=FLT
+The radius about the requested center to use for the automatically generated 
query (not compatible with @option{--query}).
+The radius is in units of degrees, but you can use simple division with this 
option directly on the command-line.
+For example if you want a radius of 20 arc-minutes or 20 arc-seconds, you can 
use @option{--radius=20/60} or @option{--radius=20/3600} respectively (which is 
much more human-friendly than @code{0.3333} or @code{0.005556}).
+
+@item -w FLT[,FLT]
+@itemx --width=FLT[,FLT]
+The square (or rectangle) side length (width) about the requested center to 
use for the automatically generated query (not compatible with 
@option{--query}).
+If only one value is given to @code{--width} the region will be a square, but 
if two values are given, the widths of the query box along each dimension will 
be different.
+The value(s) is(are) in units of degrees, but you can use simple division for 
each value directly on the command-line, see the description of 
@option{--radius} for more on using division.
+
+@item -g STR,FLT,FLT
+@itemx --range=STR,FLT,FLT
+The column name and numerical range (inclusive) of acceptable values in that 
column (not compatible with @option{--query}).
+This option can be called multiple times for applying range limits on many 
columns in one call (thus greatly reducing the download size).
+For example @code{--range=phot_g_mean_mag,10:15} will only query for rows that 
have a value between 10 and 15 (inclusive) in the @code{phot_g_mean_mag} column 
(from the Gaia catalog).
+
+If you want the interval to not be inclusive on both sides, you can run 
@code{astquery} once and get the command that it executes.
+Then you can edit it to be non-inclusive on one side.
+
+@item -c STR
+@itemx --column=STR[,STR[,...]]
+The optional column name(s) to retrieve from the dataset in the automatically 
generated query (not compatible with @option{--query}).
+If not given, all the dataset's columns for the selected rows will be used 
(which can be large!).
+This option can take multiple values in one instance (for example 
@option{--column=ra,dec,mag}), or in multiple instances (for example 
@option{-cra -cdec -cmag}), or mixed (for example @option{-cra,dec -cmag}).
+
+In case, you don't know the full list of the dataset's column names, one 
solution is to run this program once without any @option{--column} and setting 
@option{--radius=0} (to have few, or no, rows and download fast).
+You can then inspect the column names with @ref{Table}.
+In case the database doesn't support a search radius of 0, or can't return a 
table with no rows, you can increase the radius.
+Here is an example on the Gaia DR2 catalog to show the full list of available 
columns:
+
+@example
+$ astquery --database=gaia --dataset=dr2 --center=0,0 \
+           --radius=0 --output=gaia-dr2-cols.fits
+$ asttable gaia-dr2-cols.fits --info
+@end example
+@end table
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 @node Data manipulation, Data analysis, Data containers, Top
 @chapter Data manipulation
 
@@ -17705,10 +17888,9 @@ Even higher-level analysis is still needed to convert 
the observed magnitudes, s
 
 @menu
 * CosmicCalculator::            Calculate cosmological variables
-* Query::                       Import data from external databases
 @end menu
 
-@node CosmicCalculator, Query, High-level calculations, High-level calculations
+@node CosmicCalculator,  , High-level calculations, High-level calculations
 @section CosmicCalculator
 
 To derive higher-level information regarding our sources in extra-galactic 
astronomy, cosmological calculations are necessary.
@@ -18377,161 +18559,6 @@ In the latter (when a number is given), the returned 
value is the same units of
 
 
 
-@node Query,  , CosmicCalculator, High-level calculations
-@section Query
-
-There are many astronomical databases available for downloading astronomical 
data.
-Each has its own interface, which is usually very well documented in their own 
webpages.
-However, remembering the exact URLs and interface of each database is not 
easily possible and using the graphic web interface (which is commonly easier 
to use), is not an automatic process.
-
-Gnuastro's Query program is designed to address these problems: it has a 
common high-level interface for general operations that are common between its 
recognized databases.
-For example, importing a catalog of objects within a certain distance of a 
given coordinate.
-
-@menu
-* Invoking astquery::           Inputs, outputs and configuration of Query.
-@end menu
-
-@node Invoking astquery,  , Query, Query
-@subsection Invoking Query
-
-Query provides a high-level interface to downloading subsets of data from 
databases.
-The executable name is @file{astquery} with the following general template
-
-@example
-$ astquery [OPTION...] ...
-@end example
-
-@noindent
-One line examples:
-
-@example
-## Import all the columns of all entries in the Gaia DR2 catalog within
-## 20 arc-minutes of the given coordinate.
-$ astquery --database=gaia --dataset=dr2 --output=my-gaia.fits \
-           --center=113.8729761,31.9027152 --radius=20/60
-
-## Similar to above, but return all objects within a square box of
-## 30 arcminutes (can also be rectangular, see '--width').
-$ astquery --database=gaia --dataset=dr2 --output=my-gaia.fits \
-           --center=113.8729761,31.9027152 --width=30/60
-
-## Similar to first example, but only import the ID, RA, Dec and G-band
-## magnitude of the sources (not all the columns).
-$ astquery --database=gaia --dataset=dr2 --output=my-gaia.fits \
-           --center=113.8729761,31.9027152 --radius=0.1 \
-           --column=source_id,ra,dec,phot_g_mean_mag
-
-## Use a custom query to extract entries in the Gaia DR2 catalog.
-## The 'XXXX YYYY' can be a query of any size on the command-line.
-$ astquery --database=gaia --query="XXXX YYYY" --output=my-gaia.fits
-@end example
-
-Query doesn't take any input argument, because the main goal is to retreive 
data from external sources.
-The main input to Query is the @option{--database} option which specifies 
which database should be contacted for submitting the query.
-The name of the downloaded output file can optionally be set with 
@option{--output}.
-If @option{--output} is not set, an automatically generated name will be used.
-
-There are two methods to query the database: 1) with @option{--query} you can 
directly give a raw query statement that is recognized by the database, 2) with 
the @option{--center} and @option{--radius}, the low-level query will 
constructed automatically for the particular database.
-The former is very low level and will require some knowledge of the database's 
query language, but of course, it is much more powerful.
-The latter is much more limited in terms of capabilities (the only constraint 
is the location of the objects compared to the given center), but doesn't 
require any knowledge of the database's query language.
-
-@cartouche
-@noindent
-@strong{Under development, request for feedback:} Query is a new member of the 
Gnuastro family of programs.
-It currently requires that the @command{curl} executable (for the cURL 
downloading program) to be present on the host and the number of databases it 
supports is still limited, see the list under the @option{--database} option 
below.
-More downloader tools, and databases will be added in the near future as it is 
used more often, so please don't hesitate to suggest any that you may need.
-@end cartouche
-
-@table @option
-
-@item -d STR
-@itemx --database=STR
-Identifer for the database for sending the query.
-The current list of databases are listed here:
-
-@table @code
-@item gaia
-The Gaia project (@url{https://www.cosmos.esa.int/web/gaia}) database which is 
a large collection of star positions on the celestial sphere, as well as 
peculiar velocities, paralloxes and magnitudes in some bands among many others.
-Besides scientific studies (like studying resolved stellar populations in the 
Galaxy and its halo), Gaia is also invaluable for raw data calibrations, like 
astrometry.
-The query given to this database will be submitted to 
@code{https://gea.esac.esa.int/tap-server/tap/sync}.
-@end table
-
-@item -Q "STR"
-@itemx --query="STR"
-Directly specify the query to be passed onto the database.
-The queries will generally contain space and other meta-characters, so we 
recommend placing the query within quotations.
-
-@item -C FLT,FLT
-@itemx --center=FLT,FLT
-The center to use for the automatically generated query (not compatible with 
@option{--query}).
-All objects within a certain distance of the requested center position will be 
requested from the dataset.
-The distance can be specified with the @option{--radius} option.
-
-@item -r FLT
-@itemx --radius=FLT
-The radius about the requested center to use for the automatically generated 
query (not compatible with @option{--query}).
-The radius is in units of degrees, but you can use simple division with this 
option directly on the command-line.
-For example if you want a radius of 20 arc-minutes or 20 arc-seconds, you can 
use @option{--radius=20/60} or @option{--radius=20/3600} respectively (which is 
much more human-friendly than @code{0.3333} or @code{0.005556}).
-
-@item -w FLT[,FLT]
-@itemx --width=FLT[,FLT]
-The square (or rectangle) side length (width) about the requested center to 
use for the automatically generated query (not compatible with 
@option{--query}).
-If only one value is given to @code{--width} the region will be a square, but 
if two values are given, the widths of the query box along each dimension will 
be different.
-The value(s) is(are) in units of degrees, but you can use simple division for 
each value directly on the command-line, see the description of 
@option{--radius} for more on using division.
-
-
-
-@item -s STR
-@itemx --dataset=STR
-The dataset to query within the database for the automatically generated query 
(not compatible with @option{--query}).
-The reason for this is that many databases have different types of datasets, 
for example different data releases (DRs), or various high-level calculations 
on subsets of the database elements.
-For example when @option{--database=gaia}, you can set @option{--dataset=dr2} 
to only select objects within the second data release (DR2).
-
-You can either use the database's official name of the datasets, for example 
@code{gaiadr2.gaia_source} for the second data release of the Gaia database, or 
a simplified version that maps to it (@code{dr2}) for easy typing on the 
command-line.
-Below is a list of the simplified names for the databases that have them.
-
-@table @code
-@item gaia
-@itemize
-@item
-@code{dr2 --> gaiadr2.gaia_source}
-@item
-@code{dr2 --> gaiadr1.gaia_source}
-@item
-@code{tyco2 --> public.tyco2}
-@item
-@code{hipparcos --> public.hipparcos}
-@end itemize
-@end table
-
-@item -c STR
-@itemx --column=STR[,STR[,...]]
-The optional column name(s) to retrieve from the dataset in the automatically 
generated query (not compatible with @option{--query}).
-If not given, all the dataset's columns for the selected rows will be used 
(which can be large!).
-This option can take multiple values in one instance (for example 
@option{--column=ra,dec,mag}), or in multiple instances (for example 
@option{-cra -cdec -cmag}), or mixed (for example @option{-cra,dec -cmag}).
-
-In case, you don't know the full list of the dataset's column names, one 
solution is to run this program once without any @option{--column} and setting 
@option{--radius=0} (to have few, or no, rows and download fast).
-You can then inspect the column names with @ref{Table}.
-In case the database doesn't support a search radius of 0, or can't return a 
table with no rows, you can increase the radius.
-Here is an example on the Gaia DR2 catalog to show the full list of available 
columns:
-
-@example
-$ astquery --database=gaia --dataset=dr2 --center=0,0 \
-           --radius=0 --output=gaia-dr2-cols.fits
-$ asttable gaia-dr2-cols.fits --info
-@end example
-@end table
-
-
-
-
-
-
-
-
-
-
-
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]