VHC configuration

vhc execution is driven by a configuration file, whose name is defined in DEF_CONFNAME.

Since the VHC development and the configuration updates are decoupled we store and track the configurations in a separate svn repository.

Get it

To get the repository execute:

svn checkout svn://luna.mpe.mpg.de/vhc_config

or:

svn checkout svn://luna.mpe.mpg.de/vhc_config/trunk vhc_config

Edit and commit it

We want to be able to keep track of all the changes to the configuration files and to be able to replicate any of the results from vhc. We have added at the top of the configuration file the following section

[svn]
# DO NOT EDIT
# these options are automatically set when doing an svn commit. They are
# used to track the changes when running vhc. vhc should query these options
# without interpolation
date = $Date: 2015-03-23 14:25:45 +0100 (Mon, 23 Mar 2015) $
revision = $Revision: 3 $
author = $Author: montefra $

The date, revision and author entries are updated automatically by svn when committing. These options will be gathered by vhc and saved somewhere (to be decided).

Thus, any set of edits belonging together and that are used for any kind of observation must be committed together to the repository before the start of observations and the repository must be updated.

The description and motivation of the changes should be added to the Changelog file.

To force svn to update the above options, we have added a pre-commit hook that refuses the commit if vhc_settings.cfg has not been modified.

If vhc_settings.cfg has been modified, changes can be committed using the standard command:

svn commit

Otherwise, you can run the script touch_commit.sh:

Usage:
    touch_commit.sh [-hnt]

Change the property 'touchsettings' of file 'vhc_settings.cfg' to a
random string and commit. If the file 'svn-commit.tmp' is available
in the current or parent directory and '-t' option is not given, it
will be used to provide the commit message and, if successfull, it
will be removed.

    -h
        print this help

    -n
        don't do the commit

    -t
        don't use the 'svn-commit.tmp' file for the svn commit
        message

If svn-commit.tmp file is found, its content is printed to screen before the prompt for the svn password, so it is possible to abort the commit if the message is wrong.

Directory structure

├── Changelog
├── fplane              # everything related to the focal plane
│   └── fplane.txt      # the focal plane file: position and ids of the IFUs
├── README.md           # information about the repository
├── reference_files     # VHC reference files
│   ├── arcs.txt        # line list files and tolerance in the pixel position
│   ├── bias.txt        # expected bias mean and standard deviation
│   ├── distfiles.txt   # list of distortion file names
│   ├── distfiles       # reference distortion files
│   │   ├── mastertrace_045L.dat
│   │   ├── [...]
│   │   └── mastertrace_046R.dat
│   ├── linefiles       # reference line list files
│   │   ├── lines_045L.dat
│   │   ├── [...]
│   │   └── lines_046R.dat
│   ├── n_fibers.txt    # number of expected fibers
│   └── overscan.txt    # expected overscan mean and standard deviation
├── scripts             # auxiliary scripts
│   └── replace_idca.py
├── touch_commit.sh     # touch vhc_settings.cfg and commit
└── vhc_settings.cfg    # configuration file

Use it

The most important file is vhc_settings.cfg, and VHC expects to find it in one of the following locations:

  • environment variable VHC_CONFIG containing the file name
  • ./vhc_config/vhc_settings.cfg
  • $HOME/.config/vhc_config/vhc_settings.cfg
  • /etc/vhc_config/vhc_settings.cfg

So we suggest either to point to the current repository with e.g.:

export VHC_CONFIG=/path/to/vhc_config/trunk/vhc_settings.cfg

or:

export VHC_CONFIG=/path/to/vhc_config/vhc_settings.cfg

or to copy/symlink the vhc_config directory in one of the given directories.

A note on the vhc_config directory

In the configuration file there are references to other files in the vhc_config repository. To prevent the user having to modify the vhc_settings.cfg file in order to set the correct path for these files, the options:

curebin = ${curebin_env}
config_dir = ${vhc_config_dir}

have been added in the general section. The values vhc_config_dir and curebin_env are inserted in the configuration object defaults by vhc. So if the configuration directory is set as suggested in the previous section, config_dir contains the correct path to the configuration directory.

Configuration file

In the configuration file we allow cross-section interpolation of the variables. This means that it is possible to build the value of an option using the value of another option, even if it is in another section of the file.

Example

[general]
directory = /path/to/directory
[section]
file = ${general:directory}/file.txt
subdir = a/subdir
otherfile = ${subdir}/file.dat

resolves into:

file = /path/to/directory/file.txt
otherfile = a/subdir/file.dat

Note: this kind of interpolation is built into the Python 3 configuration parser. In order to make it available to vhc also when running python 2 we make use of a custom configuration parser class implemented in pyhetdex.tools.configuration