GNU Astronomy Utilities



9.1.3.2 CosmicCalculator basic cosmology 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 Invoking CosmicCalculator). The full list of calculations can be useful when you do not 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 do not 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 arc-second (in kpc), absolute magnitude conversion, and age of the universe at redshift 2 are printed (recall that you can merge short options together, see Options).

$ astcosmiccal -z2 -sag
8.585046 44.819248 3.289979

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:

z=3.12
vol=$(astcosmiccal --redshift=$z --volume)

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 Cosmology library (cosmology.h)). 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 Table input output (table.h). Afterwards, you can easily build and run your C program for the particular processing with 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).

$ astcosmiccal --redshift=0.832 | grep volume

The full list of CosmicCalculator’s specific calculations is present below in two groups: basic cosmology calculations and those related to spectral lines. In case you have forgot the units, you can use the --help option which has the units along with a short description.

-e
--usedredshift

The redshift that was used in this run. In many cases this is the main input parameter to CosmicCalculator, but it is useful in others. For example, in combination with --obsline (where you give an observed and rest-frame wavelength and would like to know the redshift) or with --velocity (where you specify the velocity instead of redshift). Another example is when you run CosmicCalculator in a loop, while changing the redshift and you want to keep the redshift value with the resulting calculation.

-Y
--usedvelocity

The velocity (in km/s) that was used in this run. The conversion from redshift will be done with the more general and accurate relativistic equation of \(1+z=\sqrt{(c+v)/(c-v)}\), not the simplified \(z\approx v/c\).

-G
--agenow

The current age of the universe (given the input parameters) in Ga (Giga annum, or billion years).

-C
--criticaldensitynow

The current critical density (given the input parameters) in grams per centimeter-cube (\(g/cm^3\)).

-d
--properdistance

The proper distance (at current time) to object at the given redshift in Megaparsecs (Mpc). See Distance on a 2D curved space for a description of the proper distance.

-A
--angulardiamdist

The angular diameter distance to object at given redshift in Megaparsecs (Mpc).

-s
--arcsectandist

The tangential distance covered by 1 arc-seconds 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 arc-seconds) at a given redshift.

-L
--luminositydist

The luminosity distance to object at given redshift in Megaparsecs (Mpc).

-u
--distancemodulus

The distance modulus at given redshift.

-a
--absmagconv

The conversion factor (addition) to absolute magnitude. Note that this is practically the distance modulus added with \(-2.5\log{(1+z)}\) for 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 magnitude to give the object’s absolute magnitude.

-g
--age

Age of the universe at given redshift in Ga (Giga annum, or billion years).

-b
--lookbacktime

The look-back time to given redshift in Ga (Giga annum, or billion years). The look-back time at a given redshift is defined as the current age of the universe (--agenow) subtracted by the age of the universe at the given redshift.

-c
--criticaldensity

The critical density at given redshift in grams per centimeter-cube (\(g/cm^3\)).

-v
--onlyvolume

The comoving volume in Megaparsecs cube (Mpc\(^3\)) until the desired redshift based on the input parameters.