gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master eb6eb77: Specific calculations in CosmicCalcul


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master eb6eb77: Specific calculations in CosmicCalculator
Date: Thu, 26 Oct 2017 12:05:17 -0400 (EDT)

branch: master
commit eb6eb77134fe613a1952efcae564da064289428c
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Specific calculations in CosmicCalculator
    
    Until now, only two specific calculations could be done in CosmicCalculator
    and they were only usable individually. But following the model of
    Gnuastro's Statistics program, it is now possible to ask for any of the
    calculations in any order and they will be printed in a single line (with
    one space character between them).
    
    Also, the option grouping enum has been moved to `ui.h' (from `ui.c') and
    their prefix was changed to `UI_GROUP' for the CosmicCalculator and
    Statistics programs. In the next commit, this will be done for all the
    programs. In the old system it wasn't immediately obvious where they are
    defined since they didn't follow the general naming convention.
---
 NEWS                            |  11 +++
 bin/cosmiccal/args.h            | 176 ++++++++++++++++++++++++++++++---
 bin/cosmiccal/astcosmiccal.conf |   1 -
 bin/cosmiccal/cosmiccal.c       | 205 +++++++++++++++++++++++++++++++--------
 bin/cosmiccal/main.h            |   8 +-
 bin/cosmiccal/ui.c              |  95 +++++++++++++++++-
 bin/cosmiccal/ui.h              |  43 ++++++--
 bin/statistics/args.h           |  76 +++++++--------
 bin/statistics/ui.c             |  15 +--
 bin/statistics/ui.h             |  17 ++++
 doc/gnuastro.texi               | 210 +++++++++++++++++++++++++++++++---------
 11 files changed, 686 insertions(+), 171 deletions(-)

diff --git a/NEWS b/NEWS
index d297e62..eb0a522 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,14 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   BuildProgram: The new `--la' option allows the identification of a
   different Libtool `.la' file for Libtool linking information.
 
+  CosmicCalculator: all the various cosmological calculations can now be
+  requested individually in one line with a specific option added for each
+  calculation (for example `--age' or `--luminositydist' for the age of the
+  universe at a given redshift or the luminosity distance). Therefore the
+  old `--onlyvolume' and `--onlyabsmagconv' options are now removed. To
+  effectively use these new features, please review the "Invoking
+  CosmicCalculator" section of the book.
+
   Fits: when an extension/HDU is identified on the command-line with the
   `--hdu' option and no operation is requested, the full list of header
   keywords in that HDU will be printed (as if only `--printallkeys' was
@@ -74,6 +82,9 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 
 ** Changed features
 
+  CosmicCalculator: The redshift is no longer mandatory. When no redshift
+  is given, it will only print the input parameters (cosmology) and abort.
+
   `gal_binary_fill_holes' now accepts a `connectivity' and `maxsize'
   argument to specify the connectivity of the holes and the maximum size of
   acceptable holes to fill.
diff --git a/bin/cosmiccal/args.h b/bin/cosmiccal/args.h
index f6acd38..46d4bfd 100644
--- a/bin/cosmiccal/args.h
+++ b/bin/cosmiccal/args.h
@@ -41,7 +41,7 @@ struct argp_option program_options[] =
       &p->redshift,
       GAL_TYPE_FLOAT64,
       GAL_OPTIONS_RANGE_GE_0,
-      GAL_OPTIONS_MANDATORY,
+      GAL_OPTIONS_NOT_MANDATORY,
       GAL_OPTIONS_NOT_SET
     },
     {
@@ -101,34 +101,178 @@ struct argp_option program_options[] =
 
 
     {
-      "onlyvolume",
-      UI_KEY_ONLYVOLUME,
+      0, 0, 0, 0,
+      "Single row calculations",
+      UI_GROUP_SPECIFIC
+    },
+    {
+      "agenow",
+      UI_KEY_AGENOW,
       0,
       0,
-      "Only print comoving volume in Mpc^3.",
-      GAL_OPTIONS_GROUP_OUTPUT,
-      &p->onlyvolume,
+      "Age of universe now (Gyr).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
       GAL_OPTIONS_NOT_MANDATORY,
-      GAL_OPTIONS_NOT_SET
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
     },
     {
-      "onlyabsmagconv",
-      UI_KEY_ONLYABSMAGCONV,
+      "criticaldensitynow",
+      UI_KEY_CRITICALDENSITYNOW,
       0,
       0,
-      "Only print conversion to absolute magnitude.",
-      GAL_OPTIONS_GROUP_OUTPUT,
-      &p->onlyabsmagconv,
+      "Critical density now (g/cm^3).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
       GAL_OPTIONS_NOT_MANDATORY,
-      GAL_OPTIONS_NOT_SET
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
+    },
+    {
+      "properdistance",
+      UI_KEY_PROPERDISTANCE,
+      0,
+      0,
+      "Proper distance to z (Mpc).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
+    },
+    {
+      "angulardimdist",
+      UI_KEY_ANGULARDIMDIST,
+      0,
+      0,
+      "Angular diameter distance (Mpc).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
+    },
+    {
+      "arcsectandist",
+      UI_KEY_ARCSECTANDIST,
+      0,
+      0,
+      "Tangential dist. covered by 1arcsec at z (kpc).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
+    },
+    {
+      "luminositydist",
+      UI_KEY_LUMINOSITYDIST,
+      0,
+      0,
+      "Luminosity distance to z (Mpc).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
+    },
+    {
+      "distancemodulus",
+      UI_KEY_DISTANCEMODULUS,
+      0,
+      0,
+      "Distance modulus at z (no units).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
+    },
+    {
+      "absmagconv",
+      UI_KEY_ABSMAGCONV,
+      0,
+      0,
+      "Conversion to absolute magnitude (no unit).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
+    },
+    {
+      "age",
+      UI_KEY_AGE,
+      0,
+      0,
+      "Age of universe at z (Gyr).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
+    },
+    {
+      "lookbacktime",
+      UI_KEY_LOOKBACKTIME,
+      0,
+      0,
+      "Look back time to z (Gyr).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
+    },
+    {
+      "criticaldensity",
+      UI_KEY_CRITICALDENSITY,
+      0,
+      0,
+      "Critical density at z (g/cm^3).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
+    },
+    {
+      "volume",
+      UI_KEY_VOLUME,
+      0,
+      0,
+      "Comoving volume (4pi str) to z (Mpc^3).",
+      UI_GROUP_SPECIFIC,
+      &p->specific,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_add_to_single_value,
     },
-
-
-
 
 
     {0}
diff --git a/bin/cosmiccal/astcosmiccal.conf b/bin/cosmiccal/astcosmiccal.conf
index 485a128..bac2d94 100644
--- a/bin/cosmiccal/astcosmiccal.conf
+++ b/bin/cosmiccal/astcosmiccal.conf
@@ -31,7 +31,6 @@
 # change this comment and cite the source.
 
 # Input:
- redshift            1
  H0              67.74
  olambda        0.6911
  omatter        0.3089
diff --git a/bin/cosmiccal/cosmiccal.c b/bin/cosmiccal/cosmiccal.c
index e1755fa..1350239 100644
--- a/bin/cosmiccal/cosmiccal.c
+++ b/bin/cosmiccal/cosmiccal.c
@@ -24,12 +24,15 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 #include <math.h>
 #include <stdio.h>
+#include <errno.h>
+#include <error.h>
 #include <stdlib.h>
 
 #include <gnuastro/cosmology.h>
 
 #include "main.h"
 
+#include "ui.h"
 #include "cosmiccal.h"
 
 
@@ -45,30 +48,33 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 /**************************************************************/
 /************            Main function            *************/
 /**************************************************************/
-void
-cosmiccal(struct cosmiccalparams *p)
+static void
+cosmiccal_print_input(struct cosmiccalparams *p)
+{
+  printf("%s\n", PROGRAM_STRING);
+  printf("\n Input parameters\n");
+  printf(  " ----------------\n");
+  if( !isnan(p->redshift) )
+    printf(FLTFORMAT, "Desired redshift for calculations (z):", p->redshift);
+  printf(FLTFORMAT, "Expansion rate (Hubble constant, H0), now:", p->H0);
+  printf(FLTFORMAT, "Cosmological constant fractional density, now:",
+         p->olambda);
+  printf(FLTFORMAT, "Matter fractional density, now:", p->omatter);
+  printf(EXPFORMAT, "Radiation fractional density, now:", p->oradiation);
+  printf(EXPFORMAT, "Curvatue fractional density (from the above):",
+         1 - ( p->olambda + p->omatter + p->oradiation ));
+}
+
+
+
+
+
+static void
+cosmiccal_printall(struct cosmiccalparams *p)
 {
   double ad, ld, vz, pd, absmagconv;
   double curage, ccritd, distmod, outage, zcritd;
 
-  /* In case the user just wants one number, only print that and
-     return. */
-  if(p->onlyvolume){
-    printf("%f\n", gal_cosmology_comoving_volume(p->redshift, p->H0,
-                                                 p->olambda, p->omatter,
-                                                 p->oradiation));
-    return;
-  }
-  if(p->onlyabsmagconv){
-    pd=gal_cosmology_proper_distance(p->redshift, p->H0, p->olambda,
-                                     p->omatter, p->oradiation);
-    ld=pd*(1+p->redshift);
-    distmod=5*(log10(ld*1000000)-1);
-    absmagconv=distmod-2.5*log10(1+p->redshift);
-    printf("%f\n", absmagconv);
-    return;
-  }
-
   /* The user wants everything, do all the calculations and print
      everything with full descriptions. */
   curage=gal_cosmology_age(0.0f, p->H0, p->olambda, p->omatter,
@@ -77,20 +83,11 @@ cosmiccal(struct cosmiccalparams *p)
   ccritd=gal_cosmology_critical_density(0.0f, p->H0, p->olambda, p->omatter,
                                         p->oradiation);
 
-  vz=gal_cosmology_comoving_volume(p->redshift, p->H0, p->olambda, p->omatter,
-                                   p->oradiation);
-
   pd=gal_cosmology_proper_distance(p->redshift, p->H0, p->olambda, p->omatter,
                                    p->oradiation);
 
-  outage=gal_cosmology_age(p->redshift, p->H0, p->olambda, p->omatter,
-                           p->oradiation);
-
-  zcritd=gal_cosmology_critical_density(p->redshift, p->H0, p->olambda,
-                                        p->omatter, p->oradiation);
-
-  ad=gal_cosmology_angular_distance(p->redshift, p->H0, p->olambda, p->omatter,
-                                    p->oradiation);
+  ad=gal_cosmology_angular_distance(p->redshift, p->H0, p->olambda,
+                                    p->omatter, p->oradiation);
 
   ld=gal_cosmology_luminosity_distance(p->redshift, p->H0, p->olambda,
                                        p->omatter, p->oradiation);
@@ -101,18 +98,17 @@ cosmiccal(struct cosmiccalparams *p)
   absmagconv=gal_cosmology_to_absolute_mag(p->redshift, p->H0, p->olambda,
                                            p->omatter, p->oradiation);
 
+  outage=gal_cosmology_age(p->redshift, p->H0, p->olambda, p->omatter,
+                           p->oradiation);
+
+  zcritd=gal_cosmology_critical_density(p->redshift, p->H0, p->olambda,
+                                        p->omatter, p->oradiation);
+
+  vz=gal_cosmology_comoving_volume(p->redshift, p->H0, p->olambda, p->omatter,
+                                   p->oradiation);
+
   /* Print out results: */
-  printf("%s\n", PROGRAM_STRING);
-  printf("\n Input parameters\n");
-  printf(  " ----------------\n");
-  printf(FLTFORMAT, "Desired redshift for calculations (z):", p->redshift);
-  printf(FLTFORMAT, "Expansion rate (Hubble constant, H0), now:", p->H0);
-  printf(FLTFORMAT, "Cosmological constant fractional density, now:",
-         p->olambda);
-  printf(FLTFORMAT, "Matter fractional density, now:", p->omatter);
-  printf(EXPFORMAT, "Radiation fractional density, now:", p->oradiation);
-  printf(EXPFORMAT, "Curvatue fractional density (from the above):",
-         1 - ( p->olambda + p->omatter + p->oradiation ));
+  cosmiccal_print_input(p);
 
 
   printf("\n\n Universe now\n");
@@ -139,3 +135,128 @@ cosmiccal(struct cosmiccalparams *p)
   printf(    " ------------------------------------\n");
   printf(FLTFORMAT, "Comoving volume over 4pi stradian to z (Mpc^3):", vz);
 }
+
+
+
+
+
+void
+cosmiccal(struct cosmiccalparams *p)
+{
+  gal_list_i32_t *tmp;
+  double curage, zage;
+
+  /* If no redshift is given, just print the input parameters along with a
+     notice that further calculations are only possible with a redshift and
+     abort. */
+  if(isnan(p->redshift))
+    {
+      cosmiccal_print_input(p);
+      printf("\n\nPlease specify a redshift with the `--redshift' (or `-z') "
+             "option.\n");
+      return;
+    }
+
+  /* In case the user just wants one number, only print that and
+     return. */
+  if(p->specific)
+    {
+      for(tmp=p->specific;tmp!=NULL;tmp=tmp->next)
+        switch(tmp->v)
+          {
+          case UI_KEY_AGENOW:
+            printf("%f ", gal_cosmology_age(0.0f, p->H0, p->olambda,
+                                            p->omatter, p->oradiation));
+            break;
+
+          case UI_KEY_CRITICALDENSITYNOW:
+            printf("%e ", gal_cosmology_critical_density(0.0f, p->H0,
+                                                         p->olambda,
+                                                         p->omatter,
+                                                         p->oradiation));
+            break;
+
+          case UI_KEY_PROPERDISTANCE:
+            printf("%f ", gal_cosmology_proper_distance(p->redshift, p->H0,
+                                                        p->olambda,
+                                                        p->omatter,
+                                                        p->oradiation));
+            break;
+
+          case UI_KEY_ANGULARDIMDIST:
+            printf("%f ", gal_cosmology_angular_distance(p->redshift, p->H0,
+                                                         p->olambda,
+                                                         p->omatter,
+                                                         p->oradiation));
+            break;
+
+          case UI_KEY_ARCSECTANDIST:
+            printf("%f ", ( gal_cosmology_angular_distance(p->redshift, p->H0,
+                                                           p->olambda,
+                                                           p->omatter,
+                                                           p->oradiation)
+                            * 1000 * M_PI / 3600 / 180 ) );
+            break;
+
+          case UI_KEY_LUMINOSITYDIST:
+            printf("%f ", gal_cosmology_luminosity_distance(p->redshift,
+                                                            p->H0,
+                                                            p->olambda,
+                                                            p->omatter,
+                                                            p->oradiation));
+            break;
+
+          case UI_KEY_DISTANCEMODULUS:
+            printf("%f ", gal_cosmology_distance_modulus(p->redshift, p->H0,
+                                                         p->olambda,
+                                                         p->omatter,
+                                                         p->oradiation));
+            break;
+
+          case UI_KEY_ABSMAGCONV:
+            printf("%f ", gal_cosmology_to_absolute_mag(p->redshift, p->H0,
+                                                        p->olambda,
+                                                        p->omatter,
+                                                        p->oradiation));
+            break;
+
+          case UI_KEY_AGE:
+            printf("%f ", gal_cosmology_age(p->redshift, p->H0, p->olambda,
+                                            p->omatter, p->oradiation));
+            break;
+
+          case UI_KEY_LOOKBACKTIME:
+            curage=gal_cosmology_age(0.0f, p->H0, p->olambda, p->omatter,
+                                     p->oradiation);
+            zage=gal_cosmology_age(p->redshift, p->H0, p->olambda, p->omatter,
+                                   p->oradiation);
+            printf("%f ", curage-zage);
+            break;
+
+          case UI_KEY_CRITICALDENSITY:
+            printf("%e ", gal_cosmology_critical_density(p->redshift, p->H0,
+                                                         p->olambda,
+                                                         p->omatter,
+                                                         p->oradiation));
+            break;
+
+          case UI_KEY_VOLUME:
+            printf("%f ", gal_cosmology_comoving_volume(p->redshift, p->H0,
+                                                        p->olambda,
+                                                        p->omatter,
+                                                        p->oradiation));
+            break;
+
+          default:
+            error(EXIT_FAILURE, 0, "%s: a bug! Please contact us at %s to "
+                  "fix the problem. The code %d is not recognized as a "
+                  "single value calculation code", __func__,
+                  PACKAGE_BUGREPORT, tmp->v);
+          }
+
+      /* Print a new-line character to finish the output. */
+      printf("\n");
+    }
+  else
+    cosmiccal_printall(p);
+}
diff --git a/bin/cosmiccal/main.h b/bin/cosmiccal/main.h
index b8a04c7..df918c8 100644
--- a/bin/cosmiccal/main.h
+++ b/bin/cosmiccal/main.h
@@ -25,7 +25,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 /* Include necessary headers */
 #include <gnuastro/data.h>
-
+#include <gnuastro/list.h>
 #include <gnuastro-internal/options.h>
 
 /* Progarm names.  */
@@ -51,11 +51,9 @@ struct cosmiccalparams
   double               olambda; /* Current cosmological constant dens.  */
   double               omatter; /* Current matter density.              */
   double            oradiation; /* Current radiation density.           */
-  double            solidangle; /* Solid angle for volume (in stradian).*/
 
-  /* Output: */
-  uint8_t           onlyvolume; /* Only print the volume in Mpc^3.      */
-  uint8_t       onlyabsmagconv; /* Only print conversion to abs. mag.   */
+  /* Outputs. */
+  gal_list_i32_t     *specific; /* Codes for single row calculations.   */
 
   /* Internal: */
   time_t               rawtime; /* Starting time of the program.        */
diff --git a/bin/cosmiccal/ui.c b/bin/cosmiccal/ui.c
index 0e697a6..00ba91e 100644
--- a/bin/cosmiccal/ui.c
+++ b/bin/cosmiccal/ui.c
@@ -63,7 +63,10 @@ args_doc[] = "";
 
 const char
 doc[] = GAL_STRINGS_TOP_HELP_INFO PROGRAM_NAME" will do cosmological "
-  "calculations.\n"
+  "calculations. If no redshfit is specified, it will only print the main "
+  "input parameters. If only a redshift is given, it will print a table of "
+  "all calculations. If any of the single row calculations are requested, "
+  "only their values will be printed with a single space between each.\n"
   GAL_STRINGS_MORE_HELP_INFO
   /* After the list of options: */
   "\v"
@@ -107,17 +110,33 @@ ui_initialize_options(struct cosmiccalparams *p,
   cp->program_authors    = PROGRAM_AUTHORS;
   cp->coptions           = gal_commonopts_options;
 
+  /* Program specific initializations. */
+  p->redshift            = NAN;
+
   /* Modify the common options. */
   for(i=0; !gal_options_is_last(&cp->coptions[i]); ++i)
     {
       /* Select by group. */
       switch(cp->coptions[i].group)
         {
+        case GAL_OPTIONS_GROUP_OUTPUT:
         case GAL_OPTIONS_GROUP_TESSELLATION:
           cp->coptions[i].doc=NULL; /* Necessary to remove title. */
           cp->coptions[i].flags=OPTION_HIDDEN;
           break;
         }
+
+      /* Select specific options. */
+      switch(cp->coptions[i].key)
+        {
+        case GAL_OPTIONS_KEY_HDU:
+        case GAL_OPTIONS_KEY_TYPE:
+        case GAL_OPTIONS_KEY_SEARCHIN:
+        case GAL_OPTIONS_KEY_IGNORECASE:
+        case GAL_OPTIONS_KEY_TABLEFORMAT:
+          cp->coptions[i].flags=OPTION_HIDDEN;
+          break;
+        }
     }
 }
 
@@ -169,6 +188,45 @@ parse_opt(int key, char *arg, struct argp_state *state)
 
 
 
+static void *
+ui_add_to_single_value(struct argp_option *option, char *arg,
+                      char *filename, size_t lineno, void *params)
+{
+  /* In case of printing the option values. */
+  if(lineno==-1)
+    error(EXIT_FAILURE, 0, "currently the options to be printed in one row "
+          "(like `--age', `--luminositydist', and etc) do not support "
+          "printing with the `--printparams' (`-P'), or writing into "
+          "configuration files due to lack of time when implementing "
+          "these features. You can put them into configuration files "
+          "manually. Please get in touch with us at `%s', so we can "
+          "implement it", PACKAGE_BUGREPORT);
+
+  /* If this option is given in a configuration file, then `arg' will not
+     be NULL and we don't want to do anything if it is `0'. */
+  if(arg)
+    {
+      /* Make sure the value is only `0' or `1'. */
+      if( arg[1]!='\0' && *arg!='0' && *arg!='1' )
+        error_at_line(EXIT_FAILURE, 0, filename, lineno, "the `--%s' "
+                      "option takes no arguments. In a configuration "
+                      "file it can only have the values `1' or `0', "
+                      "indicating if it should be used or not",
+                      option->name);
+
+      /* Only proceed if the (possibly given) argument is 1. */
+      if(arg[0]=='0' && arg[1]=='\0') return NULL;
+    }
+
+  /* Add this option to the print list and return. */
+  gal_list_i32_add(option->value, option->key);
+  return NULL;
+}
+
+
+
+
+
 
 
 
@@ -223,6 +281,36 @@ ui_read_check_only_options(struct cosmiccalparams *p)
 
 
 /**************************************************************/
+/***************       Preparations         *******************/
+/**************************************************************/
+static void
+ui_preparations(struct cosmiccalparams *p)
+{
+  /* The list is filled out in a first-in-last-out order. By the time
+     control reaches here, the list is finalized. So we should just reverse
+     it so the user gets values in the same order they requested them. */
+  gal_list_i32_reverse(&p->specific);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/**************************************************************/
 /************         Set the parameters          *************/
 /**************************************************************/
 
@@ -242,7 +330,6 @@ ui_read_check_inputs_setup(int argc, char *argv[], struct 
cosmiccalparams *p)
 #include <gnuastro-internal/commonopts.h>
 #include "args.h"
 
-
   /* Initialize the options and necessary information.  */
   ui_initialize_options(p, program_options, gal_commonopts_options);
 
@@ -266,4 +353,8 @@ ui_read_check_inputs_setup(int argc, char *argv[], struct 
cosmiccalparams *p)
      after the option checks so un-sane values are not printed in the
      output state. */
   gal_options_print_state(&p->cp);
+
+
+  /* Read/allocate all the necessary starting arrays. */
+  ui_preparations(p);
 }
diff --git a/bin/cosmiccal/ui.h b/bin/cosmiccal/ui.h
index 0090fd8..3ab8732 100644
--- a/bin/cosmiccal/ui.h
+++ b/bin/cosmiccal/ui.h
@@ -23,26 +23,49 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #ifndef UI_H
 #define UI_H
 
+/* For common options groupings. */
+#include <gnuastro-internal/options.h>
+
+
+
+
+
+/* Option groups particular to this program. */
+enum program_args_groups
+{
+  UI_GROUP_SPECIFIC = GAL_OPTIONS_GROUP_AFTER_COMMON,
+};
+
 
 
 
 
 /* Available letters for short options:
 
-   b c d e f g i j k n p s t u w x y
-   A B C E G J L O Q R W X Y
+   e f i j k n p t w x y
+   B E J O Q R W X Y
 */
 enum option_keys_enum
 {
   /* With short-option version. */
-  UI_KEY_REDSHIFT       = 'z',
-  UI_KEY_H0             = 'H',
-  UI_KEY_OLAMBDA        = 'l',
-  UI_KEY_OMATTER        = 'm',
-  UI_KEY_ORADIATION     = 'r',
-  UI_KEY_ONLYVOLUME     = 'v',
-  UI_KEY_ONLYABSMAGCONV = 'a',
-
+  UI_KEY_REDSHIFT            = 'z',
+  UI_KEY_H0                  = 'H',
+  UI_KEY_OLAMBDA             = 'l',
+  UI_KEY_OMATTER             = 'm',
+  UI_KEY_ORADIATION          = 'r',
+
+  UI_KEY_AGENOW              = 'G',
+  UI_KEY_CRITICALDENSITYNOW  = 'C',
+  UI_KEY_PROPERDISTANCE      = 'd',
+  UI_KEY_ANGULARDIMDIST      = 'A',
+  UI_KEY_ARCSECTANDIST       = 's',
+  UI_KEY_LUMINOSITYDIST      = 'L',
+  UI_KEY_DISTANCEMODULUS     = 'u',
+  UI_KEY_ABSMAGCONV          = 'a',
+  UI_KEY_AGE                 = 'g',
+  UI_KEY_LOOKBACKTIME        = 'b',
+  UI_KEY_CRITICALDENSITY     = 'c',
+  UI_KEY_VOLUME              = 'v',
 
   /* Only with long version (start with a value 1000, the rest will be set
      automatically). */
diff --git a/bin/statistics/args.h b/bin/statistics/args.h
index 32c558c..12cfc2d 100644
--- a/bin/statistics/args.h
+++ b/bin/statistics/args.h
@@ -121,7 +121,7 @@ struct argp_option program_options[] =
     {
       0, 0, 0, 0,
       "Single value measurements",
-      ARGS_GROUP_SINGLE_VALUE
+      UI_GROUP_SINGLE_VALUE
     },
     {
       "number",
@@ -129,7 +129,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Number (non-blank).",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_ANY,
@@ -143,7 +143,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Minimum.",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -157,7 +157,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Maximum.",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -171,7 +171,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Sum.",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -185,7 +185,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Mean.",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -199,7 +199,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Standad deviation.",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -213,7 +213,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Median.",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -227,7 +227,7 @@ struct argp_option program_options[] =
       "FLT[,...]",
       0,
       "Quantile (multiple values acceptable).",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_TYPE_FLOAT32,
       GAL_OPTIONS_RANGE_GE_0_LE_1,
@@ -241,7 +241,7 @@ struct argp_option program_options[] =
       "FLT[,...]",
       0,
       "Quantile function (multiple values acceptable).",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_TYPE_FLOAT32,
       GAL_OPTIONS_RANGE_GE_0_LE_1,
@@ -255,7 +255,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Mode (Appendix C of arXiv:1505.01664).",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -269,7 +269,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Mode quantile (see --mode)",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -283,7 +283,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Mode symmetricity (see --mode).",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -297,7 +297,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Value at mode symmetricity (see --mode).",
-      ARGS_GROUP_SINGLE_VALUE,
+      UI_GROUP_SINGLE_VALUE,
       &p->singlevalue,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -312,7 +312,7 @@ struct argp_option program_options[] =
     {
       0, 0, 0, 0,
       "Particular calculation",
-      ARGS_GROUP_PARTICULAR_STAT
+      UI_GROUP_PARTICULAR_STAT
     },
     {
       "asciihist",
@@ -320,7 +320,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Print an ASCII histogram.",
-      ARGS_GROUP_PARTICULAR_STAT,
+      UI_GROUP_PARTICULAR_STAT,
       &p->asciihist,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -333,7 +333,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Print an ASCII cumulative frequency plot.",
-      ARGS_GROUP_PARTICULAR_STAT,
+      UI_GROUP_PARTICULAR_STAT,
       &p->asciicfp,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -346,7 +346,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Save the histogram in output.",
-      ARGS_GROUP_PARTICULAR_STAT,
+      UI_GROUP_PARTICULAR_STAT,
       &p->histogram,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -359,7 +359,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Save the cumulative frequency plot in output.",
-      ARGS_GROUP_PARTICULAR_STAT,
+      UI_GROUP_PARTICULAR_STAT,
       &p->cumulative,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -372,7 +372,7 @@ struct argp_option program_options[] =
       "FLT",
       0,
       "Save the histogram and CFP of the mirror dist.",
-      ARGS_GROUP_PARTICULAR_STAT,
+      UI_GROUP_PARTICULAR_STAT,
       &p->mirror,
       GAL_TYPE_FLOAT64,
       GAL_OPTIONS_RANGE_ANY,
@@ -385,7 +385,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Single values on separate tiles, not full input.",
-      ARGS_GROUP_PARTICULAR_STAT,
+      UI_GROUP_PARTICULAR_STAT,
       &p->ontile,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -398,7 +398,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Find the Sky and its STD over the tessellation.",
-      ARGS_GROUP_PARTICULAR_STAT,
+      UI_GROUP_PARTICULAR_STAT,
       &p->sky,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -411,7 +411,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Overall sigma-clipping (see `--sclipparams')",
-      ARGS_GROUP_PARTICULAR_STAT,
+      UI_GROUP_PARTICULAR_STAT,
       &p->sigmaclip,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -426,7 +426,7 @@ struct argp_option program_options[] =
     {
       0, 0, 0, 0,
       "Sky and Sky STD settings",
-      ARGS_GROUP_SKY
+      UI_GROUP_SKY
     },
     {
       "kernel",
@@ -434,7 +434,7 @@ struct argp_option program_options[] =
       "STR",
       0,
       "File name of kernel to convolve input.",
-      ARGS_GROUP_SKY,
+      UI_GROUP_SKY,
       &p->kernelname,
       GAL_TYPE_STRING,
       GAL_OPTIONS_RANGE_ANY,
@@ -447,7 +447,7 @@ struct argp_option program_options[] =
       "STR",
       0,
       "HDU/extension name or number of kernel.",
-      ARGS_GROUP_SKY,
+      UI_GROUP_SKY,
       &p->khdu,
       GAL_TYPE_STRING,
       GAL_OPTIONS_RANGE_ANY,
@@ -460,7 +460,7 @@ struct argp_option program_options[] =
       "FLT",
       0,
       "Max. distance (error multip.) to find mode.",
-      ARGS_GROUP_SKY,
+      UI_GROUP_SKY,
       &p->mirrordist,
       GAL_TYPE_FLOAT32,
       GAL_OPTIONS_RANGE_ANY,
@@ -473,7 +473,7 @@ struct argp_option program_options[] =
       "FLT",
       0,
       "Max. mode and median quantile diff. per tile.",
-      ARGS_GROUP_SKY,
+      UI_GROUP_SKY,
       &p->modmedqdiff,
       GAL_TYPE_FLOAT32,
       GAL_OPTIONS_RANGE_GE_0,
@@ -486,7 +486,7 @@ struct argp_option program_options[] =
       "FLT,FLT",
       0,
       "Sigma clip: Multiple, and tolerance/number.",
-      ARGS_GROUP_SKY,
+      UI_GROUP_SKY,
       p->sclipparams,
       GAL_TYPE_STRING,
       GAL_OPTIONS_RANGE_ANY,
@@ -500,7 +500,7 @@ struct argp_option program_options[] =
       "INT",
       0,
       "Sky: flat kernel width to smooth interpolated.",
-      ARGS_GROUP_SKY,
+      UI_GROUP_SKY,
       &p->smoothwidth,
       GAL_TYPE_SIZE_T,
       GAL_OPTIONS_RANGE_0_OR_ODD,
@@ -513,7 +513,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Store steps in `_sky_steps.fits' file.",
-      ARGS_GROUP_SKY,
+      UI_GROUP_SKY,
       &p->checksky,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
@@ -527,7 +527,7 @@ struct argp_option program_options[] =
     {
       0, 0, 0, 0,
       "Histogram and CFP settings",
-      ARGS_GROUP_HIST_CFP
+      UI_GROUP_HIST_CFP
     },
     {
       "numbins",
@@ -535,7 +535,7 @@ struct argp_option program_options[] =
       "INT",
       0,
       "No. of bins in histogram or CFP tables.",
-      ARGS_GROUP_HIST_CFP,
+      UI_GROUP_HIST_CFP,
       &p->numbins,
       GAL_TYPE_SIZE_T,
       GAL_OPTIONS_RANGE_GT_0,
@@ -548,7 +548,7 @@ struct argp_option program_options[] =
       "INT",
       0,
       "No. of bins in ASCII histogram or CFP plots.",
-      ARGS_GROUP_HIST_CFP,
+      UI_GROUP_HIST_CFP,
       &p->numasciibins,
       GAL_TYPE_SIZE_T,
       GAL_OPTIONS_RANGE_GT_0,
@@ -561,7 +561,7 @@ struct argp_option program_options[] =
       "INT",
       0,
       "Height of ASCII histogram or CFP plots.",
-      ARGS_GROUP_HIST_CFP,
+      UI_GROUP_HIST_CFP,
       &p->asciiheight,
       GAL_TYPE_SIZE_T,
       GAL_OPTIONS_RANGE_GT_0,
@@ -574,7 +574,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Set sum of all bins to 1.",
-      ARGS_GROUP_HIST_CFP,
+      UI_GROUP_HIST_CFP,
       &p->normalize,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_GT_0,
@@ -587,7 +587,7 @@ struct argp_option program_options[] =
       0,
       0,
       "Scale such that the maximum bin has value of one.",
-      ARGS_GROUP_HIST_CFP,
+      UI_GROUP_HIST_CFP,
       &p->maxbinone,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_GT_0,
@@ -600,7 +600,7 @@ struct argp_option program_options[] =
       "FLT",
       0,
       "Shift bins so one bin starts on this value.",
-      ARGS_GROUP_HIST_CFP,
+      UI_GROUP_HIST_CFP,
       &p->onebinstart,
       GAL_TYPE_FLOAT32,
       GAL_OPTIONS_RANGE_ANY,
diff --git a/bin/statistics/ui.c b/bin/statistics/ui.c
index d1a9de9..cc6f0b6 100644
--- a/bin/statistics/ui.c
+++ b/bin/statistics/ui.c
@@ -38,7 +38,6 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <gnuastro/statistics.h>
 
 #include <gnuastro-internal/timing.h>
-#include <gnuastro-internal/options.h>
 #include <gnuastro-internal/checkset.h>
 #include <gnuastro-internal/tableintern.h>
 #include <gnuastro-internal/fixedstringmacros.h>
@@ -85,14 +84,7 @@ doc[] = GAL_STRINGS_TOP_HELP_INFO PROGRAM_NAME" will do 
statistical "
 
 
 
-/* Option groups particular to this program. */
-enum program_args_groups
-{
-  ARGS_GROUP_SINGLE_VALUE = GAL_OPTIONS_GROUP_AFTER_COMMON,
-  ARGS_GROUP_PARTICULAR_STAT,
-  ARGS_GROUP_SKY,
-  ARGS_GROUP_HIST_CFP,
-};
+
 
 
 
@@ -225,8 +217,9 @@ ui_add_to_single_value(struct argp_option *option, char 
*arg,
           "(like `--number', `--mean', and etc) do not support printing "
           "with the `--printparams' (`-P'), or writing into configuration "
           "files due to lack of time when implementing these features. "
-          "Please get in touch with us at `%s', so we can implement it if "
-          "it is possible now, thank you", PACKAGE_BUGREPORT);
+          "You can put them into configuration files manually. Please get "
+          "in touch with us at `%s', so we can implement it",
+          PACKAGE_BUGREPORT);
 
   /* Some of these options take values and some don't. */
   if(option->type==GAL_OPTIONS_NO_ARG_TYPE)
diff --git a/bin/statistics/ui.h b/bin/statistics/ui.h
index d81efa4..14bdfca 100644
--- a/bin/statistics/ui.h
+++ b/bin/statistics/ui.h
@@ -24,6 +24,23 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #define UI_H
 
 
+/* For common options groupings. */
+#include <gnuastro-internal/options.h>
+
+
+
+
+
+/* Option groups particular to this program. */
+enum program_args_groups
+{
+  UI_GROUP_SINGLE_VALUE = GAL_OPTIONS_GROUP_AFTER_COMMON,
+  UI_GROUP_PARTICULAR_STAT,
+  UI_GROUP_SKY,
+  UI_GROUP_HIST_CFP,
+};
+
+
 
 
 
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index ce5e533..a4357b0 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -514,6 +514,11 @@ CosmicCalculator
 * Extending distance concepts to 3D::  Going to 3D (our real universe).
 * Invoking astcosmiccal::       How to run CosmicCalculator
 
+Invoking CosmicCalculator
+
+* CosmicCalculator input options::  Options to specify input conditions.
+* CosmicCalculator specific calculations::  Requesting specific outputs.
+
 Library
 
 * Review of library fundamentals::  Guide on libraries and linking.
@@ -16421,50 +16426,42 @@ One line examples:
 $ astcosmiccal -z2.5
 
 ## Only print Comoving volume over 4pi stradian to z (Mpc^3):
-$ astcosmiccal --onlyvolume --redshift=0.8
+$ astcosmiccal --redshift=0.8 --volume
+
+## Print luminosity distance, angular diameter distance and age
+## of universe in one row at redshift 0.4
+$ astcosmiccal -z0.4 -LAg
 
 ## Assume Lambda and matter density of 0.7 and 0.3 and print
 ## basic cosmological parameters for redshift 2.1:
 $ astcosmiccal -l0.7 -m0.3 -z2.1
 @end example
 
-The input parameters can be given as command-line options or in the
-configuration files, see @ref{Configuration files}. For a definition
-of the different parameters, please see the sections prior to this. By
-default, all the cosmological calculations will be printed in the
-standard output (the command-line mainly) along with a short
-description and units.
-
-The options starting with @option{--only} will only do that single
-desired calculation and only print the final number (in the same units
-as reported by default). These options are very useful when you want
-to call CosmicCalculator from a script. The resulting number can
-simply be put into a shell variable (for example @code{vol}) with the
-following line, which will allow you to use the value for any other
-subsequent operation.
-
address@hidden
-z=3.12
-vol=$(astcosmiccal --redshift=$z --onlyvolume)
address@hidden example
+The input parameters (for example current matter density and etc) can be
+given as command-line options or in the configuration files, see
address@hidden files}. For a definition of the different parameters,
+please see the sections prior to this. If no redshift is given,
+CosmicCalculator will just print its input parameters and abort. For a full
+list of the input options, please see @ref{CosmicCalculator input options}.
+
+When only a redshift is given, CosmicCalculator will print all calculations
+(one per line) with some explanations before each. This can be good when
+you want a general feeling of the conditions at a specific
+redshift. Alternatively, if any specific calculations are requested, only
+the requested values will be calculated and printed with one character
+space between them. In this case, no description will be printed. See
address@hidden specific calculations} for the full list of these
+options along with some explanations how when/how they can be useful.
 
address@hidden GNU Grep
address@hidden
-In a script, this operation might be necessary for a very large number
-of objects (thousands of galaxies in a catalog for example). So the
-fact that all the other default calculations are ignored will also
-help you get to your result faster. If you just want to inspect the
-value of a variable, the description (which comes with units) might be
-more useful. In that case, the following command might be better. The
-other parameters will also be calculated, but they are so fast that
-you will not notice on modern computers.
address@hidden
+* CosmicCalculator input options::  Options to specify input conditions.
+* CosmicCalculator specific calculations::  Requesting specific outputs.
address@hidden menu
 
address@hidden
-$ astcosmiccal --redshift=0.832 | grep volume
address@hidden example
address@hidden CosmicCalculator input options, CosmicCalculator specific 
calculations, Invoking astcosmiccal, Invoking astcosmiccal
address@hidden CosmicCalculator input options
 
address@hidden
-The full list of options is shown and described below:
+The inputs to CosmicCalculator can be specified with the following options:
 @table @option
 
 @item -z FLT
@@ -16489,20 +16486,141 @@ density in the current Universe 
(@mymath{\Omega_{m,0}}).
 @itemx --oradiation=FLT
 Radiation density divided by the critical density in the current Universe
 (@mymath{\Omega_{r,0}}).
address@hidden table
+
 
address@hidden -v
address@hidden --onlyvolume
-Only print the comoving volume (in units of address@hidden) until the
-desired redshift based on the input parameters. See explanations above
-for more on these types of options and how to effectively use them.
+
address@hidden CosmicCalculator specific calculations,  , CosmicCalculator 
input options, Invoking astcosmiccal
address@hidden CosmicCalculator specific calculations
+By default, when no specific calculations are requested, CosmicCalculator
+will print a complete set of all its calculators (one line for each
+calculation, see @ref{Invoking astcosmiccal}). The full list of
+calculations can be useful when you don't want any specific value, but just
+a general view. In other contexts (for example in a batch script or during
+a discussion), you know exactly what you want and don't want to be
+distracted by all the extra information.
+
+You can use any number of the options described below in any order. When
+any of these options are requested, CosmicCalculator's output will just be
+a single line with a single space between the (possibly) multiple
+values. In the example below, only the tangential distance along one
+arcsecond (in kpc), absolute magnitude conversion, and age of the universe
+at redshift 2 are printed (recall that you can merge short options
+together, see @ref{Options}).
+
address@hidden
+$ astcosmiccal -z2 -sag
+8.585046 44.819248 3.289979
address@hidden example
+
+Here is one example of using this feature in scripts: by adding the
+following two lines in a script to keep/use the comoving volume with
+varying redshifts:
+
address@hidden
+z=3.12
+vol=$(astcosmiccal --redshift=$z --volume)
address@hidden example
+
address@hidden GNU Grep
address@hidden
+In a script, this operation might be necessary for a large number of
+objects (several of galaxies in a catalog for example). So the fact that
+all the other default calculations are ignored will also help you get to
+your result faster.
+
+If you are indeed dealing with many (for example thousands) of redshifts,
+using CosmicCalculator is not the best/fastest solution. Because it has to
+go through all the configuration files and preparations for each
+invocation. To get the best efficiency (least overhead), we recommend using
+Gnuastro's cosmology library (see @ref{Cosmology
+library}). CosmicCalculator also calls the library functions defined there
+for its calculations, so you get the same result with no overhead. Gnuastro
+also has libraries for easily reading tables into a C program, see
address@hidden input output}. Afterwards, you can easily build and run your C
+program for the particular processing with @ref{BuildProgram}.
+
+If you just want to inspect the value of a variable visually, the
+description (which comes with units) might be more useful. In such cases,
+the following command might be better. The other calculations will also be
+done, but they are so fast that you will not notice on modern computers
+(the time it takes your eye to focus on the result is usually longer than
+the processing: a fraction of a second).
+
address@hidden
+$ astcosmiccal --redshift=0.832 | grep volume
address@hidden example
+
+The full list of CosmicCalculator's specific calculations is present
+below. In case you have forgot the units, you can use the @option{--help}
+option which has the units along with a short description.
+
address@hidden @option
+
address@hidden -G
address@hidden --agenow
+The current age of the universe (given the input parameters) in Giga-years
+(Gyr).
+
address@hidden -C
address@hidden --criticaldensitynow
+The current critical density (given the input parameters) in grams per
+centimeter-cube (@mymath{g/cm^3}).
 
 @item -d
address@hidden --onlyabsmagconv
-Only print the conversion factor for apparent magnitude to absolute
-magnitude. Note that this is practically the distance modulus added
-with @mymath{-2.5\log{(1+z)}} for the the desired redshift based on
-the input parameters. See explanations above for more on these types
-of options and how to effectively use them.
address@hidden --properdistance
+The proper distance (at current time) to object at the given redshift in
+Megaparsecs (Mpc). See @ref{Distance on a 2D curved space} for a
+description of the proper distance.
+
address@hidden -A
address@hidden --angulardimdist
+The angular diameter distance to object at given redshift in Megaparsecs
+(Mpc).
+
address@hidden -s
address@hidden --arcsectandist
+The tangential distance covered by 1 arcseconds at the given redshift in
+kiloparsecs (Kpc). This can be useful when trying to estimate the
+resolution or pixel scale of an instrument (usually in units of arcseconds)
+at a given redshift.
+
address@hidden -L
address@hidden --luminositydist
+The luminosity distance to object at given redshift in Megaparsecs (Mpc).
+
address@hidden -u
address@hidden --distancemodulus
+The distance modulus at given redshift.
+
address@hidden -a
address@hidden --absmagconv
+The conversion factor (addition) to absolute magnitude. Note that this is
+practically the distance modulus added with @mymath{-2.5\log{(1+z)}} for
+the the desired redshift based on the input parameters. Once the apparent
+magnitude and redshift of an object is known, this value may be added with
+the apparent magnitdue to give the object's absolute magnitude.
+
address@hidden -g
address@hidden --age
+Age of the universe at given redshift in Giga-years (Gyr).
+
address@hidden -b
address@hidden --lookbacktime
+The look-back time to given redshift in Giga-years (Gyr). The look-back
+time at a given redshift is defined as the current age of the universe
+(@option{--agenow}) subtracted by the age of the universe at the given
+redshift.
+
address@hidden -c
address@hidden --criticaldensity
+The critical density at given redshift in grams per centimeter-cube
+(@mymath{g/cm^3}).
+
address@hidden -v
address@hidden --onlyvolume
+The comoving volume in Megaparsecs cube (address@hidden) until the desired
+redshift based on the input parameters.
 
 @end table
 



reply via email to

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