Post processing of FITS data cubes from Capreole simulations
FORTRAN Python Makefile Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
doc
src
.gitignore
.mailmap
README.html
README.org

README.org

cap-post

Postprocess Capreole datasets

All these programs work with datacubes in FITS format. See =ah3-utils= for how to convert Capreole’s native AH3 format to FITS.

Package layout

doc/cap-post.org
Source for documentation in Org-mode format
doc/cap-post.html
Compiled HTML file of documentation
src/*.{f90,sh}
Programs and convenience scripts

Compilation

  • First install the dependencies
  • Enter the src/ directory
  • [OPTIONAL] Copy local.mk.sample to local.mk and edit it to specify the desired compiler command (F90C), compiler options (F90LAGS), and libraries to link (LFITS).
    • The default values are
      F90C=gfortran
      F90FLAGS=-O3
      LFITS=/usr/local/lib/libcfitsio.a
              
  • Compile everything with
    make all
        
  • Most programs are designed to be run in the directory where the data is. For convenience, you may want to set a shell variable to the directory where the programs are, e.g.: psrc=/path/to/cap-post/src. So you can then type sh $psrc/fitsemiss.sh ...

Convenience scripts

The general default behavior of these scripts is to process all the save times of a given model in the current directory. Usage is as follows:

sh SCRIPT.sh DATEID RUNID EMTYPE [I1] [I2] [ISTEP] 
DATEID
something like 30112005
RUNID
the one-letter id code, such as x
EMTYPE
the code for the emission mechanism, such as Halpha
I1
(optional) the first savetime to process
I2
(optional) the last savetime to process
ISTEP
(optional) the step in savetimes, such as 100 to process every 100th time

fitsemiss.sh

Runs cubet, cubeemiss, and makemap as necessary to generate the emission maps.

Fortran programs

These programs can be run individually if necessary, although it is generally easier to use the convenience scripts described above.

cubestats

Calculate various statistics from the data cubes:

  • Average radius of ionization front, calculated as cube root of volume / (4 pi/3):
    • Volume calculated from mask x > 0.9
    • Volume calculated by summing x over cells
  • Maximum and minimum i-front radii
  • Mean radius of ionized gas
  • RMS gas velocity dispersion (1D)
    • Mass weighted and volume weighted
    • For ionized and neutral gas

cubet

Calculate temperature cube

cubevr

Calculate radial velocity cube (from star, assumed at center of grid).

cubeemiss

Calculate emissivity cube for a particular emission process (e.g., Halpha, FF06cm, N26584, neut00, etc).

makemap

Calculate surface brightness maps, for views along the 6 principal axes of the cube: \(± x\), \(± y\), \(± z\).

makerotmap

Calculate surface brightness map for view from an arbitrary direction.

makevcubes

Calculate Position-Position-Velocity (PPV) cubes from an emissivity cube and cubes of the three valocity components. As with makemap, a separate PPV is generated for viewing direction along each of the 6 principal axes.

Python programs

Note that these programs work best with python version > 2.7 and require various python packages to be installed (numpy, pyfits, etc).

On our linux servers (as of 2012) it is necessary to use the EPD version of python instead of the system version. For instance, by modifying your path:

export PATH=/opt/epd/latest/bin:$PATH

plotvcube.py

Produces PDF figures of isovelocity or position-velocity cuts through a PPV emission cube.

Note that this program only works with Sac and Jane’s PPV cubes (usually with names =*vc-*=). It currently doesn’t work with the cubes generated by =makevcubes.f90= (with names =*vcube-*=).

Command line options for plotvcube.py

$ python ../cap-post/src/plotvcube.py -h
usage: plotvcube.py [-h] [--slice-mode {x-slit,y-slit,isovel}]
                    [--display {contour,grayscale,both}]
                    [--iwindow IWINDOW IWINDOW] [--vlimits VLIMITS VLIMITS]
                    cubename

Plot isovel and PV images from PPV emission cubes

positional arguments:
  cubename              Name of FITS file containing PPV emission cube

optional arguments:
  -h, --help            show this help message and exit
  --slice-mode {x-slit,y-slit,isovel}
                        Mode of operation - which way to slice (default:
                        isovel)
  --display {contour,grayscale,both}
                        How to display the image (default: both)
  --iwindow IWINDOW IWINDOW
                        Range of positions or velocities to sum over (in pixel
                        units) (default: None)
  --vlimits VLIMITS VLIMITS
                        Minimum and maximum velocities in cube (default:
                        [-78.107, 73.896])

Examples of using plotvcube.py

Show PV image of narrow y-slit, summing from x=30 to x=35.

python ../cap-post/src/plotvcube.py 10042012_y_0030vc-Halpha --slice-mode y-slit --iwindow 30 35

Show isovelocity image of broad velocity channel summing from v=1 to v=50.

python ../cap-post/src/plotvcube.py 10042012_y_0030vc-Halpha --slice-mode isovel --iwindow 1 50

makemovie.py

Make movies of evolution at a fixed viewing angle or rotation at a fixed evolutionary time.

Examples of using makemovie.py

These are the command that were used to generate the movies included in Will’s talk at the Warsaw conference, July 2012.

# Evolution movies
for ANGLE in 0 215 135; do
    python ../cap-post/src/makemovie.py 04052012_4 \
	--time 3 --mode evo --frames 28 --brightscale 1e8 --orient $ANGLE $ANGLE 
    python ../cap-post/src/makemovie.py 04052012_4 \
	--time 3 --mode evo --emtypes neut00 PAH000 FF06cm \
	--emshort CPF --brightscale 1.0 --bandscales 3e6 0.15 0.25 \
	--orient $ANGLE $ANGLE --frames 28 
done
# Tumble movies
python ../cap-post/src/makemovie.py 04052012_4 --time 30
python ../cap-post/src/makemovie.py 04052012_4 --time 20 --brightscale 2e7
python ../cap-post/src/makemovie.py 04052012_4 --time 10
for TIME in 10 20 30; do
    python ../cap-post/src/makemovie.py 04052012_4 \
	--time $TIME --emtypes neut00 PAH000 FF06cm --emshort CPF --brightscale 1.0 \
	--bandscales 3e6 0.15 0.25
done

Library modules

wfitsutils

Read and write FITS files.

emissmod

General mechanism for emissivity calculations.

em2levmod

Specific functions for particular types of emission line.

External dependencies

Many of the Fortran progams use my wfitsutils module, which depends on the CFITSIO library. This may be installed as follows:

Fedora

sudo yum install cfitsio

Mac OS X via Homebrew

brew install cfitsio

Other

Install from source, e.g., like this:

wget ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3250.tar.gz
tar xzf cfitsio3250.tar.gz
cd cfitsio
./configure --prefix=/usr/local
make
sudo make install

Of course, you will want to change 3250 to te latest version. If you don’t have wget you can use curl instead (curl URL -o FILENAME).