icosfit configfile
ICOSfit is a non-linear least-squares fit algorithm originally developed for processing ICOS data from the Anderson Group's ICOS instrument.
The icosfit source code is maintained in a subversion repository on Harvard's ABCD Forge server. A binary distribution is available for use under Cygwin, and a source tarball is available for other platforms.
icosfit
is invoked from the command line with the name of a configuration file.
All options are specified within that configuration file.
All options are specified within the configuration file.
The input/output options define where the input files are to be found and where the output files should be placed.
PTEFile = Path;
PTFile = Path;
DeprecatedPandTFile = Path;
DeprecatedICOSdir = Path;
Binary;
ASCII;
BaselineFile = Path [ + Input ];
writeskewbase
matlab routine.OutputDir = Path;
ICOSout
.OutputFile = Path
ICOSsum.dat
.
If the specified filename does not include an absolute path, it will be located
in the OutputDir
.LogFile = Path
ICOSfit.log
.
As with OutputFile, the LogFile will be located in the OutputDir
unless an absolute path is specified.MFile = Path
ICOSconfig.m
, and it will also be located in the
OutputDir
unless an absolute path is specified.Since the primary purpose of icosfit is to fit absorption lines, defining what lines we are trying to fit is an important part of the configuration. Each configuration file should have a line definition block containing zero or more line definitions:
Lines = { 1 4 1332.015310 1.464e-23 0.0918 221.9461 0.78 -0.002000 344, Position=1518; 6 1 1332.085300 5.760e-20 0.0641 104.7800 0.75 -0.003000 577, Position=1453; 1 2 1332.191200 3.239e-25 0.0865 839.5495 0.70 -0.000260 344, Position=1353; };
Each line definition line consists of nine numbers followed by zero or more optional elements. The nine numbers are taken almost directly from the HITRAN database. Details of the applciation of the line parameters can be found in the Appendix to the 1998 JQSRT Paper. They are listed below with the column number from the HITRAN output listed in parentheses:
The optional elements are added after these nine numbers, each preceeded by a comma. They are:
Position =
SampleNumber;Threshold =
value;Fix Doppler;
Fix Lorentz;
Fix FinePosition;
Float Doppler;
Float Lorentz;
Float FinePosition;
Except for Position
, these options can also be
specified globally and then modified for individual lines.
The fitting options are loosely grouped into the following sub-categories:
BackgroundRegion = IntegerPair;
[10,200]
.SignalRegion = IntegerPair;
[350,1750]
.ScanNumRange = IntegerPair;
QCLI_Wave = Integer;
.cmd
output file).
All scans for a particular run of icosfit must be of the same waveform.Restart at Integer;
Restart at Integer PreserveOutput;
MirrorLoss = FloatVal ppm;
CavityLength = FloatVal cm;
CavityFixedLength
to determine the full absorption path length.CavityFixedLength = FloatVal;
SampleRate = FloatVal Frequency;
0 Hz
.SkewTolerance = FloatVal ppm;
10 ppm
.N_Passes = Integer;
EtalonFSR = FloatVal cm-1;
0.019805
. Reported concentrations scale linearly with EtalonFSR,
so errors in EtalonFSR will propogate. It should be possible to diagnose
such errors if the reported positions of free lines show a systematic error
which varies linearly with wavenumber. Such a diagnostic is likely to make
sense only when skew is taken into account.MinimumFringeSpacing = FloatVal;
12
.DSFRLimits = [ FloatVal , FloatVal ];
[.95,1.21]
. DSFR values near .5 or 2 are an indication that
an spurious fringe was identified or a fringe was missed, and therefore that
the determined tuning rate is seriously suspect and that the current scan
should be discarded.TuningRate = FloatVal cm-1/sample;
TolerableDrift = FloatVal cm-1;
.01 cm-1
.LineMargin = FloatVal cm-1;
LeftLineMargin = FloatVal cm-1;
(v 2.12)RightLineMargin = FloatVal cm-1;
(v 2.12)LineMarginMultiplier
half-widths
that should be include or excluded from the fit.
Defaults to .05 cm-1
.LineMarginMultiplier = FloatVal;
LeftLineMarginMultiplier = FloatVal;
(v 2.12)RightLineMarginMultiplier = FloatVal;
(v 2.12)Sigma = FloatVal;
FitFunction = Ident;
ConvergenceStep = FloatVal;
(v 2.15)ConvergenceCount = Integer;
(v 2.15)ConvergenceStep
iterations
where the relative reduction in χ2 is less than ConvergenceStep
.
The default value is 4, as it was in all versions prior to v 2.15. Numerical Recipes
suggests that 1 or 2 might be reasonable.
values.
MaxIterations = Integer;
(v 2.15)MaxIterations
, if not before, and continue to the next scan with a
warning in the log. In a future version, the number of iterations executed will be
reported in the standard output file.
The following grammar is specified in the syntax of the Extended Backus Naur Form or EBNF. This shows you what you can legally specify in a configuration file. Discussion of what these things actually do will follow.
ConfigFile : ConfigLine+ . ConfigLine : ConfigCmd ';' . ConfigCmd : Linedef / BackgroundRegion = IntegerPair / SignalRegion '=' IntegerPair / ScanNumRange '=' IntegerPair / Restart at Integer opt_preserve / FitFunction '=' Ident / MirrorLoss '=' FloatVal opt_ppm / EtalonFSR '=' FloatVal opt_cm / MinimumFringeSpacing '=' FloatVal / DSFRLimits '=' '[' FloatVal ',' FloatVal ']' / TolerableDrift '=' FloatVal opt_cm / LineMargin '=' FloatVal opt_cm / LeftLineMargin '=' FloatVal opt_cm / RightLineMargin '=' FloatVal opt_cm / LineMarginMultiplier '=' FloatVal / LeftLineMarginMultiplier '=' FloatVal / RightLineMarginMultiplier '=' FloatVal / CavityLength '=' FloatVal / Sigma '=' FloatVal / TuningRate '=' FloatVal opt_tunerate / QCLI_Wave = Integer / SampleRate = FloatVal Frequency / SkewTolerance = FloatVal opt_ppm / ConvergenceStep = FloatVal / ConvergenceCount = Integer / MaxIterations = Integer / Threshold / FixLineParam / Binary / ASCII / ICOSdir '=' Path / PTEFile '=' Path [ '+' 'nu_F0' ] [ '+' 'PowerParams' ] [ '+' 'MirrorLoss' ] / PandTFile '=' Path / Deprecated PTFile '=' Path / Deprecated BaselineFile '=' Path [ + Input ] / OutputDir '=' Path / OutputFile '=' Path / LogFile '=' Path / MFile '=' Path / Verbosity '=' Integer . Path : PathStr / Ident . IntegerPair : '[' Integer ',' Integer ']' . opt_ppm : / '%' / ppm . opt_cm : / 'cm-1' . opt_preserve : / PreserveOutput . opt_tunerate : / 'cm-1' '/' sample . Frequency : / 'Hz' / 'kHz' / 'MHz' . Threshold : Threshold '=' FloatVal . Position : Position '=' Integer . Linedef : Lines '=' '{' Line* '}' . Line : Integer Integer FloatVal FloatVal FloatVal FloatVal FloatVal FloatVal Integer LineOpts ';' . LineOpts : ( ',' LineOpt )* . LineOpt : Threshold / Position / FixLineParam . FixLineParam : FixFloat LineParam . FixFloat : Fix / Float . LineParam : Lorentz / Doppler / FinePosition . FloatVal : Float / Integer / '-' FloatVal .
Float : A floating point constant as defined in C Integer : A string of decimal digits Ident : A string of letters, digits and underscores PathStr : A filename path
|
|
ICOS files are located in the directory hierarchy specified under the
ICOSdir
statement. They are written into multiple directories
according to the conventions of the
multi-level file subroutines of
nortlib. Binary and ASCII formats are supported,
as specified by the Binary
and ASCII
statements.
The ASCII format consists of two columns, space-delimited. The first column is the ICOS data, and the second column is the diagnostic etalon data. The sample number is implicit, starting with 1.
The binary format is preferred, since it takes up less disk space and is now generated by default.
Format | values | Name | Description |
---|---|---|---|
uint32 | 1 | nsamples | The number of rows in the file. |
uint32 | 1 | ncolumns | The number of columns in the file. |
float32 | nsamples | Col1 | The data for column 1 |
float32 | nsamples | Col2 | The data for column 2 |
... | |||
float32 | nsamples | Coln | The data for column ncolumns |
At the moment, the number of columns is 2, with the first column being the ICOS data
and the second column being the diagnostic etalon data. As with the ASCII format, the
sample number is implicit, starting with 1. uint32
is an unsigned 32-bit
integer in little-endian format. float32
is a 32-bit floating point value
in little-endian IEEE format.
Newer versions of the SSP driver include the full SSP scan header in each file. This format can be automatically distinguished from the ICOS File Format, so no distinction is required in the configuration files.
Format | values | Name | Description |
---|---|---|---|
uint32 | 0x00010006 | Format | Identifies this format |
uint8 | 1 | NChannels | The number of columns in the file minus one. |
uint8 | 1 | NF | Sample Clock Divider |
uint16 | 1 | NSamples | The number of rows in the file. |
uint16 | 1 | NCoadd | The number of scan averaged. |
uint16 | 1 | NAvg | The number of samples averaged. |
uint16 | 1 | NSkL | The number scans dropped before final coadd |
uint16 | 1 | NSkP | The number scans dropped before initial coadd |
uint32 | 1 | SerialNum | The serial number of the final scan in coadd |
uint16 | 1 | T_HtSink | Heat Sink Temperature |
uint16 | 1 | T_FPGA | FPGA Temperature |
uint32 | 1 | SSPStatus | SSP Status Flags |
float32 | nsamples | Col1 | The data for column 1 |
float32 | nsamples | Col2 | The data for column 2 |
... | |||
float32 | nsamples | Coln | The data for column ncolumns |
PTEFile = Path [ '+' 'nu_F0' ] [ '+' 'PowerParams' ] [ '+' 'MirrorLoss' ] ;
The PTEFile
statement specifies the file containing
per-scan input parameters. The primary data is stored in the first 11
columns:
Column | Name | Description | Units |
---|---|---|---|
0 | ScanNum | Scan File Index | |
1 | CellP | Cell Pressure | Torr |
2 | Tavg | Cell Temperature | K |
3 | Etln[0] | Sample Number Offset | Samples |
4 | Etln[1] | Constant Coef. | fringes |
5 | Etln[2] | Linear Coef. | fringes/Ksamples |
6 | Etln[3] | Quadratic Coef. | fringes/Ksamples^2 |
7 | Etln[4] | 1st exp amp. | fringes |
8 | Etln[5] | 1st exp tau | Ksamples |
9 | Etln[6] | 2nd exp amp. | fringes |
10 | Etln[7] | 2nd exp tau | Ksamples |
[Introduced in V2.20]: The PTEFile may also contain additional parameters in additional columns.
Three documented parameters are currently supported: nu_F0, PowerParams
and MirrorLoss
. These parameters must be specified in same order
as they appear in the file, although any ordering is supported. Additional
columns will be ignored.
[Introduced in V2.20]: '+ nu_F0
' specifies one additional column which will contain
a fixed value for the nu_F0
parameter. This is useful when fitting
weak lines through periods of very low concentration where the line positions are
changing gradually. At low concentrations, the nu_F0
parameter is
usually fixed, which can allow the line position to drift away. After fitting,
possibly in separate regions, it is possible to interpolate reasonable values
for nu_F0
, write them into the PTEFile, add the + nu_F0
option, and icosfit will use the specified values for nu_F0
without
floating the parameter.
Column | Name | Description | Units |
---|---|---|---|
N+1 | νF0 | Wavenumber of fringe zero | cm-1 |
[Introduced in V2.20]: '+ PowerParams
' specifies seven additional columns which will contain
additional parameters from the etalon fit. These values are not used by icosfit, but
it is convenient to have etln_fit
write them into the PTEFile for other
related analyses. Specifying etln_fit( ..., 'SAVEALL', 1)
produces these
additional columns. It also includes a column of zeros as a placeholder for
+ nu_F0
, so + PowerParams
should always be preceeded by
The columns introduced by + PowerParams
are:
Column | Name | Description | Units |
---|---|---|---|
N+1 | Etln[8] | Etalon Power Cubic Coef. | Power Ksamples-3 |
N+2 | Etln[9] | Etalon Power Quadratic Coef. | Power Ksamples-2 |
N+3 | Etln[10] | Etalon Power Linear Coef. | Power Ksamples-1 |
N+4 | Etln[11] | Etalon Power Constant Coef. | Power |
N+5 | Etln[12] | Etalon Finesse | |
N+6 | N_Passes | Number of passes required by fit | |
N+7 | Quality | std(residual)/(max(etln)-min(etln)) |
[Introduced in V2.20]: '+ MirrorLoss
' specifies one additional column containing the
MirrorLoss value for each scan. This overrides the MirrorLoss
parameter
in the configuration file and can be used when the mirror loss can be derived
from the end of each ICOS scan. The MirrorLoss column is unitless, so it should
include the relevant scaling factor (e.g. ppm).
Column | Name | Description | Units |
---|---|---|---|
N+1 | L | Mirror Loss | unitless |
PTFile = Path;
The PTFile
keyword and file format are deprecated, and
support will be removed in a future version.
The PTFile
statement identifies the file which
contains the pressure and temperature data for the scans. This
data is in a text format, and is generated via a TMC extraction
(PText) and an SNAFU text output script (totext.snf). The
contents are:
Column | Name | Description | Units |
---|---|---|---|
0 | Time | Seconds since 00:00:00 1/1/70 UTC | sec |
1 | CellP | Cell Pressure | Torr |
2 | Tavg | Cell Temperature | K |
3 | ScanNum | Scan Number | |
4 | Cal_F | Calibration Flow | SCCM |
5 | InltF | Inlet Flow | SCCM |
6 | RORIS | 1=>Ringdown, 0=>ICOS | |
7 | RateS | 1=>50 Hz, 0=>10Hz |
As of icosfit V1.9 and CR VERSION 1.3, RORIS has been replaced with QCLI_Wave, an integer value indicating which waveform is currently being sampled. This is backwards compatible, since the default value of zero is consistent with the acceptable value for RORIS.
PandTFile = Path;
The PandTFile
keyword and file format are deprecated, and
support will be removed in a future version.
The PandTFile
statement specifies the use of an earlier
file format for pressure and temperature. The PT format is preferred.
Column | Name | Description | Units |
---|---|---|---|
0 | Time | Seconds since 00:00:00 1/1/70 UTC | sec |
1 | CellP | Cell Pressure | Torr |
2 | Gas1T | Cell Temperature | Celcius |
3 | Gas2T | Cell Temperature | Celcius |
4 | Gas3T | Cell Temperature | Celcius |
5 | Gas4T | Cell Temperature | Celcius |
6 | CPCI14 | Scan Number | |
7 | CPCI16 | Scan Number (non-existant) | |
8 | Cal_F | Calibration Flow | SCCM |
9 | InltF | Inlet Flow | SCCM |
10 | RORIS | 1=>Ringdown, 0=>ICOS | |
11 | RateS | 1=>50 Hz, 0=>10Hz |
BaselineFile = Path [ + Input ];
There are currently two baseline fitting functions, each providing
considerable flexibility in how the baseline is approximated. Selection
between the two functions is determined by the format of the specified
BaselineFile
. If the optional '+ Input' is included,
the third channel in each input file is treated as a baseline input
vector with a free scaling parameter.
func_base_svdx
BaselineFile
in standard ICOS binary format. Each column is taken as a baseline
basis vector over the raw sample space. The derived baseline is
a linear combination of these basis vectors. The generic files
sbase.linear
and sbase.cubic
are
useful starting points, providing linear and cubic approximations
respectfully.writebase
and writeskewbase
are used
to output the vectors in the correct format.
func_base_ptbnu
writeetlnbase
. The file format
supports basis vectors
that are a function of wavenumber rather than sample number, plus
a polynomial that is a function of either wavenumber or sample number.
ICOSfit produces several output files:
ICOSconfig.m is a human-readable Matlab script that defines a number of variables relevant to the fit. If any format change is made to ICOSsum.dat, a corresponding change should be made to ICOSconfig.m to guarantee that the support utilities will be able to correctly interpret data both before and after the change.
ICOSconfig.m is generated in the source file ICOSmain.c and it is processed by ICOSsetup.m and ICOS_setup.m.
ICOSsum.dat contains the results of the fit, with one line per scan. It is generated in the function fitdata::lwrite() in the source file fitfunc.c and it is processed by ICOSsetup.m and/or ICOS_setup.m. In the absence of more documentation, refer to those sources to see how the file is produced and processed.
Return to Manuals Guide
last updated: Sun Feb 1 2015 10:15 EST | webmaster@huarp.harvard.edu |
© 2015 by the President and Fellows of Harvard College |