DBBC3Commandset
Module¶
DBBC3Commandset
class¶
This module is part of the DBBC3 package and implements the command sets of the DBBC3 for the various modes and versions
- class DBBC3Commandset(clas, version=None)¶
Bases:
object
Base class for all DBBC3 commandset implementations
Upon construction the appropriate sub-class implementing the command set for the given version and mode is determined and dynamically attached.
If version is not given the latest implemented version for the activated mode will be used.
- Parameters
clas (object) – the class to which to attach the DBBC3Commandset
version (str, optional) – the command set version
DBBC3CommandsetDefault
class¶
This module is part of the DBBC3 package and implements the command sets of the DBBC3 for the various modes and versions
- class DBBC3CommandsetDefault(clas)¶
Bases:
DBBC3Commandset
The basic class implementing all commands common to all DBBC modes and versions.
All sub-classes implementing commands that are special to a specific mode or version should be derived from DBBC3CommandsetDefault or from the appropriate upstream class and should follow the class naming convention: DBBC3Commandset_MODE_VERSION e.g. DBBC3Commandset_OCT_D_110
- adb3l_delay(board, sampler, value=512)¶
Warning
This is an expert level method and is intended for debugging purposes only. Wrong usage could bring the DBBC3 system into an unstable state and could lead to unwanted or unexpected results. Use only if you know what you are doing!
Sets the sampler delay for the specified board and sampler.
The allowed range is 0-1023 which corresponds to -60ps to +60ps with a stepping size of 120fs. The default is 512 = 0ps.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
sampler (int) – sampler number (0-3)
value (int, optional) – the delay value in steps of 120fs. Default is 512 (=0ps)
- Returns
None
- Raises
ValueError – in case the specified sampler is out of range
ValueError – in case the specified value parameter is out of range
- adb3l_gain(board, sampler, value=512)¶
Warning
This is an expert level method and is intended for debugging purposes only. Wrong usage could bring the DBBC3 system into an unstable state and could lead to unwanted or unexpected results. Use only if you know what you are doing!
Sets the sampler gain value for the specified board and sampler.
The allowed range is 0-255 which corresponds to -0.5dB to +0.5dB with a stepping size of 0.004dB. The default is 128 = 0dB.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
sampler (int) – sampler number (0-3)
value (int, optional) – the offset value in steps of 0.004dB. Default is 128 (=0 dB)
- Returns
None
- Raises
ValueError – in case the specified sampler is out of range
ValueError – in case the specified value parameter is out of range
- adb3l_offset(board, sampler, value=128)¶
Warning
This is an expert level method and is intended for debugging purposes only. Wrong usage could bring the DBBC3 system into an unstable state and could lead to unwanted or unexpected results. Use only if you know what you are doing!
Sets the sampler offset value for the specified board and sampler.
The allowed range is 0-255 which corresponds to -20mV to +20mV with a stepping size of 156microV. The default is 128 = 0mV.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
sampler (int) – sampler number (0-3)
value (int, optional) – the offset value in steps of 156 microV. Default is 128 (=0 mV)
- Returns
None
- Raises
ValueError – in case the specified sampler is out of range
ValueError – in case the specified value parameter is out of range
- adb3l_reset()¶
Resets all ADB3L boards and sets the registers to default values
- Returns
None
- adb3l_reseth()¶
Resets all ADB3L boards, but does NOT change/reset any register settings
- Returns
None
- adb3l_resets(board, sampler=None)¶
Resets the ADB3L registers to default values for the specified board and sampler
If called without the optional sampler parameter a reset is performed for all samplers of the specified board.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
sampler (int, optional) – sampler number (0-3)
- Returns
None
- adb3linit()¶
Performs full reset of all ADB3L boards
All ADB3L boards are fully reinitialized to the setting defined in the configuration file.
- Returns
True if the ADB3L boards were successfully reinitialized; False otherwise
- Return type
boolean
- checkphase()¶
Checks whether all samplers of all core boards are in sync
Warning
Do not execute checkphase while observing/recording data! Data will be invalid while checkphase is running due to phase shifting of the sampler outputs.
In case one or more samplers are not in sync use lastResponse to receive information on the failed board(s)
- Returns
True if all samplers are in sync, False otherwise
- Return type
boolean
- core3h_arp(board, mode=None)¶
Enables or disables ARP queries on all ethernet cores.
If called without the mode parameter the current setting is reported
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
mode (str, optional) – Can be “on” or “off”.
- Returns
the current ARP mode (“on” / “off”) or “unknown” in case the arp mode could not be determined
- Return type
str
- Raises
ValueError – in case an illegal mode has been requested
- core3h_core3_bstat(board, sampler)¶
Obtains the 2-bit sampler statistics for the given core board and sampler.
- Parameters
board (int or str) – can be given as a number (0 = board A) or as char e.g. A
sampler (int) – the sampler number (starting at 0)
- Returns
list containing the count of the 4 levels or None if the core board is not connected
- Return type
list
- core3h_core3_corr(board)¶
Performs cross-correlation between the samplers of the given board.
- Correlation products are calculated between these sampler pairs:
0-1
1-2
2-3
- Parameters
board (int or str) – can be given as a number (0 = board A) or as char e.g. A
- Returns
List containing the three cross-correlation coefficients in the order described above
- Return type
list
- core3h_core3_init(board)¶
Initializes the given core3h board and sets parameters as specified in the control file.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
True if successful False otherwise
- Return type
boolean
- core3h_core3_mode(board, mode=None)¶
Gets or sets the Core3h mode.
If the optional mode parameter is ommited the currently set mode is returned. If specified mode must be a valid core3h mode (as listed in
DBBC3.core3hModes
)- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
mode (str, optional) – if ommited gets the currently active mode
- Returns
the current mode
- Return type
str
- core3h_core3_power(board)¶
Obtains the gains of all 4 samplers of the given board
- Parameters
board (int or str) – can be given as a number (0 = board A) or as char e.g. A
- Returns
list containing the gains for all samplers (a[0] = sampler1 etc.) or None in case the core3 board is not connected
- Return type
list
- core3h_destination(board, outputId, ip='', port=46227, threadId=-1)¶
Sets / gets the output destination address and port for the given board and outputId.
If called without specifying only the outputId the current destination settings are returned.
When the ip parameters is set to None the respective output is disabled and no frames will be sent.
When specifying a threadId only frames from that thread are addressed to the given destination. Other threads will not be affected. This is useful when using multi-threaded VDIF. Likewise a single thread can be disabled by setting ip=None and specifying a threadID.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
outputId (int) – the index of the Core3h output device (starting at 0)
ip (str) – the destination IP address
port (int, optional) – the destination IP port number (default = 46227)
threadId (int) – the id of the tread for which to set the destination
- Returns
dictionary with the following structure:
"ip" (str): the IP address "port" (int): the port "output" (int): the index of the core3h output port (starting at 0) "thread_0" (dict, optional): dictionary holding destination "ip" and "port" for thread 0 (if defined) "thread_1" (dict, optional): dictionary holding destination "ip" and "port" for thread 1 (if defined) "...."
- Return type
dict
- core3h_devices(board)¶
Lists all devices of the the current system and their corresponding memory address ranges
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
dictionary with the following structure:
"devicename" (str): the name of the device "value" (str): memory address range
- Return type
dict
- core3h_inputselect(board, source)¶
Selects one of the available input data sources.
The command implicitly resets the VSI bitmask, input width and VSI swap settings to their respective defaults.
- The input width is reset to:
32bit for tvg, vsi1 and vsi2
64bit for vsi1-2
128bit for vsi1-2-3-4
TODO: update the documentation TODO: Find out about “vsi1-2-3-4-5-6-7-8”
Note
It is recommended to execute
core3h_reset()
(with or without the keepsync option) after changing the input source- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
source (str) – one of “tvg”,”vsi1”,”vsi2”,”vsi1-2”,”vsi1-2-3-4”,”vsi1-2-3-4-5-6-7-8”
- Returns
the current split mode setting; “unknown” if the mode could not be determined
- Return type
str
- Raises
ValueError – in case an unknown mode has been specified
- core3h_mode_fs(board)¶
Returns mode information in a machine-readble form (field-system)
TODO: implement parsing codes
Parameters: board: the board number (starting at 0=A) or board ID (e.g “A”)
- core3h_output(board, outputIdx=0, frameId=0)¶
Displays output debug information.
The command displays the first 16 words of the first frame that was sent within the current second interval. The frame is recorded at the output specified by outputIdx.
In addition the following data is displayed: 1PPS/frame-header/end-of-frame/frame-drop bits
TODO: implement output parsing
- core3h_reboot(board)¶
Reboots the system.
The FiLa10G hardware and software for the given board is reset to its initial state, i.e. as it was directly after the programming of the FPGA and lets the FiLa10G system boot again.
Warning
All previously configured settings and states are lost when rebooting!
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
True: if successful False: otherwise
- Return type
boolean
- core3h_regread(board, regNum, device='core3')¶
Reads the value of the device register
Note
Not all devices have readable registers. See the DBBC3 documentation for the core3h “devices” command. The list of available devices can be obtained with the
core3h_devices()
command.- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
regNum (int) – the index of the device register to read
device (str) – the name of the device (as returned by the
core3h_devices()
command). default = core3
- Returns
tuple containing:
register value in hexadecimal string format register value in binary string format register value in decimal format (signed 32-bit)
- Return type
tuple (str,str,int)
- core3h_regread_dec(board, regNum, device='core3')¶
Reads the decimal value of the device register
Note
Not all devices have readable registers. See the DBBC3 documentation for the core3h “devices” command. The list of available devices can be obtained with the
core3h_devices()
command.- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
regNum (int) – the index of the device register to read
device (str) – the name of the device (as returned by the
core3h_devices()
command). default = core3
- Returns
The decimal value of the device register
- Return type
int
- core3h_regupdate(board, device, regNum, value, bitmask)¶
Updates only certain bits of the value of a device register
Note
Not all devices have writable registers. See DBBC3 documentation for “devices” command
The bitmask must be in hexadecimal format.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
device (str) – the name of the device (as returned by the
core3h_devices()
command). default = core3regNum (int) – the index of the device register to read
value (hex) – the register value to write; must be 32-bit hexadecimal string, e.g. 0x01020304
bitmask (hex) – the 32-bit hexadecimal bitmask; 1=overwrite 0=leave unchanged
- Returns
True if value was changed; False otherwise
- Return type
boolean
- Raises
ValueError – in case the supplied value is not in hex format
ValueError – in case the supplied bitmask is not in hex format
- core3h_regwrite(board, device, regNum, value)¶
Writes a value into the device register
Note
Not all devices have writeable registers. See the DBBC3 documentation for the core3h “devices” command. The list of available devices can be obtained with the
core3h_devices()
command.- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
device (str) – the name of the device (as returned by the
core3h_devices()
command). default = core3regNum (int) – the index of the device register to read
value (hex) – the register value to write; must be a 32-bit hexadecimal string, e.g. 0x01020304
- Returns
True if value was changed; False otherwise
- Return type
boolean
- Raises
ValueError – in case the supplied value is not in hex format
- core3h_reset(board, keepsync=False)¶
Resets the FiLa10G datapath
If called without arguments the complete datapath is reset and time synchonization is lost.
If called with keepsync=True, FiLa10G tries to maintain the current time synchronization. For this to work the input stage of the data path and the timers are not reset.
Warning
Time synchronization will not be correct anymore in the rare but possible case that a data sample with a 1PPS flag is lost during the reset process.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
keepsync (boolean, optional) – keeps the time synchronization if set to True. Default=False
- Returns
True: if successful False: otherwise
- Return type
boolean
- core3h_splitmode(board, mode)¶
Enables / Disables the split mode
When split mode is enabled the selected and bitmasked input data is split into two halves exactly in the middle. The two halves will be processed as if they were independent input streams, The lower half (by bit position) is output at output0 the higher half is output as output1.
Split mode requires an input width of at least 2 bit.
Note
Raw and vdif format can be applied independently to each split stream with the help of the
core3h_start()
command syntaxNote
In order to specify a correct VDIF frame setup you have to take into account that the effective input width is halved when the split mode is enabled.
Note
A restriction of the split mode is that only output0 is capable of producing multi-threaded VDIF data. At output1 the data will always be forced to be single-threaded, regardless of the chosen frame setup.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
mode (str) – “on” or “off”
- Returns
the current split mode setting (“on”/”off”); “unknown” if the mode could not be determined
- Return type
str
- Raises
ValueError – in case an unknown mode has been specified
- core3h_start(board, format='vdif', force=False)¶
Starts/restarts sending of formatted output data
- The output data format can be either:
vdif: VDIF format
raw: unformatted
In case a single output format is given, this will be used for all outputs. Formats can be set for each of the outputs individually by separating the format specifiers by “+” e.g. vdif+raw+vdif+raw if not explictely specified “vdif” will be used for all outputs.
Raw format requires no time synchronization whereas vdif format requires the respective timer to be synchronized (see
core3h_timesync()
)For fast testing: set the force parameter to True to automatically synchronize the timer to “zero” time(=’2000-01-01T00:00:00’). Provided that a valid 1PPS signal is available this will always be successful.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
format (str, optional) – a single format specifier or several concatenated by +. Default is “vdif”
force (boolean, optional) – if set to True synchronize time to ‘2000-01-01T00:00:00’. Default is False
- Returns
list of format specifiers for all outputs of the specified board
- Return type
list
- Raises
ValueError – in case the number of format specifiers exceed the number of available outputs
ValueError – in case an unkown format specifier was given
- core3h_status_fs(board)¶
Returns time sync information in a machine-readble form (field-system)
TODO: implement parsing codes
Parameters: board: the board number (starting at 0=A) or board ID (e.g “A”)
- core3h_stop(board)¶
Stops sending of output data
The opposite of
core3h_start()
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
True in case the output of data was stopped; False otherwise
- Return type
boolean
- core3h_sysstat(board)¶
Displays information about the current status of the system and gives an overview of the state of the most important user settings.
All key value pairs of the sysstat output are returned as a dictionary. All whitespaces have been converted to ‘_’ all characters have been converted to lower-space.
- Parameters
board – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
a dictionary with the systat key value pairs with whitespaces converted to ‘_’
Example
[{‘selected_input’: ‘vsi1’, ‘input_sample_rate’: ‘128000000 Hz / 2’, ‘vsi_input_swapped’: ‘no’, ‘vsi_input_bitmask’: ‘0xFFFFFFFF’, ‘vsi_input_width’: ‘32 bit’, ‘pps_count’: ‘0’, ‘tvg_mode’: ‘vsi-h’, ‘mk5b_timesync’: ‘no’, ‘vdif_timesync’: ‘no’, ‘gps_receiver’: ‘installed’, ‘output’: ‘stopped’, ‘output_0_format’: ‘raw’, ‘output_0_dest’: ‘192.168.1.2:46220’, ‘output_1_format’: ‘raw’, ‘output_1_dest’: ‘192.168.1.3:46227’, ‘output_2_format’: ‘raw’, ‘output_2_dest’: ‘192.168.1.4:46227’, ‘output_3_format’: ‘raw’, ‘output_3_dest’: ‘192.168.1.5:46227’, ‘ethernet_arps’: ‘on’, ‘selected_vsi_output’: ‘vsi1-2-3-4’}]
- Return type
dict
- core3h_sysstat_fs(board)¶
Identical to core3h_sysstat but returns machine (fields-system) readable output
TODO: implement parsing code
Parameters: board: the board number (starting at 0=A) or board ID (e.g “A”)
- core3h_tengbarp(board, device, arpId, mac)¶
Sets one ARP entry for a 10Gb ethernet device
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
device (str) – the ethernet device name, e.g. eth0
arpId (int) – index of the ARP table entry to be modified
mac (str) – MAC address to be set (must be in format xx:xx:xx:xx:xx:xx)
- Raises
ValueError – in case an invalid MAC address was given
- core3h_tengbcfg(board, device, key, value)¶
Sets a parameter of the 10Gb ethernet device.
valid parameters are: “ip”: IP address “mac”: MAC address “nm”: netmask “port”: UDP port “gateway”: IP adress of gateway
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
device (str) – the ethernet device name, e.g. eth0
key (str) – the name of the parameter to set (see above)
value (str) – the new parameter value
- core3h_tengbinfo(board, device)¶
Retrieve the current parameters of the specified 10Gb ethernet device
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
device (str) – the ethernet device name, e.g. eth0
- Returns
a dictionary containing all configuration parameters as key/value pairs. The arp_cache key contains a list of arp entries (“mac”,”ip”)
- Return type
dict
- Raises
ValueError – in case an unknown ethernet device has been given
- core3h_time(board)¶
Displays the current time of the active 1pps source
The displayed time is the (synchronized) VDIF time in UTC format.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
the current UTC timestamp of the active 1PPS source
- Return type
datetime
- core3h_timesync(board, timestamp=None)¶
Performs time synchronization for the given core board.
TODO: Finish method with code for manual setting of time TODO Discuss with Sven 3 sec offset between reported seconds and GPS time
- core3h_tvg_mode(board, mode=None)¶
Gets / sets the test vector generator (tvg) mode for the given board.
- mode can be one of:
all-0: all bits = 0
all-1: all bits = 1
vsi-h: VSI-H test vector pattern
cnt: pattern with four 8-bit counters
If called without the mode parameter the current setting is returned.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
mode (str) – the tvg mode identifier (see above)
- Returns
the current tvg mode; “unknown” if the mode could not be determined
- Return type
str
- Raises
ValueError – in case an unknown mode has been specified
- core3h_vdif_enc(board)¶
Get the setting of the VDIF encoding switch.
- Possible return values::
on: VDIF encoding is switched on
off: VDIF encoding is switched off
unknown: in case the VDIF encoding could not be determined
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
current state of the VDIF encoding (for possible values see above)
- Return type
str
- core3h_vdif_frame(board, channelWidth=None, numChannels=None, payloadSize=None)¶
Gets / sets the VDIF frame properties for the specified core3H board
If the command is called without the channelWidth parameter the current properties will be returned.
If successful the command returns the resulting number of frames per second and the number of data threads, according to the currently selected input (see
core3h_inputselect()
for details).If the VDIF frame properties do not match the currently selected input the “compatible” flag in the return dictionary is set to “False”. The command fails if the desired frame setup is not supported. The frame setup is not changed in this case.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
channelWidth (int, optional) – the size of each channel in bits (allowed values: 1,2,4,8,16,32,64)
numChannels (int, optional) – number of channels per VDIF frame (allowed values: 1,2,4,8,16,32,64,128)
payloadSize (int, optional) – the total payload size in bytes (=frame size without header) of the VDIF frame
- Returns
dictionary with the following structure:
"compatible" (boolean): False in case an incompatible setup was requested, True otherwise "channelWidth" (int): the size of each channel in bits "numChannels" (int): number of channels per VDIF frame "payloadSize" (int): the total payload size in bytes "frameSize" (int): the size of the VDIF frame in bytes "numThreads" (int, optional): the number of threads "framesPerSecond" (int, optional): the number of frames per second "framesPerThread" (int, optional): the number of frames per thread
- Return type
dict
- Raises
ValueError – in case channelWidth has been specified but no numChannels were set
- core3h_vdif_station(board, stationId=None)¶
Gets / sets the VDIF station ID for the specified core3h board
If the method is called without supplying the stationID parameter the current station ID will be reported.
Note
Setting this value directly affects the header data of the VDIF data format
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
stationId (str, optional) – The two-letter station code to set
- Returns
the two-letter station code; “unknown” if the code could not be determined
- Return type
str
- Raises
ValueError – in case an illegal station code has been specified
- core3h_vdif_userdata(board, d0=None, d1=None, d2=None, d3=None)¶
Gets/sets the user data fields in the extended VDIF frame header
The user data fields are 32bit values. Note that bits 24-31 of the first user data field contain the Extended Data Version (EDV) number. See: https://vlbi.org/vdif/ for details
d0 - d3 are optional. If not specified the current value of the fields are reported
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
d0 (int, optional) – the value of the first user data field
d1 (int, optional) – the value of the second user data field
d2 (int, optional) – the value of the third user data field
d3 (int, optional) – the value of the fourth user data field
- Returns
list containing the current content of all 4 user data fields
- Return type
list
- Raises
ValueError – in case the supplied value cannot be represented as hexadecimal
ValueError – in case the length of the supplied value exceeds 32 bit
- core3h_version(board)¶
Displays the FILA10G versions of the specified board
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
a dictionary with the following structure:
"systemName" (str): the FILA10G system name "compileDate" (str): the date string of the firmware compile date "versionSW" (str): the version string of the FILA10G firmware "versionHW" (str): the version string of the FILA10G hardware
- Return type
dict
- core3h_vsi_bitmask(board)¶
Gets the vsi input bitmask.
The eight - up to 32 bit wide - bitmasks specify which bits of the eight vsi input streams are active and will be processed. Inactivated bits will be discarded which effectively reduces the total amount of data.
Note
Currently setting of the bit mask is not supported by the python package
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
a list of hex representations of the bitmasks for all active vsi inputs
- Return type
list (str)
- core3h_vsi_samplerate(board, sampleRate=None, decimation=1)¶
Gets /sets the VSI input sample rate for the specified Core3h board
All arguments are optional. If the command is called without the sampleRate parameter the current VSI input sample rate is returned.
The decimation parameter decimates the input such that the resulting sample rate is 1/decimation of the specified rate
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
sampleRate (int, optional) – the input sampling rate in samples per second
decimation (int, optional) – a divisor in the range 1..255; default=1
- Returns
dictionary with the following structure:
"sampleRate" (int): sample rate in Hz "decimation" (int): decimation factor
- Return type
dict
- Raises
DBBC3Exception – in case the sample rate could not be set
- core3h_vsi_swap(board, firstVSI=None, secondVSI=None)¶
deprecated
Not fully implemented. Don’t use.
- core3hinit(board=None)¶
Reinitializes the CORE3H board(s)
If called without the optional board parameter reinitialization is performed for all CORE3H boards present in the system; otherwise only the specified board is bein initialized. The boards are reset to their default settings as specified in the configuration files.
- Parameters
board (int or str, optional) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
True if the reinitialization was successful; False otherwise
- Return type
boolean
- dbbcif(board, inputType=None, mode='agc', target=None)¶
Gets / sets the configuration of the GCoMo IF modules
If the IF is connected on the top pin of the GCoMo (bypassing the downconversion) the inputType parameter should be set to 1.
If the IF has been downconverted by the GCoMo the inputType should be set to 2. Selecting inputType=1 will disable the the synthesizer tone.
if the inputType is not specified or set to None the current settings are reported.
- Parameters
board (int or str) – can be given as a number (0 = board A) or as char e.g. A
inputType (int) – 1 = IF input without downconversion; 2 = IF input after downconversion
mode (int or str) – “agc” = automatic gain control (default if not specified); “man” = manual attenuation (retains last agc value); numeric value = attenuation step (0-63) in steps of 0.5 dB
target (int) – the target power level for the “agc” mode
- Returns
dictionary holding the values reported by dbbcif with the following structure:
"inputType" (int): see parameter description for meaning of returned value "attenuation" (int): the current attenuation level "mode" (str): the current agc mode "count" (int): the current IF level "target" (int): the target IF level
- Raises
ValueError – in case any arguments exceeds the valid range
- disableloop()¶
Stops the automatic calibration loop
- Returns
Response message from the control software
- Return type
str
- enablecal(threshold='on', gain='off', offset='off')¶
Switches on/off the threshold, gain and offset calibration for the automatic calibration loop
The loop must be activated with the
enableloop()
command. If called without the optional parameters the defaults will be used (see below)- Parameters
threshold (optional, default=on) – switch threshold calibration [on/off]
gain (optional, default=off) – switch gain calibration [on/off]
offset (optional, default=off) – switch offset calibration [on/off]
- Returns
a dictionary with the following structure:
"threshold": "gain": "offset":
- Return type
dict
- Raises
DBBC3Exception –
if the state of the calibration loop could not be queried * if the reported state differs from what was requested
- enableloop()¶
Starts the automatic calibration loop
For changing the parameters of the calibration loop use the
enablecal()
method- Returns
Response message from the control software
- Return type
str
- reconfigure()¶
Reconfigures the core3h boards
Reloads the firmware, then reinitializes the ADB3L and core3h and finally does a PPS sync.
- Returns
None
- synthAtt(board)¶
Gets the current attenuation setting of the synthesizer output serving the given board
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
the attenuation level in dB of the synthesizer ouput serving the given board
- Return type
float
- synthFreq(board, freq=None)¶
Gets / sets the frequency in MHz of the synthesizer serving the given board.
If the freq parameter is not given or is set to None the current frequency is reported
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
freq (int, optional) – the synthesizer frequency in MHz
- Returns
A dictionary with the following structure:
"target" (int): the target frequency in MHz "actual" (int): the actual frequency in MHz
- Return type
dict
- Raises
DBBC3Exception – In case the frequency could not be set or determined
- synthLock(board)¶
Gets the lock state of the GCoMo synthesizer serving the given core board
Each sythesizer has two outputs (source=1 or 2) board A is served by synth 1 source 1 board B is served by synth 1 source 2 board C is served by synth 2 source 1 etc.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
True if the synthesizer is locked; False otherwise
- Return type
boolean
- Raises
DBBC3Exception – in case the lock state of the synthesizer cannot be obtained
- synthOen(board, state=None)¶
Enables/disables the synthesizer output that serves the given board.
Warning
Disabling the output will switch off the downconversion stage of the DBBC3.
If called without the state argument the current output setting is reported.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
state (str, optional) – the output state. Can be either “on” or “off”
- Returns
the current state of the synthesizer output; 0=off, 1=off None: in case the state could not be determined
- Return type
int
- Raises
ValueError – In case an illegal state argument has been supplied
- synthinit()¶
Reinitiliases the synthesizers
All synthesizers of the GCoMo boards are reset to their initial state as defined in the configuration files
- Returns
True if the synthesizers were successfully reinitialized; False otherwise
- Return type
boolean
- time()¶
Obtains the time information from all boards.
For each board a dict with the following structure is returned:
'timestamp' (time.struct_time): the timestamp 'timestampAsString' (str): the timestamp in string representation %Y-%m-%dT%H:%M:%S
In the OCT mode (version 110) the dict contains the following additional fields:
'seconds'(int): seconds since the beginning of the current year 'halfYearsSince2000' (int): number of half years since the year 2000 'daysSince2000' (int): number of days since the year 2000
- Returns
The list of time information dicts. One list element for every board (0=A).
- Return type
time_list (
list
ofdict
)- Raises
DBBC3Exception – in case no time information could be obtained
- version()¶
Returns the DBBC3 control software version.
- Returns
a dictionary containing the version information of the DBBC3 control software:
"mode" (str): the current DBBC3 mode, e.g. DDC_V "majorVersion" (int): the major version, e.g. 124 "minorVersion" (int): the minor version (format YYYYMMDD) e.g. 20200113
DBBC3Commandset_DDC_Common
class¶
This module is part of the DBBC3 package and implements the command sets of the DBBC3 for the various modes and versions
- class DBBC3Commandset_DDC_Common(clas)¶
Bases:
DBBC3CommandsetDefault
Implementation of the DBBC3Commandset with methods common to all DDC modes of the DBBC3. Subclasses that implement special methods of the various DDC modes; e.g. DDC_V, DDC_L or DDC_U should derive from this class.
- cont_cal(mode=None, *args)¶
Turns continuous calibration on or off.
If called without the mode parameter the current setting of the continous calibration is returned
- If executing with mode=’on’ up to three extra parameters can be supplied:
polarity, freq, option
- The optional polarity parameter can have the following values:
0: no polarity change, no display swap
1: polarity change, no display swap
2: no polarity change, display swap
3: polarity change, display swap
The optional freq parameter specifies the cal frequency in Hz.
- The optional option parameter can have the following values:
0: cal is pulsed
1: cal is always on
- Parameters
mode (str, optional) – can be either “on” or “off”
*args (int) – up to three extra parmeters (see description above)
- Returns
A dictionary with the following structure:
"mode" (str): the current continuous cal mode "polarity" (int): the current polarity setting (see above) "freq" (int): the current continuous cal frequency in Hz "option" (int): the current option setting (see above)
- Return type
dict
- core3hread(board, block, bbc, register)¶
Warning
This is an expert level method and is intended for debugging purposes only. Wrong usage could bring the DBBC3 system into an unstable state and could lead to unwanted or unexpected results. Use only if you know what you are doing!
Reads a core3h register value
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
block (int) – the block index of the register to read (starts at 1)
bbc (int) – the bbc index within the block (starts at 1)
register (int) – the register index within the block (starts at 1)
- Returns
hex representation of the register value, or None if the regsiter could not be read
- Return type
str
- core3hwrite(board, block, bbc, register, value)¶
Warning
This is an expert level method and is intended for debugging purposes only. Wrong usage could bring the DBBC3 system into an unstable state and could lead to unwanted or unexpected results. Use only if you know what you are doing!
Writes a value to a core3h register
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
block (int) – the block index of the register to read (starts at 1)
bbc (int) – the bbc index within the block (starts at 1)
register (int) – the register index within the block (starts at 1)
value (int) – the register value to write
- dbbc(bbc, freq=None, bw=None, ifLabel=None, tpint=None)¶
Gets / sets the parameters of the specified BBC.
If called without passing the freq parameter the current settings are returned.
The frequency must be specified in units of MHz.
- Parameters
bbc (int) – the BBC number (starts at 1)
freq (optional, float) – the BBC frequency. If not specified the current setting is returned
ifLabel (optional, str) – the IF label to be used for the BBC (relevant e.g. for FS log). Must be single letter a-h
tpint (optional,int) – total power integration time in seconds (default = 1 second)
- Returns
a dictionary with the following structure:
"freq" (float): the frequency of the BBC in MHz "ifLabel" (str): the label of the ascociated IF (a-h) "bw" (int): the bandwidth "tpint" (int): the total power integration time in seconds "mode" (str): the current gain control mode (agc / manual) "gainUSB" (int): the gain of the USB (0-255) "gainLSB" (int): the gain of the LSB (0-255) "tpUSBOn" (int): the total power of the USB with cal diode on "tpLSBOn" (int): the total power of the LSB with cal diode on "tpUSBOff" (int): the total power of the USB with cal diode off "tpLSBOff" (int): the total power of the LSB with cal diode off
- Return type
dict
- Raises
ValueError – in case an invalid BBC number has been specified
ValueError – in case an invalid BBC frequency has been specified
ValueError – in case an invalid tpint value has been specified
- dbbcdpfu(bbc, dpfuUSB=None, dpfuLSB=None)¶
Sets the DPFU value for a given or all of the BBCs
The DPFU value will be used for calculating the SEFD values that are broadcasted via multicast. Separate DPFU for USB and LSB can be supplied. The DPFU should be given in units of K/Jy.
If called without supplying the DPFU values the current setting is returned
- Parameters
bbc (int/str) – the BBC number (starts at 1) or ‘all’ in case the DPFU should be applied to all BBCs
dpfuUSB (int, optional) – the DPFU value to use for the USB
dpfuLSB (int, optional) – the DPFU value to use for the LSB
- Returns
current DPFU values (USB, LSB)
- Return type
tuple (int,int)
- dbbcgain(bbc, mode=None, target=None, gainU=None, gainL=None)¶
Gets / sets the gain levels and gain control mode for a single BBC.
If the command is called with only the bbc parameter the current settings will be returned.
If the command is being called with the mode=agc the automatic gain control is switched on. If the target parameter is also set then the levels are automatically adjusted to reach the given target otherwise the target specified in the DBBC configuration file is being used.
If the command is being called with mode=man the automatic gain control is switched off and the current gain levels are being frozen. In case also the gainU and gainL parameters are set then these values will be used as the gain levels for the USB and LSB respectively.
- Parameters
bbc (int) – the BBC number (starts at 1)
mode (str, optional) – the gain control mode. Can be “agc” (automatic gain control) or “man” to freeze the current gain settings.
target (int, optional) – the target count level when running in “agc” mode
gainU (int, optional) – the gain level for the USB
gainL (int, optional) – the gain level for the LSB
- Returns
a dictionary with the following structure:
"bbc" (int): The currently selected BBC number (starts at 1) "mode" (str): The currently selected mode "target" (int): The current target count level (only returned when mode=agc) "gainUSB" (int): The gain level of the USB "gainLSB" (int): The gain level of the LSB
- Return type
dict
- Raises
ValueError – in case an invalid BBC number has been specified
- dbbcstat(bbc)¶
DEPRECATED Returns the bit statistics of a single BBC.
- Bit statistics are obained for the sign and magnitude portions.
sign: the fraction of positive values (should be around 50%)
magnitude:: the sum of the 00 and 11 states (should be around 36%)
For each BBC sign and magnitude statistics are obtained for both sidebands of the specified BBC.
The results are passed back as a dictionary with the following structure:
"s" (tuple of float): sign statistics (USB, LSB) "m" (tuple of float): magnitude statistics (USB, LSB)
e.g. {‘s’: (49.85, 49.86), ‘m’: (34.82, 34.66)}
- Parameters
bbc – the BBC number (starts at 1)
- Returns
the dictionary containing the sign and magnitude bit statistics (for structure see description above)
- Return type
dict
- Raises
ValueError – in case the specified bbc index is out of range
- dbbctdiode(bbc, tdiodeUSB=None, tdiodeLSB=None)¶
Sets the t_diode value for a given or all of the BBCs
The t_diode value will be used for calculating the Tsys values that are broadcasted via multicast. Separate t_diode for USB and LSB can be supplied. The t_diode should be given in units of K.
If called without supplying t_diode values the current setting is returned
- Parameters
bbc (int/str) – the BBC number (starts at 1) or ‘all’ in case the t_diode should be applied to all BBCs
tdiodeUSB (int, optional) – the t_diode value to use for the USB
tdiodeLSB (int, optional) – the t_diode value to use for the LSB
- Returns
current t_diode values (USB, LSB)
- Return type
tuple (int,int)
- dbbctp(board)¶
Obtains the DSC total power values
- Separate DSC power values are returned for the three cases:
DSC total power
DSC total power off
DSC total power on
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
(dsc_power, dsc_power_off, dsc_power_on)
- Return type
tuple
- Raises
ValueError – in case the requested board is out of range
- dbbctp0(bbc, tp0=None)¶
Set the TP0 value for a given or all of the BBCs
The TP0 value will be used for the determination of Tsys values that are broadcasted via multicast. The TP0 value has the same dimension as the total power values given by
dbbc()
commandIf called without supplying tp0 value the current setting is returned
- Parameters
bbc (int/str) – the BBC number (starts at 1) or ‘all’ in case the TP0 should be applied to all BBCs
tp0 (int, optional) – the TP0 value
- Returns
the current tp0 value
- Return type
int
- dsc_bstat(board, sampler)¶
Determines DSC statistics of the given board and sampler
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
sampler (int) – the sampler number (0-3)
- Returns
list of dictionaries with the following keys:
"count": count for the given state "perc": percentage for the given state
- the list indices are
0: ++ state 1: + state 2: - state 3: – state
- return example:
[{‘count’: 1413, ‘perc’: 9}, {‘count’: 6358, ‘perc’: 40}, {‘count’: 6392, ‘perc’: 40}, {‘count’: 1459, ‘perc’: 9}]
- Return type
list
- Raises
ValueError – in case the requested board is out of range
- dsc_corr(board)¶
Cross-correlates the signals of the 4 samplers
Performs cross-correlation between the 4 samplers of the given board. Correlation products are between these samplers:
0-1
1-2
2-3
The values can be used to check if the samplers are in the correct phase (=synchronized).
Note
The absolute numbers returned depend on the input power and IF bandwidth. However the values obtained for a board should not deviate by more than 10%.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
list containing the three cross-correlations in the order described above
- Return type
list
- Raises
ValueError – in case the requested board is out of range
- dsc_tp(board)¶
Gets the DSC total power values
Power values are obtained for all 4 samplers of the selected board.
- Parameters
board (int or str) – the board number (starting at 0=A) or board ID (e.g “A”)
- Returns
a list holding the power values for all four samplers
- Return type
list
- Raises
ValueError – in case the requested board is out of range
- mag_thr(bbc, threshold=None)¶
Warning
This is an expert level method and is intended for debugging purposes only. Wrong usage could bring the DBBC3 system into an unstable state and could lead to unwanted or unexpected results. Use only if you know what you are doing!
Gets/sets the threshold factor for the continuous threshold calibration
if called without the threshold parameter, the current threshold factor is returned.
- Parameters
bbc (int) – the BBC number (starts at 1)
threshold (float) – the threshold factor to apply
- Returns
the threshold factor; None if the threshold could not be obtained or set
- Return type
float
- Raises
ValueError – in case an invalid BBC number has been specified
- pps_delay(board=None)¶
Retrieves the delay of the internally generated vs. the external 1PPS signal
The delay is calculated as the time difference internal - external 1PPS and is returned in ns.
In case the method is called without the optional board parameter the PPS delays are returned for all the core boards present in the current system.
If the optional board parameter is used one delay value will be returned for each of the PPS groups each serving 4 BBCs. Group 1: BBCs 1-4; group 2: BBCs 5-8 etc.
- Parameters
board – (int or str, optional): if specified returns the PPS values for the PPS groups (4 BBCs) of the given core3H board
- Returns
list holding the delays of the internal-external PPS in nanoseconds. One value for each Core3H board if called without the optional board parameter. list: list holding the delays of the internal-external PPS in nanoseconds. Two values for the two PPS groups if called with the optional board parameter.
- Return type
list