SFIT 2.3 - Command Syntax


These commands read in a grid of model spectra. A variety of file formats are supported. The grid must be rectangular or cuboidal, but the stepsizes do not need to be regular. The normal axes are effective temperature, surface gravity and H/He abundance. An intermediate wavelength grid must bedefined in order to allow for inhomogeneity in the input spectra. Values for the parameters are taken from the input models themselves, to avoid mixups. The syntax of the command arguments is precise.

NFMT ! file format specifier
TITLE ! a user-defined title for the model grid
NT NG NA ! numbers of temperatures, gravities and abundaces in the grid
WS WE DW ! wavelength start, end and increments in the rebinned grid

At present, the filenames must contain no trailing characters.

read_grid, save_grid

The entire grid of model spectra may be saved in binary format to allow much more rapid access if a given grid is to be used repetitively. The commands take the form

save_grid <file>
read_grid <file>


Define the model atmosphere to be used in synth.

sterne <file>


Define the initial parameters to be used by solve.

slv_teff1 <Teff/1000> <dT>: Effective temperature (K/1000) -- Star 1
slv_logg1 <log g> <dg>: Surface gravity (log cgs) -- Star 1
slv_ahe1 <nhe> <dnHe>: Helium abundance -- Star 1
slv_vsini1 <vsini> <dvsini>: Projected rotation velocity -- Star 1
slv_R1 <R> <dR>: Relative radius -- Star 1
slv_vrad1 <vrad> <dvr>: Projected radial velocity -- Star 1
slv_teff2 <Teff/1000> <dT>: Effective temperature (K/1000) -- Star 2
...: repeat above for Star 2

Old format:

parameters {




! Effective temperature for primary (K)
! Surface gravity (log cgs)
! Surface composition parameter: depends on model grid
! Projected rotation velocity (km/s)
! Radial velocity (km/s)
! Brightness contribution

! Effective temperature for secondary (K)
! Surface gravity (log cgs)
! Surface composition parameter: depends on model grid
! Projected rotation velocity (km/s)
! Radial velocity (km/s)
! Brightness contribution

If there is only one spectrum to fit, one should set default parameters for the secondary which lie within the model grid, with <L_2/L> being a very small value.

If method = genetic, then the parameters must be defined as ranges, rather than initial values. The lower and higher limits for each of the stellar parameters should be entered. If the parameter is not to be varied its fixed value should be entered into the first column of the three and zero entered into the second column. Otherwise the lower limit should go into the first column and the upper limit in the second column.


Define the initial parameters to be used by synth. This command currently requires a specific format. The first integer on each line is the element identifier (<elid> = atomic number). The second number is the logarithmic abundance (<abun> relative to log Sigma mu_i n_i = 12.15). The third is the amount that abundance may vary (<dabu>). Set this value to 0.0 to keep it fixed.

<elid1> <abun1> <dabu1> ! first element
<elid2> <abun2> <dabu2> ! second element
0 <vturb> <dvt>! microturbulent velocity
-1 0 0 ! to finish

A solar abundance will be assumed for any elements not specified.
If the element identifier is zero, the subsequent parameters refer to microturbulent velocity.
To finish, enter a negative element identifier.

1 7.0 0.0 ! Fix hydrogen at a small value
6 8.6 0.3 ! Allow carbon to vary
8 8.8 0.3 ! Allow oxygen to vary
0 5.0 2.5 ! Allow microturbulence to vary
-1 0 0 ! to finish

Any abundances obtained by SYNTH will be remembered and, by default, not allowed to change, so that two successive calls to SYNTH may be made to solve for different groups of abundances. To use the new abundance as a start value, but to solve again for that element, for example after solving for C and O varying, you want to fix O, but solve for C with N, then set the new abundance to 0.0, but set the maximum change to a positive value. For example:

6 0.0 0.3
7 7.5 0.3
-1 0 0

To remember these results and solve for the hydrogen abundance:

1 8.0 0.3
-1 0 0


meth_levenburg: Select Levenburg-Marquardt method
meth_amoeba: Select downhill simplex method
meth_genetic: Select genetic algorithm method
meth_chisq: Locate minimum chi^2 in grid
meth_tolerance <tol>: Set tolerance (or convergence criterion)
meth_range <w1> <w2>: Set wavelength range for fit

Old format:

levenburgLevenburg-Marquardt method solve/synth
amoebaDownhill simplex methodsolve/synth
geneticGenetic algorithmsolve
chi-squaredCompute chi-squared surface onlysolve
range w1 w2Wavelength region to include in fit 
toleranceConvergence criterion 

For example, to use amoeba to find the best fit spectrum in the wavelength region 4350 -- 4520, such that the chi-squared minimum is located to within 0.002:

method{ amoeba tolerance 0.002 range 4350 4520 }


When using synth, SFIT uses a callable version of SPECTRUM to compute a synthetic spectrum on the fly. This program requires a large number of inputs and has many modes of operation. These are controlled by a number of switches. They may be set within the spectrum context by giving any or all of the switch names and their values. The following are defaults assumed if nones of these are set.

nmode 11
nsource 3
ntheta 1
noptyp 1
nhedat 1
nhestark 2

Briefly, these refer in turn to the type of spectrum to be computed, the method of calculation of the source function, the number of anges if specific intensities are to be computed, the choice of continuous opacity subroutine library, the broadening data for HeI lines and the approximation ito be used for untabulated diffuse HeI lines. They should be changed only with extreme caution. Refer to the SPECTRUM documentation for more information.


When using method genetic, several parameters are used to control the performance of the Genetic Algorithm search procedure. A short explanation of the input parameters is given:

Default Value
Allowed Range
generationsThe maximum number of generations the program will go through, before stopping, if the solution is not within the given tolerance.
population The number of parents randomly generated in the first generation, and in each subsequent generation.
prob_mutThe probability of mutation in the offspring.
0 - 1
prob_crossThe probability of crossover between two parents.
0 - 1
toleranceThe highest suitability which will be tolerated.
selection_methodThere are three selection methods available: tournament, rank, and fitness proportionate.
contestantsspecific to tournament selection. This number of parents will be selected at random and from these the two with the lowest chi-squared values will be chosen as a pair of parents.
substring_lengthdefines the number of characters coding each parameter. This is multiplied by the number of parameters being varied to give the total string length for each parent.
alphabet _sizethe number of different characters encoding the parent. For instance if this variable is given the value 2 the parent will be encoded by a string of ones and twos
elitisman option which, if set to 'yes', always keeps the best few members of each generation.
keptOnly required if elitism is selected. Defines the number of individuals to be carried over to the next generation (if elitism is selected).


generations 10
population 50
prob_cross 0.8
prob_mut 0.02
tolerance 1.0
contestants 3
substring_length 16
alphabet_size 3
selection_method rank
elitism no
kept 2


SFIT allows the observed spectrum to be renormalized using a given model as an appoximate solution. This method is particularly important where the true "continuum" is impossible to identify -- in fact this is generally the case. However it should be applied with caution as it is possible that as assumed solution can be used to "lead" the final solution, by overrectifying broad lines, for example. Therefore three methods are provided. In all, a function is defined by the ratio of approximate solution to observation.

poly npolynomial fit
filter wgaussian filter
special w w2gaussian filter with bad point rejection

Using "poly <n>", an nth order polynomial is fitted to this ratio in those wavelength regions defined by "cmask". The observed spectrum is then multipled by this polynomial to obtain a new spectrum for use by SFIT.

Using "filter <w>", a gaussian filter with FWHM = w is passed through the ratioed spectrum. The observed spectrum is then multipled by this filter to obtain a new spectrum for use by SFIT.

Using "special<w> <w2>", a gaussian filter with FWHM = w2 is passed through the ratioed spectrum wavelength. Points more than 3-sigma from this local mean value are deleted. A second gaussian filter with FWHM = w is passed through the result. The observed spectrum is then multipled by this filter to obtain a new spectrum for use by SFIT.


Defines the observational data to be fitted. This command may take a number of subcommands to define various quantities associated with the observations:

folder <name>

name of folder containing data : DOES NOT WORK AT PRESENT

spectrum <name>

name of file containing spectrum in "spectrum format 2"

w_1, f_1
w_2, f_2
w_nw, f_nw

sigma <sig>

mean standard error on data in 'spectrum'

pamela <name>

name of file containing spectrum in pamela format ( x, y, s )

instrument <fwhm>

FWHM (A) of instrumental broadening function

cosmic <threshold>

Threshold for rejection of fluxes (e.g. due to cosmic ray spikes)

drift <dv>

velocity drift (km/s) during exposure.


The mask command takes the following format:

<ms_1> <me_1> <mw_1>
<ms_2> <me_2> <mw_2>
<ms_n> <me_n> <mw_n>

where <n> is the number of mask windows, <ms>, <me> and <mw> are the start and end wavelengths and weight values for the mask. <mw> should be a small number if you require the fit procedure to ignore data in the given window. SFIT uses a weighted chi-square minimisation approach. The weights are by default assumed to be the standared errors on each observation. In this command, weights are converted to a pseudo standard error by inversion. Thus a "weight" of 0.1 corresponds to a standard error of 10.

Example - to eliminate cores of HeI 4026 and 4388, and emphasize HeI 4471 in fit, assuming an average s.e of 0.01 on each pixel.

4020 4032 0.001
4380 4396 0.001
4465 4477 100.0


The cmask command takes the following format:

<cs_1> <ce_1>
<cs_2> <ce_2>
<cs_n> <ce_n>

where <n> is the number of mask windows, <cs>, and <ce> are the start and end wavelengths and weight values for the continuum mask. These mask regions define regions of spectrum where the continuum level is to be estimated by comparing the current optimum model and the observed spectrum. It does not assume that data in these windows define the continuum per se but rather that the fit is sufficiently good in these regions that the ratio of observed and model spectrum should be close to unity after rectification.


Executes one normalization step and applies it to the current spectrum, using the current parameter estimates, the method defined by continuum and the continuum regions defined by cmask. This command takes no parameters


Compute the best fit parameters by interpolation in the grid of model spectra.

This command takes no parameters; everything should have been set up prior to running solve. The output is saved in a file <file.fit>, where <file> was the name of the spectrum being fitted.


Compute the best fit parameters by computing spectra with variable abundances and v sin i, using a given model atsmosphere. .

This command takes no parameters; everything should have been set up prior to running synth. The output is saved in a file <file.synth>, where <file> was the name of the spectrum being fitted.



Assuming a model spectrum computed at the current estimated paraemters, this command will compute the cross-correlation function with respect to the current observed spectrum and thereby determine the relative radial velocity. This value will then be stored as system variable <vrad_1> to be used in subsequent applications. Hence, this command could be used as a preliminary to solve. This command currently takes no parameters.



This command instructs the fitting software to ignore cosmic rays (or emission lines) in the fit. It does this by assigning a very low weight (large standard error) to all data values more than <threshold> above the continuum level (1.0).

set, show

Certain parameters associated with fitting the data may be set and inpsected manually using these commands. For example,

show all

will print out the current values of all parameters which may be altered manually.

set vrad1 -50.0

will set the values for the primary radial velocity to be used by synth and solve.


A tidy way to finish up.

This page is maintained by:
Simon Jeffery (csj@star.arm.ac.uk)
Last modified: July 7, 2003