Keywords: map

Next: Practical advices Up: Fitting (GO UVFIT and Previous: General considerations Contents Index

## Implementation

The MAPPING fitting capabilities are available through the `GO UVFIT` and `GO PLOTFIT` procedures and/or the associated widgets (inside the `UV interferometric operations` widget of the MAPPING menu). These procedures allow you to fit models directly through the visibilities of a table whose filename (without extension) is stored into `NAME` sic variable. The models are either simple functions or linear combinations of simple functions. The residual visibilities will be written in a table named `'NAME'"-res.uvt"`. The results (e.g. values of the fitted parameters) will be saved in an output binary file (in detail, a `GDF` table), named `'NAME'".uvfit"`. The velocity/frequency channels to be fitted are selected through the `FIRST` and `LAST` sic variables.

All other control parameters of the fit and of the plot of the fitted parameters are stored in the `UVFIT` sic structure

Fit parameters
  are
  `UVFIT%RANGE`
    The range (in meters) of spatial scales to be used in the fitting. `"0 1700"` is the correct default as of today (2023) for NOEMA.
  `UVFIT%NF`
    Number of simple fitted functions. Both the task and the procedure enable the fit of the linear combinations of up to four simple functions while the widget gives support only for the combination of two simple functions. Indeed, the larger the number of simultaneously fitted function , the more difficult the convergence... Each of the following parameters is suffixed with the number of the fitted function it contributes to describe (e.g. 01, 02, 03, 04).
  `UVFIT%FUNCT01`
    Currently supported functions are

    `POINT` | Point source | X and Y offset, flux
    `E_GAUSS` | Elliptical Gaussian | X and Y offset, flux, major and minor FWHM, pos. ang.
    `C_GAUSS` | Circular Gaussian | X and Y offset, flux, FWHM
    `C_DISK` | Circular disk | X and Y offset, flux, diameter
    `E_DISK` | Elliptical (inclined) disk | X and Y offset, flux, axes (major and minor), pos. ang.
    `RING` | Annulus | X and Y offset, flux, inner and outer diameter
    `U_RING` | *** ? JP *** | X and Y offset, flux, *** ? JP ***
    `EXPO` | Exponential brightness | X and Y offset, flux, FWHM axis
    `POWER-2` |  | X and Y offset, flux, FWHM axis
    `POWER-3` |  | X and Y offset, flux, FWHM axis

    The number and description of the fitted parameters depends on the kind of fitted functions. As can be seen, at least 3 parameters are always fitted and the first 3 parameters are common to all fitted functions. Fluxes are expressed in Jansky and sizes in arcseconds.
  `UVFIT%PARAM01`
    Guesses of input parameters in the order defined in the above table. Six parameters must always be given. You can put whatever value for the parameters that will not be used in the fit. Important warning: The guess of spatial length (e.g. major, minor) must be non-zero valued, otherwise it will stay zero during the fit...
  `UVFIT%START01`
    Number of time the fit will be started with slightly different input parameters in agreement with the value of `UVFIT%RANGE01`. The default (i.e. 0) means that the fit will be started only once with the values of `UVFIT%PARAM01` as initial guess. The value of -1 is an important particular case. Indeed -1 implies that the associated parameters will not be fitted. It will instead keep the initial guess value.
  `UVFIT%RANGE01`
    Not fully clear *** ? JP ***
  `UVFIT%SUBSF01`
    Logical variable indicating whether the associted fitted function will be subtracted from the input table in the residual table.
Plot parameters
  are
  `UVFIT%NP`
    Number of fitted functions for which the values of the fitted parameters will be plotted. Each fitted function will be associated one color.
  `UVFIT%ORDER`
    Order in which the fitted functions will have their parameters plotted. For instance, if you want to plot only the parameters of the second fitted function, you would set `UVFIT%NP` to 1 and `UVFIT%ORDER` to `"2 1"`.
  `UVFIT%NX` and `UVFIT%XTYPE`
    Number and type of the fitted parameters used to define the X axes of the plots. Up to 6 parameters can be plotted in the same plot. The `UVFIT%XTYPE` must be a string formatted like `"type min max"`. Possible type are `CHANNEL, VELO, FREQ, RMS, RA, DEC, FLUX, WIDTH, MAJOR, MINOR, and ANGLE`. A `[*]` instead of min and/or max implies the use of the default minimum and maximum values of the plotted parameter.
  `UVFIT%NY` and `UVFIT%YTYPE`
    Idem for the Y axes.

A known bugs is that when you change the number of simultaneously fitted functions, you need to manually remove the `uvfit` file to avoid trouble.

The procedures are in fact wrap-up around the `UV_FIT` task. It uses the public domain SLATEC library which is shipped by default with GILDAS.

The results are stored in a GDF table which can read with the `COLUMN` command. The table is organized as a matrix. is the number of channels in the input table. The organization along the other axis is as follows `P1 P2 P3 Vel A1 A2 A3 Par1 Err1 Par2 Err2 ... A1 A2 A3 Par1 Err1 ...` where

`P1`
  RMS of the fitting process.
`P2`
  Number of simultaneously fitted functions.
`P3`
  Total number of fitted parameters.
`Vel`
  Velocity of the ith channel (i lies between 1 and M).
`A1`
  Number of the fitted function (1 for the first function, 2 for the second function, ...).
`A2`
  Code of the function kind (POINT = 1, E_GAUSS = 2, ...).
`A3`
  Number of fitted parameters in the current function.
`Par1`
  Value of the first fitted parameters.
`Err1`
  Uncertainty on the value of the first fitted parameters.

Hence, when fitting a single function (4 generic columns + 3 columns associated to the fitted function + 6 times 2 columns per parameters) and when fitting simultaneously two functions. This data format as the use of the task itself is not very convenient. We thus recommend to use the procedures and/or the associated widgets.

Next: Practical advices Up: Fitting (GO UVFIT and Previous: General considerations Contents Index