Version 0.25
Last Update: February 15, 2000

Difwrap is a program written in Perl to provide a Graphical User Interface (GUI) to Difmap. The software currently provides a means to estimate errors in source models generated by the modelfit function in Difmap. Difwrap now allows for some limited configuration of Difmap through a GUI.

Model Error Analysis

This function allows for the determination of errors in source models obtained using the modelfit command in Difmap. It is based on the process first described by Tzioumis et al. (AJ 98, p36, 1989) thus:
The parameter of interest was stepped by small increments near the best-fitted value. At each step, this parameter was kept fixed, while all the other parameters were allowed to relax during model fitting. The resultant model was compared with the data. When the visual fit to the data became unacceptable, the limits of the acceptable range of values had been determined. Even though this method is subjective, it is thought to give a conservative estimate of the model-parameter range allowed by the data.
This method has the advantage that it allows for the inter-dependency of model components to be taken into account during model fitting. For example, if the (u,v) coverage is limited, there can be a strong inter-dependency between the size and flux density of the model component.

The main problem with this method is many trial models may be needed before a good understanding of the errors can be obtained. Carrying out this task by hand is tedious and time-consuming as it requires the generation of many model files, followed by a visual comparison of every model with the data. The model error analysis function of Difwrap removes much of this drudgery. It works in the following way:

The model components are presented to the user who decides which parameter (flux density, position or component size/shape) requires an error estimate.
The user then decides what range of parameter values require trialing and how many points to sample within that range.
Lastly, the user selects which error fitting method is appropriate. There are three to choose from:
No Modelfit or Selfcal. For each parameter value that is trialed, the goodness of fit of the trial model is measured without running modelfit to allow the other parameters to relax. This method is less conservative than that described by Tzioumis et al. as it does not provide an error estimate that accounts for the inter-dependedness of model components. If you believe your model component parameters are reasonable independent of each other, you might decide to use this over the other methods as it is significantly faster. Because it it fast, this method is also useful to provide an estimate of the minimum errors before starting on one of the other (slower) methods.
Modelfit only. For each parameter value that is trialed, the goodness of fit of the trial model is measured after executing the modelfit task with the number of specified iterations. This is the method described by Tzioumis et al.
Modelfit and Selfcal. For each parameter value that is trialed, the goodness of fit of the trial model is measured after repeatedly executing the modelfit task with the number of specified iterations followed by phase self-cal until there is no improvement in the goodness of fit. This method provides an even more conservative estimate of errors than the second.
Difwrap will then create a test model for each grid point, carry out the requested method and store the final model and goodness of fit values.
When this is complete, the user can select how the goodness of fit values are to be presented.
After inspection, the estimated error values are presented and the user may carry out another error analysis if required.


Difwrap uses the Perl module Expect to communicate with a Difmap session. The Tk and PGPLOT modules are used to provide the GUI. Difwrap requires the following versions (or later) of these modules:
Module Version Location
Expect 1.04
Tk 800.010
 Difwrap has been tested on Sparc Ultras running Solaris 2.5.1 and 2.6 with Perl version 5.004_04.


Documentation for Difwrap is available in HTML and postscript formats:


Difwrap may be obtained from web site at Installation instructions are provided in the accompanying README file.


  1. Several bug fixes. It is now possible to save images of rms/chi-squared distributions.
    1. New configuration window to allow configuration of Radplot, Vplot and Projplot flags. Also some configuration of map parameters is avialable.
    2. In model error analysis, it is now possible to show the residual and restored maps. (Thanks to Dan Homan).
    3. the main menu is now smaller an appears in the lower left corner of the screen.
    4. better management of windows
    5. exit and quit commands are disabled during the "Interactive session" thus forcing an exit through the GUI.
    6. Difwrap forces Difmap to open a /xs device on startup. This avoids a problem experienced by users who do not make a /xs device open when they start Difmap.
    7. various small bug fixes

    Version 0.10

    1. Initial release.

Problems? Bugs?

If you notice any bugs or have any suggestions, please send them to

Jim Lovell