ConfigData

The ConfigData family of classes read the configuration data from the configuration file and store the values. There are two classes based on ConfigData:

  • BankData
  • ModeData

BankData stores values read from a specific BANK section of the configuration file (bank dependent), and serve to configure each individual bank, with bank-specific data such as IP addresses, etc. For example: if a Player is controlling Bank A, it will read and record the configuration data from section [BANKA] in the configuration file.

ModeData stores values read from the MODE sections of the configuration file. All modes are used by all backends, depending on instrument configuration.

class ConfigData

class ConfigData.ConfigData[source]

A common base class for data read out of a config file using ConfigParser. It’s main purpose is to serve as a common area for helper functions.

_get_bool(section, key)

get_bool(section, key)

Returns a boolean value, or None if that is not possible. The value in the config file should be one of ‘true’|’false’ (of any character case combination of this), or 0 or 1.

section:
the name of a section in the config file
key:
the key
_get_float(section, key)

get_float(section, key)

Returns a value of type float, or None if that is not possible.

section:
the name of a section in the config file
key:
the key
_get_int(section, key)

get_int(section, key)

Returns a value of type int, or None if that is not possible.

section:
the name of a section in the config file
key:
the key
_get_ints(section, key)

Returns a vector of ints from ‘key’.

section:
the name of a section in the config file
key:
the key
_get_string(section, key)

get_string(section, key)

Returns a value of type string, or None if that is not possible. The string is cleaned up: leading and trailing ‘”’ characters and whitespaces are removed.

section:
the name of a section in the config file
key:
the key
_get_value(self, config, section, key, val_type)

Helper function that looks for ‘key’ in ‘config’ and returns the requested value as type ‘val_type’, or None if that is not possible or the key or value doesn’t exist.

section:
the name of a section in the config file
key:
the key
val_type:
The desired value type. May be str, int, or float.
read_kv_pairs(self, config, section, kvkey)[source]
config:
an open ConfigParser object
section:
the name of a section in the config file
kvkey:
the key of keys

returns: A dictionary of kv pairs, empty if kvkey is not there, or if it doesn’t have any value, or if any of the values are not themselves keys in the section.

Looks in the ConfigParser object for a key-of-keys kvkey which list a set of arbitrary keys to be read that the program does not know about. The value associated with this key is a comma delimited list of keys. The function parses this, then iterates over the keys to obtain the values, returning a dictionary of key/value pairs. Given an entry in a configuration file’s section [MODE1] as follows:

shmkeys = foo,bar,baz
foo = frog
bar = cat
baz = dog

then:

cf.read_kv_pairs(config, 'MODE1', 'shmkeys')
-> {'bar': 'cat', 'baz': 'dog', 'foo': 'frog'}

These may then be used in any way by the Player code. One use, as implied in this example, is to store these values in shared status memory. Another use is to read register/value pairs to be directly written to the FPGA.

class BankData

class ConfigData.BankData[source]

Container for all Bank specific data.

_parse_filter_bw_bits(fbw_string)

Given a comma delimited string of filter bandwidh kv pairs, creates a dictionary with the filter_bw as a key and the I2C bits for that filter_bw as a value.

datahost = None

The 10Gbs IP address for the roach

dataport = None

The 10Gbs port for the roach

dest_ip = None

The 10Gbs HPC IP address

dest_port = None

The KATCP host, on the 1Gbs network

has_roach = None

whether this bank controls a roach or not.

hpchost = None

The host name of the HPC computer hosting the Player

i_am_master = None

Switching Signals master flag. True if this bank is the master.

katcp_ip = None

The KATCP host, on the 1Gbs network

katcp_port = None

The KATCP port on the 1Gbs network

load_config(config, bank)[source]

Given the open ConfigFile object config, loads data for bank. config normally is opened with the config file at $DIBAS_DIR/etc/config/dibas.conf

mac_base = None

The base mac address used to compute individual mac addresses for the roaches.

name = None

The bank name

player_port = None

The port number for the Player, used by the Dealer interface

roach_kvpairs = None

Arbitrary FPGA register key/value pairs. Read from the config file and written directly to the FPGA.

shmkvpairs = None

Arbitrary shared memory key/value pairs. Read from the config file and placed in shared status memory.

synth = None

The location of the Valon serial port: ‘katcp’ (on roach) or ‘local’ (on hpc machine)

synth_options = None

List of Valon options. With the exception of the reference frequency multiplier, all of these are flags which either are clear (0) or set (1): doubler, halver, multiplier, low-spur

synth_port = None

The Valon serial port device (i.e. /dev/ttyS1)

synth_ref = None

The reference frequency: ‘internal’ or ‘external’

synth_ref_freq = None

The frequency of the Valon’s external reference

synth_rf_level = None

The Valon RF level, in dBm. Legal values are -4, -1, 2, and 5

synth_vco_range = None

Valon VCO range

class ModeData

class ConfigData.ModeData[source]

Container for all Mode specific data.

arm_phase = None

Sequence of FPGA register writes necessary to arm the ROACH.

backend_name = None

Name of the backend type. This is used to determine which Backend to instantiate. May be one of:

h1k, h16k l1/lbw1, l8/lbw1, l8/lbw8, guppi-inco, guppi-codd

bof = None

BOF file for this mode

cdd_hpcs = None

The IP addresses of the HPC computers that are the end-points for each the CoDD ROACH’s network adapters. There are 8 of these.

cdd_master_hpc = None

In CoDD mode, the HPC that will control the ROACH. Since theCoDD modes only use 1 ROACH but 8 HPC machines, one must be designated to be the controller.

cdd_mode = None

Flag, whether this mode is a coherent de-dispersion mode.

cdd_roach_ips = None

The IP addresses of the onboard network adapter for the CoDD roach. The CoDD roach has 8 of these. This is a dictionary, keyed by bank name:

datahost = self.cdd_roach_ips[bankname]
filter_bw = None

Filter bandwidth

frequency = None

Valon frequency

gain = None

Optional gain values for LBW modes. L1LBW1 and L8LBW1 only require on value. L8LBW8 require 8, as a vector.

hpc_program = None

The HPC DAQ program that will handle data for this mode: ‘vegas_hpc_server’, ‘guppi_daq_server’, etc.

hpc_program_flags = None

Optional command-line parameters to pass into the hpc program specified.

hwexposr = None

Shortest possible integration, in seconds

load_config(config, mode)[source]

Given the open ConfigFile object config, loads data for mode. config normally is opened with the config file at $DIBAS_DIR/etc/config/dibas.conf

master_slave_sels = None

This dictionary contains the master/slave select values.

The value chosen depends on whether the backend is master, what the switching signal source is (internal/external), and what the blanking source is (internal/external).

Typical config file entry:

0x00,0x00,0x00,0x0E,0x00,0x00

The order of the elements is as follows, where ‘m’ is master, ‘s’ is slave, ‘int’ is internal, and ‘ext’ is external:

m/int/int, m/int/ext, m/ext/ext, s/int/int, s/int/ext, s/ext/ext

A typical use would be: ssg_ms_sel = self.name.master_slave_sels[master][ss_source][bl_source] where:

master
is the master flag (0=slave, 1=master),
ss_source
is the switching signal source (0=internal or 1=external), and
bl_source
is the blanking source (0=internal or 1=external)
name = None

Mode name

nchan = None

Number of channels, BOF specific value

needed_arm_delay = None

The time needed by the backend to arm in this mode.

postarm_phase = None

Sequence of FPGA register writes required post-arm.

reset_phase = None

Sequence of FPGA register writes necessary to reset the ROACH.

roach_kvpairs = None

Arbitrary FPGA register/value pairs that are to be written to the FPGA for this mode.

sg_period = None

BOF specific value

shmkvpairs = None

Arbitrary shared memory keys to be placed into status shared memory for this mode.

Table Of Contents

Previous topic

Backend

Next topic

ValonKATCP

This Page