Back to the main page

HfS. Version 2017.3 (Released 2017/05)

A full description of HfS, fitting strategy, calculation of the synthetic spectrum, derivation of line and physical parameters, error estimation of the fit and derived parameters, and a comparison with other fit routines can be found in Estalella (2017). For a description of a preliminary version of HfS, see Sánchez-Monge et al. (2013).

General HfS procedures

HfS (Estalella 2017) is a tool to fit the hyperfine structure of spectral lines, with multiple velocity components. The information on the transition hyperfine structure is read from the file hfs_transitions.dat. For each velocity component, 4 independent parameters are fitted: HfS consists in different procedures:

HfS NH3 procedures

HfS NH3 procedures fit simultaneously the hyperfine structure of NH3(1,1) and (2,2) inversion transition spectra. The assumptions made are that the emitting region is homogeneous along the line of sight, and that the filling factor f, the excitation temperature Tex, the hyperfine components linewidth Δv, and the central velocity vLSR are the same for all the hyperfine components of the (1,1) and (2,2) transitions. However, since there is enough information, a different vLSR can be fitted for the (1,1) and the (2,2) spectra. In general, differences in central velocity of a few tenths of km s-1 are usually found between the (1,1) and (2,2) emissions.

Six independent parameters are fitted:

For each set of fit parameters, the optical depth of the (2,2) transition, τ2m, is obtained from the relation
[1 – eτ2m] = [1 – eτ1m] × [A (1 – eτ2m)] / [A (1 – eτ1m)],
and used to evaluate the (2,2) synthetic spectrum.

From the values of the fit parameters, five derived parameters are calculated, which are necessary for the estimation of parameters with physical interest:

The physical parameters that are derived from the standard analysis of NH3(1,1) and (2,2) observations are: You can find a detailed explanation on the derivation of the physical parameters and their uncertainty in Estalella (2017).

The HfS NH3 procedures are similar to to the general HfS procedures:

HfS auxiliary procedures


  1. Linux or Mac OS X system.
  2. Fortran 90 compiler, e.g. gfortran.
  3. PGplot Graphics Subroutine Library (www.astro.caltech.edu/~tjp/pgplot/) compiled with gfortran.
    Mac users can find a guide for installing PGplot on Mac OS X in mingus.as.arizona.edu/~bjw/software/pgplot_fix.html. You can find a local copy of the same page in pgplot_macosx.html.
    PGplot is needed for the graphic output of HfS procedures. However, it is not needed for hfs_cube_mp, hfs_nh3_cube_mp, hfs_blanking, hfs_nh3_blanking, hfs_fits_blanking. For the installation of PGplot with gfortran, follow the installation procedure described in pgplot_gfortran.html.
  4. Open MPI (www.open-mpi.org) is needed for the multiprocessor procedures hfs_cube_mp and hfs_nh3_cube_mp.


  1. Download hfs.tgz.
  2. Untar hfs.tgz in your installation directory (as root or using sudo), for instance /usr/local/hfs,
    $ mkdir /usr/local/hfs
    $ mv hfs.tgz /usr/local/hfs
    $ cd /usr/local/hfs
    $ tar -xzvf hfs.tgz
  3. If necessary, edit the first lines of the shell script hfs_compile to change the lines
    libraries="-lpgplot -lX11"
    You may need to give the location of the PGplot library with the option
    libraries="-lpgplot -lX11 -L/usr/local/lib/pgplot"
    Mac users may need something like
    libraries="-lpgplot -lX11 -L/usr/local/lib/pgplot -L/usr/X11/lib"
    Run the compile script
    $ ./hfs_compile
    and verify that there are no errors in the compilation.
  4. If necessary, edit the first lines of the shell script hfs_links to change the line
    and run the links script to create symbolic links in $exedir pointing to the HfS procedures
    $ ./hfs_links
  5. Define the environment variable HFS_DIR, pointing to your installation directory. It is used by HfS to find the files hfs_transitions.dat and hfs_fit.help. This can be done by adding to your .bashrc or .bash_profile the lines
    # hfs
    export HFS_DIR=/usr/local/hfs