# How are velocity and dispersion maps of galaxies made?

How can I get the velocity dispersion and velocity maps of galaxies given 3D data cubes obtained using an integral field spectrograph?

Given a data cube, the simplest way to get a velocity map and a dispersion map is to calculate the $1^{\rm st}$ and $2^{\rm nd}$ moments of the cube:

$$\bar{V}(x,y) = \frac{\int v F(x,y,v){\rm d}v}{\Sigma(x,y)}$$ $$\sigma(x,y) = \left(\frac{\int \left(v F(x, y, v)-\bar{V}(x,y)\right)^2{\rm d}v}{\Sigma(x,y)}\right)^{\frac{1}{2}}$$

Where $\Sigma(x,y)=\int F(x,y,v){\rm d}v$ is the $0^{\rm th}$ moment and $F$ is the flux in each cell of the cube. This type of velocity map is called an 'intensity weighted mean'; there are other types, see e.g. this paper.

You can tried to see if this document from Starlink helps. They do describe ways to do analysis with datacubes with their software like GAIA and KAPPA and DATACUBE:

$velmoment -b 1 -i some_cube.sdf -r 5007 -p -c 10  This should take you through a semi-interactive session of DATACUBE which would prompt you to indicate a sub-cube to analyze for the velocity. The software will then prompt you to also enter the name of the output file. You might want to be careful and check whether the heliocentric correction velocity (HCV) has been applied to your velocities. This quantity can be checked with the redshift formula manually (by computing cz where c is the speed of light and z is the redshift), or automatically using the IRAF/PyRAF RVSAO/EMSAO task. There are other software which can be used to do this kind of analysis too, like NRAO's CASA if you have radio data. I think the IRAF/PyRAF STSDAS package also has some contributed tasks called in the CONTRIB/VLA branch called VELOCITY, INTENSITY, and SMOOTH which perform similar functions. But I am still experimenting with these, and haven't mastered them quite yet. By far the most accurate method to compute the radial velocities of a datacube is by IRAF's rvsao package using either the emsao/xcsao task. But for both of these to work it is necessary to determine the heliocentric velocity correction (HCV), which should be the same for all spaxels in the datacube, using the rvsao/bcvcorr task. So to be absolutely safe or as a means of sampling it is better to stick to IRAF/PyRAF approach instead or as a check. To use the bcvcorr via PyRAF, it is a good strategy to manually input the task parameters using the command "epar bcvcorr" at the PyRAF prompt and then type in the values. Remember to check the options to save the HCV and BCV to file. After this comes the gruesome work of applying "emsao" to every spaxel. However, remember to choose "emission" option for the initial velocity guess, and the "hfile" option for the correction. Then you are all set to compile the velocity data from the datacube. For the final presentation, I prefer to use Python to generate both the position-velocity map, the velocity heat map, as well, as the IFU footprint(s). The first thing you have to calculate is the overall redshift of the galaxy. When working at this level there are better and worse lines for doing this — for example,$\mathrm{Mg}$lines frequently trace AGN outflows, so they'll be biased. Once you have the galaxy's overall redshift, you can look at individual pixels in a data cube (where you measure the spectrum of each pixel). The lines of each cube, preferably the nebular lines (e.g.$\mathrm{OIII}$and$\mathrm{H\alpha}\$), will then be offset from the overall redshift of the galaxy in a way that indicates motion of what's in that pixel relative to the galaxy. That's how you produce the velocity map… basically - you can measure the velocity using multiple lines and produce a flux weighted mean for each pixel.