Wiki

Clone wiki

analytic_infall / Home

Analytic Infall Models

Here is the software for the analytic infall models presented in De Vries & Myers (2005). This software now allows you to run the HILL5 model on all the spectra in a FITS cube. It also checks to see if each line profile can be better fit by a thin, symmetric line and provides the best fit. Feel free to use this software to analyze the asymmetric line profiles in your maps.

Mac OS X Instructions

Fink/Compiling

  1. Install fink.
  2. Install the Gnu Scientific Library using the command: fink install gsl
  3. Install the CFITSIO Library using the command: fink install cfitsio
  4. Jump down to the source section below to download and compile the source for this package.

Debian / Ubuntu Instructions

  1. Install Gnu Scientific Library using the command: apt-get install libgsl0-dev
  2. Install CFITSIO Library using the command: apt-get install libcfitsio-dev
  3. Jump down to the source section below to download and compile the source for this package.

Installation From Source (All Operating Systems)

There are two prerequisite libraries you must download and install.

  1. The Gnu Scientific Library
  2. The CFITSIO Library

The Gnu Scientific Library

  1. Download the GNU Scientific Library: Get latest from GNU.
  2. Expand the package using the command line tar xvfz gsl-1.14.tar.gz.
  3. Change into the `gsl-1.14` directory and configure the package. If you have root access use ./configure, if you are installing the package in a local directory use ./configure --prefix=directory where directory is the installation directory.
  4. Use ./configure --help for help or more information.
  5. After configuration run make followed by make install. If you are performing a system wide installation you will have to execute the last command as `root`.
  6. The Gnu Scientific Library should now be installed.

The CFITSIO Library

  1. Download the CFITSIO Library: cfitsio3250.tar.gz (From HEASARC).
  2. Expand the package using the command line tar xvfz cfitsio3250.tar.gz.
  3. Change into the `cfitsio` directory and configure the package. If you have root access use ./configure --prefix=/usr/local, if you are installing the package in a local directory use ./configure --prefix=directory where directory is the installation directory.
  4. After configuration run make shared followed by make install. If you are installing in `/usr/local` you may have to execute the last command as `root`.
  5. The CFITSIO package should now be installed.

The Analytic Infall Programs

  1. Download the latest source (analytic_infall-1.5.tar.gz, analytic_infall-1.5.tar.bz2).
  2. Expand the package using the command line tar xvfz analytic_infall-1.5.tar.gz.
  3. Change into the `analytic_infall-1.5` directory and configure the package. If you have root access use ./configure, if you are installing the package in a local directory use ./configure --prefix=directory where directory is the installation directory. If that does not work, try ./configure --prefix=directory --with-gsl-prefix=directory.
  4. After configuration run make followed by make install. If you are installing the package system wide you may have to execute the last command as `root`.
  5. The Analytic Models should be installed now in the `bin` subdirectory of `/usr/local` or `directory`. Check for a file called `hill5map`. If you have any problems compiling these packages let me know.

Execution

Although all the models from the paper are included in this distribution, we conclude that the `HILL5` model is most accurate for estimating infall speeds. You can fit individual spectra represented as a multicolumn table, where the first column is the velocity in km/s and the second column is the brightness temperature in Kelvins. You can include comment lines that start with a `#` character. The program which fits this performs a fit to this file is `hill5_hybrid`. The more interesting program is `hill5map` which will fit all the spectra in a 3-D FITS cube.

hill5map

This program attempts to fit both an infall model spectrum and a symmetric thin line model to each spectrum in a FITS cube. The program retains the best fit and produces several output FITS cubes and images with fit parameters. The `HILL5` model proved to be the most accurate model discussed in De Vries & Myers (2005). For each spectrum, should there be an asymmetric line profile, a model spectrum is produced, the reduced chi-squared between the observed and modeled spectrum is calculated, and the 5 parameters of the `HILL5` model are tabulated and placed in separate FITS images. This parameters are sigma, LSR velocity, line center optical depth, infall velocity, and peak excitation temperature. For more information on each parameter and the equations involved please see the paper. Should a symmetric, optically thin line be the best fit, the infall velocity is set to 0, the excitation temperature is set to a specified constant, and the line center optical depth, LSR velocity, and sigma are fit to the observed line profile.

In order to use `hill5map` you must have a 3-D FITS file. The first two dimensions should be spatial dimensions and the third dimension should be the spectral dimension. The spectral dimension should have units of velocity in m/s. The FITS map units should be brightness temperature in Kelvins. A couple of notes: GILDAS routinely creates 4-D FITS cubes with one blank dimension. If you contact me I can provide a script which removes this additional dimension. Some observatories use the IRAF convention of using the first dimension as the spectral dimension, and the next two as spatial dimensions. I also have a script, designed for FCRAO data, which rotates the cube to make the third dimension the spectral one.

Once you have a cube which `hill5map` will understand, you will find that `hill5map` has a bewildering number of command line options:

Usage: hill5map <infile> <frequency> <thin_tex> <vmin> <vmax> <popingen> <genpercheck> <checkperconv> <x1> <y1> <minpeak> <outbase>

I will take you through all of these options, with recommendations for each option.

  • `infile`: The input FITS file with the spectra you would like to fit.
  • `frequency`: The line frequency in Hz! If you select 0 here, you will be using the low frequency approximation (Rayleigh-Jeans approximation for brightness temperature).
  • `thin_tex`: This is the excitation temperature you choose for thin lines in Kelvins. You must specify an excitation temperature and the program will fit for the optical depth. Only the combination of excitation temperature and optical depth is well determined on an optically thin line, but not both.
  • `vmin`, `vmax`: The velocity range to fit on each spectrum. This should include the entire line and a little bit of baseline. The fewer channels it is, and the more well bracketed the line is, the faster it will fit.
  • `popingen`: This is a parameter used by the differential evolution fitting algorithm. It defines the number of independent random solutions in each fitting generation. The higher it is, the more likely you are not to end up in a local minimum and find the global minimum. I recommend choosing an integer between 200 and 300 for this parameter.
  • `genpercheck`: This is the number of generations to calculate before checking for the best fit. I recommend choosing 300 for this parameter.
  • `checkperconv`: As the solution converges, the chi-squared parameter will plateau or begin converging very slowly using the differential evolution algorithm. This parameter sets the number of checks that the program should make with little or no change in the chi-squared parameter before switching to the faster Simplex minimization algorithm. I recommend choosing an integer between 3 and 5 here.
  • `x1`, `y1`: These integers specify the x- and y-coordinates of a spectrum on the map with a good infall asymmetry. (The lower left-hand corner of the map is coordinate 1,1). This will be the first spectrum fit by the program and the remaining spectra will be fit using a fast simplex minimization based upon the best-fit parameters from this first spectrum.
  • `minpeak`: Every map usually has some spectra with no signal. This paramter specifies a threshold signal level at which to attempt fitting in Kelvins. If there is at least one channel within the velocity range that has intensity above `minpeak` it will be fit, otherwise the program will assume there is no signal in that spectrum.
  • `outbase`: This program creates several FITS files. `outbase` is a string specifying the prefix to use on all these files.

For example, let's assume I have a CS 2-1 map of TMC1-1C called `tmc1-1c_cs2-1_cube.fits`. The spectrum at coordinate (15,21) has a good infall asymmetry. The spectral lines are confined to a velocity range of 4.0 to 6.5 km/s, and the noise is restricted to less that 0.4 K in each channel. I could fit this map with the command line

hill5map tmc1-1c_cs2-1_cube.fits 97.980950e+9 5.0 4.0 6.5 200 300 4 15 21 0.4 tmc1-1c-hill5

Note that I have picked the CS J=2-1 frequency of 97.980950e+9 Hz, an excitation temperature for thin likes of 5 K, and `popingen`,`genpercheck`, and `checkperconv` values of 200, 300, and 4 respectively. After a short wait, which includes some output to let you know what's happening, the following files will be written out:

  • `tmc1-1c-hill5-fits.fits`: A FITS cube of the modeled spectra.
  • `tmc1-1c-hill5-chisq.fits`: A FITS image of the reduced chi-squared fit of each modeled spectrum to each data spectrum.
  • `tmc1-1c-hill5-sigma.fits`: A FITS image of the line width (sigma) in km/s for each model spectrum.
  • `tmc1-1c-hill5-tau.fits`: A FITS image of the optical depth at line center of each modeled spectrum.
  • `tmc1-1c-hill5-tpeak.fits`: A FITS image of the modeled peak excitation temperature along each line of sight. For thin lines this will be 5 K.
  • `tmc1-1c-hill5-vin.fits`: A FITS image of the modeled infall velocity along each line of sight in km/s. For thin lines this will be exactly 0.0 km/s.
  • `tmc1-1c-hill5-vlsr.fits`: A FITS image of the modeled line center velocity along each line of sight in km/s.

Now you can use your favorite FITS tools to analyze the results.

Please feel free to contact me if you have any problems, questions, to report any bugs, or submit any fixes.

Updated