GNU Astronomy Utilities CosmicCalculator spectral line calculations

At different redshifts, observed spectral lines are shifted compared to their rest frame wavelengths with this simple relation: \(\lambda_{obs}=\lambda_{rest}(1+z)\). Although this relation is very simple and can be done for one line in the head (or a simple calculator!), it slowly becomes tiring when dealing with a lot of lines or redshifts, or some precision is necessary. The options in this section are thus provided to greatly simplify usage of this simple equation, and also helping by storing a list of pre-defined spectral line wavelengths.

For example, if you want to know the wavelength of the \(H\alpha\) line (at 6562.8 Angstroms in rest frame), when \(Ly\alpha\) is at 8000 Angstroms, you can call CosmicCalculator like the first example below. And if you want the wavelength of all pre-defined spectral lines at this redshift, you can use the second command.

$ astcosmiccal --obsline=lyalpha,8000 --lineatz=halpha
$ astcosmiccal --obsline=lyalpha,8000 --listlinesatz

Bellow you can see the printed/output calculations of CosmicCalculator that are related to spectral lines. Note that --obsline is an input parameter, so it is discussed (with the full list of known lines) in CosmicCalculator input options.


List the pre-defined rest frame spectral line wavelengths and their names on standard output, then abort CosmicCalculator. The units of the displayed wavelengths for each line can be determined with --lineunit (see below).

When this option is given, other operations on the command-line will be ignored. This is convenient when you forget the specific name of the spectral line used within Gnuastro, or when you forget the exact wavelength of a certain line.

These names can be used with the options that deal with spectral lines, for example, --obsline and --lineatz (CosmicCalculator basic cosmology calculations).

The format of the output list is a two-column table, with Gnuastro’s text table format (see Gnuastro text table format). Therefore, if you are only looking for lines in a specific range, you can pipe the output into Gnuastro’s table program and use its --range option on the wavelength (first) column. For example, if you only want to see the lines between 4000 and 6000 Angstroms, you can run this command:

$ astcosmiccal --listlines \
               | asttable --range=wavelength,4000,6000

And if you want to use the list later and have it as a table in a file, you can easily add the --output (or -o) option to the asttable command, and specify the filename, for example, --output=lines.fits or --output=lines.txt.


Similar to --listlines (above), but the printed wavelength is not in the rest frame, but redshifted to the given redshift. Recall that the redshift can be specified by --redshift directly or by --obsline, see CosmicCalculator input options. For an example usage of this option, see Viewing spectra and redshifted lines.


The wavelength of the specified line at the redshift given to CosmicCalculator. The line can be specified either by its name or directly as a number (its wavelength). The units of the displayed wavelengths for each line can be determined with --lineunit (see below).

To get the list of pre-defined names for the lines and their wavelength, you can use the --listlines option, see CosmicCalculator input options. In the former case (when a name is given), the returned number is in units of Angstroms. In the latter (when a number is given), the returned value is the same units of the input number (assuming it is a wavelength).


The units to display line wavelengths above. It can take the following four values. If you need any other unit, please contact us at




Micrometer or \(10^{-6}m\).


Nanometer, or \(10^{-9}m\).


Angstrom or \(10^{-10}m\); the default unit when this option is not called.