+27833657551     admin@starscientist.org
    +27833657551     admin@starscientist.org

MIRIAD is a data reduction software that was primarily written to reduce radio interferometric data from the Australia Telescope Compact Array . However, it can also be used to analyze data from other radio telescopes such as the VLA or the MeerKAT. Although it was written in the 1990s (a project initiated by the Berkeley-Illinois-Maryland Association, BIMA), many astronomers still use it and you will find it really convenient to use. In this post, I will show you how to install and use MIRIAD. There is a binary distribution and the carma-miriad version in github. My preferred way of installation is the carma-miriad version as it is much easier to edit and recompile when needed. See below a step-by-step guide on how to install and use MIRIAD on a Linux machine.

Ubuntu 16.04 (see further down for Ubuntu 20.04):

git clone https://github.com/pkgw/carma-miriad.git 
#You may find some memory error if you would like to use the task MAFIA. 
#So open the following file with your favorite text editor: 
#comment on this line PARAMETER(MAXSIM=256)
#and uncomment PARAMETER(MAXSIM=8192)
#Now inside the carma-miriad directory run the following commands: 
./configure --prefix=`pwd`/build 
make install 
#After the installation finishes, run one of the below commands (depending on your preferred shell )
source carma-miriad/build/lib/miriad/automiriad.csh
source carma-miriad/build/lib/miriad/automiriad.sh
#And that should be it, you may want to read the carma-miriad/install.MIR file for more details but 
#the above steps should be sufficient. 

Ubuntu 20.04: Install the binary distribution following this link. However, you may run into libgfortran3 not found error. To remedy this, follow the below instructions:

# Put the following line in your /etc/apt/sources.list. 
deb http://gb.archive.ubuntu.com/ubuntu/ bionic main universe
# Copy paste the following lines to your terminal 
sudo apt-get install g++-6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 6
sudo apt-get install libgfortran3

You can run MIRIAD directly on the command line or write a shell script. Let us make a simple demonstration of how you can use MIRIAD. Suppose we have a data cube (datacube.fits) that we would like to convolve with a Gaussian kernel FWHM of 30 arcsec circular beam and re-bin the pixels to a new pixel size, you can achieve this using the following code. We can save the below code as my_first_miriad.csh.

#! /usr/bin/tcsh

set prefix = datacube # input data cube
set conv_kernel = 30 # size of the kernel 

fits in=${prefix}.fits out=${prefix}_or op=xyin # convert the fits to a MIRIAD input file
convol map=${prefix}_or fwhm=${conv_kernel} options=final out=${prefix}_con
imbin in=${prefix}_con bin=2,2,2,2,1,1 out=${prefix}_convolved_binned # bin to a new pixel size
fits in=${prefix}_convolved_binned out=${prefix}_convolved_binned.fits op=xyout # writing to a fits file
rm -rf ${prefix}_con ${prefix}_convolved_binned 
rm -rf ${prefix}_or        

Make the my_first_miriad.csh executable and run the code on the terminal as follows:

chmod a+x my_first_miriad.csh

Note that MIRIAD tasks can also be run from Python and there is a dedicated website for that. You can install and test it from this GitHub repository.