Self-Calibration for optical interferometry image reconstruction

This page is the distribution page of the self-calibration algorithm developed by F. Millour.

Please cite Millour et al. (2011) [ bibtex|ads] if you use this software or the associated algorithm.

What is self-cal?

Self-calibration is a method first developed in radio-astronomy to produce radio-interferometric images of an astrophysical object. The review Pearson & Readhead 1984 explains well the principles and applications of this technique. Different variants have been developed for optical interferometry:

  • The WISARD software uses an internal self-calibration algorithm to produce gray images of an object
  • The paper Schmit 2008 describes a coherent integration method to produce images with radio-interferometry software
  • The paper Millour et al. 2011 describes the use of differential phases in the image reconstruction process. It is the subject of this software.

When should I consider using self-cal?

When you have an optical interferometric dataset suitable for imaging, which contains wavelength-differential phases. An example of suitable dataset can be found here. More generally, the instruments producing such datasets are AMBER when used with medium or high spectral resolution, or VEGA. It will be also the case of MATISSE and GRAVITY


Self-cal can be downloaded here


To use it, you should have:

Installation instructions

First, install the amdlib software. Go to, create an account if you do not have one, and follow the installation manual (it is mainly a matter of running an script).

Then, install the MIRA software. I distribute a shell installation script of MIRA here. You also have it for convenience in the self-cal archive:

tar xzf selfcal_vxxx.tgz
cd selfcal_vXXX

Then, install the yutils package. I also distribute a shell installation script of yutils here. You also have it for convenience in the self-cal archive:


You must patch manually the MIRA software to make self-cal work. First, find the MIRA installation directory and edit the mira.i file:

export yorinstall=`which yorick`
export dirinstall=`dirname $yorinstall`
emacs $dirinstall/../i/mira.i

Edit the mira.i file at line 2204 (<esc>-g 2204 in emacs) and add the following line at the beginning of the function mira_solve:

extern extra;

Once done, just install the self-cal package:

cd selfcal_vXXX
make install_selfcal

You should be ready to go.


The software contains examples that can be found in the distributed archive. I provide here a few guidelines to make a first script with it.

The first example dataset is the AMBER observations of HD62623.

The software is divided into two parts:

  • An interface to MIRA to simplify the use of multiwavelength datasets (and also a few things described in Millour et al. 2012)
  • The self-calibration step

Therefore, two main functions have to be used:

  • miral_reconstruct_multiwlen
  • miral_self_calibrate

The function miral_reconstruct_multiwlen uses as input files a set of oifits files and runs with a series of default of parameters (it automatically sets the field of vie & pixel size, selects regularization, etc.). You can have access to all the parameters of the function by typing help,miral_reconstruct_multiwlen.

For example, to perform a run of BFMC as described in Millour et al. 2012, one can use the following parameters:

miral_reconstruct_multiwlen(fitsFiles, CHI2, MU2, IMGCUBE, REGUL, outImg,
                            popV2=0, popVis=1, popV3=0, copVtoV2=0, copV2toV=0,
                            binSize=20, cleanup_bad_data=0,
                            fovFWHM=10*MIRA_MILLIARCSECOND, medianImg0=1);

The parameters of this functions are:

  • fitsFiles : input oifits files
  • CHI2 : output chi2
  • MU2 : output hyperparameter value
  • IMGCUB : output image cube
  • REGUL : output string array containing the used regularization
  • outputImage : output image name
  • img0= : reference (initial) image
  • medianImg0= : use the median image over the best chi2 as start image
  • popVis= : do not take (=1) or take (=0) into account the OI_VIS table
  • popV2= : do not take (=1) or take (=0) into account the OI_VIS2 table
  • popV3= : do not take (=1) or take (=0) into account OI_T3 table
  • copV2toV= : if =1, copy the content of OI_VIS2 table to OI_VIS table (visamp)
  • binSize= : wavelength-bisize on which the image is reconstructed
  • recenter= : flag for centering images at each wlen step
  • radius= : radius to compute the photocenter for recentering the image
  • mu= : regularization values (see miral_solve_multiRgl)
  • imgSize= : image size (pixels)
  • pixSize= : pixel size (radians)
  • fovFWHM= : field of view FWHM (Gaussian prior)
  • prior= : optional prior
  • regul= : can be any of "l2l1_smoothness", "smoothness", "quadratic", "qsmooth", "entropy", "totvar"
  • nImg= : Number of images to reconstruct for Monte Carlo applications
  • niter= : Number of iterations in MIRA
  • niterFirst= : Number of iterations in MIRA at first step

A graphical window will appear which should look like this:
Graphical output of miral_reconstruct_multiwlen, showing the start image,
prior image, reconstruction parameters and the last run of image reconstruction

The function miral_self_calibrate performs the self-calibration step. It needs an input image cube representing the hybrid map, and also the input oifits files dataset. It saves new oifits files (the self-calibrated files) to an output directory which needs to be set also.

    miral_self_calibrate(fitsFilesDiff, lastImage, datadir2,
                         calibrateAmp=0, pse=500, gain=0.9);
  • inputFiles : input oifits files
  • inputImage : input image cube (the hybrid map)
  • outputDir : output data directory (the synthetic data)
  • wlenIdx= : mask to use only selected wavelengths for self-calibration of the differential phase
  • calibrateAmp=: whether or not calibrate the amplitude also
  • useVisAmp= : Use V2 or visamp to get the visibility amplitude
  • gain= : Gain of self-calibration

Two graphical windows will appear which should look like this:
Graphical output of miral_self_calibrate showing the image
visibilities together with the self-calibrated visibilities
Graphical output of miral_self_calibrate showing the
differential phases self-calibration as a function of wavelength


Publications using this software

Related publications


Self-cal is distributed under the GPL licence in the hope that it may be useful to someone, but WITHOUT ANY WARRANTY. Please acknowledge its author every time you use it or modify it. A sub-part of self-cal uses lines of code from MIRA, a software developed by E. Thiébaut. Please also acknowledge this software.

Number of visitors since October 2015

webs counters
Total Count
Last modified 5 years ago Last modified on Sep 6, 2017 11:41:35 AM

Attachments (3)

Download all attachments as: .zip