dragonfly.implementations.r2daq module¶
Some template vars¶
Members: AF_INET ArtooDaq Packet SOCK_DGRAM Functions: Classes:
Summary¶
-
class
dragonfly.implementations.r2daq.ArtooDaq(hostname, dsoc_desc=None, boffile=None, ifcfg=None, do_ogp_cal=True, do_adcif_cal=True)¶ Bases:
objectEncapsulate R2DAQ
Initialize an ArtooDaq object.
Parameters: - hostname (string) – Address of the roach2 on the 1GbE (control) network.
- dsoc_desc (tuple) – A tuple with the first element the IP address / hostname and the second element the port where data is to be received. This argument, if not None, is passed directly to socket.bind(); see the documentation of that class for details. In this case a socket is opened and bound to the given address. If None, then the data socket is not opened. Default is None.
- boffile (string) – Program the device with this bitcode if not None. The special filename ‘latest-build’ uses the current build of the bit-code. Default is None.
- ifcfg (list) – List of dictionaries built with calls to make_interface_config_dictionary. If this parameter is None then a default list is created. Default is None.
- do_ogp_cal (bool) – If True then do ADC core calibration. Default is True.
- do_adcif_cal (bool) – If True then do ADC interface calibration. Default is True.
-
ADC_SAMPLE_RATE¶
-
DEMUX¶
-
DIGITAL_CHANNELS¶
-
DIGITAL_CHANNEL_WIDTH¶
-
FFT_ENGINES¶
-
FPGA_CLOCK¶
-
PHASE_LOOKUP_DEPTH¶
-
calibrate_adc_gain(zdok=0, giter=10, gtol=0.005)¶ Attempt to match the core gains within the ADC.
See ArtooDaq.calibrate_adc_ogp for more details.
-
calibrate_adc_offset(zdok=0, oiter=10, otol=0.005)¶ Attempt to match the core offsets within the ADC.
See ArtooDaq.calibrate_adc_ogp for more details.
-
calibrate_adc_ogp(zdok=0, oiter=10, otol=0.005, giter=10, gtol=0.005, piter=0, ptol=1.0)¶ Attempt to match the cores within the ADC.
Each of the four cores internal to each ADC has an offset, gain, phase, and a number of integrated non-linearity parameters that can be independently tuned. This method attempts to match the cores within the specified ADC by tuning a subset of these parameters.
Parameters: - zdok (int) – ZDOK slot that contains the ADC, should be 0 (default is 0). (Second ADC card not in bitcode)
- oiter (int) – Maximum number of iterations to fine-tune offset parameter (default is 10).
- otol (float) – If the absolute value of the mean of snapshot data normalized to the standard deviation from one core is below this value then the offset-tuning is considered sufficient (default is 0.005).
- giter (int) – Maximum number of iterations to fine-tune gain parameter (default is 10).
- gtol (float) – If the distance between the standard deviation of the data in one core is less than this fraction of the standard deviation in the data from core1, then the gain-tuning is considered sufficient (default value is 0.005).
- piter (int) – Phase calibration not yet implemented.
- ptol (float) – Phase calibration not yet implemented.
Returns: ogp – The returned parameter is a dictionary that contains the optimal settings for offset, gain and phase as solved during calibration.
Return type: dict
-
calibrate_adc_phase(zdok=0, piter=0, ptol=1.0)¶ Attempt to match the core phases within the ADC.
See ArtooDaq.calibrate_adc_ogp for more details.
-
close_dsoc()¶ Close socket used for data reception.
-
grab_packets(n=1, dsoc_desc=None, close_soc=False)¶ Grab packets using open data socket.
Calls to this method should only be made while a data socket is open, unless a socket descriptor is provided. See open_dsoc() for details.
Parameters: - n (int) – Number of packets to grab, default is 1.
- dsoc_desc (tuple) – Socket descriptor tuple as for open_dsoc() method. If None, a data socket should already be open. Default is None.
- close_soc (boolean) – Close socket after grabbing the given number of packets.
-
implemented_digital_channels¶
-
classmethod
make_interface_config_dictionary(src_ip, src_port, dest_ip, dest_port, src_mac=None, arp=None, dest_mac=None, tag='a')¶ Make interface dictionary to initialize 10GbE cores.
This method is a temporary workaround to avoid calling _config_channel_net directly.
Parameters: - src_ip (str or int) – IP address for the ROACH2 10GbE interface associated with the given channel in dot-decimal notation (str) or as int.
- src_port (int) – Port number for the ROACH2 10GbE interface associated with the given channel.
- dest_ip (str or int) – IP address for the destination of packets associated with the given channel in dot-decimal notation (str) or as int.
- dest_port (int) – Port number for the destination of packets associated with the given channel.
- src_mac (str or int) – MAC address for the ROACH2 10GbE interface associated with the given channel in colon-separated-hexadecimal notation (str) or as int. If None then the MAC is automatically determined from src_ip. Default is None.
- arp (list) – ARP table supplied as a 256-element list of integers. Each entry contains the MAC address of the device on the /24 network. If None then the MAC address of the device associated with dest_ip must be supplied in dest_mac and the ARP is automatically generated by filling other entries with the broadcast address. Default is None.
- dest_mac (str or int) – MAC address for the destination of packets associated with the given channel in colon-separated-hexadecimal notation (str) or as int. If supplied then the ARP table entry for src_ip is replaced with the given MAC address. If None then the ARP table is used as-is. Default is None.
- tag (str) – Tag associated with the digital channel, should be one of {‘a’,’b’,’c’,’d’,’e’,’f’}. Default is ‘a’.
Returns: ifd – The returned dictionary can be used in a configuration list when initializing the ArtooDaq object.
Return type: dict
Example
- cfg_a = ArtooDaq.make_interface_config_dictionary(
- ‘192.168.10.100’,4000, ‘192.168.10.63’,4001, dest_mac=‘00:60:dd:44:91:e7’,tag=’a’
) cfg_b = ArtooDaq.make_interface_config_dictionary(
‘192.168.10.101’,4000, ‘192.168.10.64’,4001, dest_mac=‘00:60:dd:44:91:e8’,tag=’b’) cfg_list = [cfg_a,cfg_b] r2 = ArtooDaq(‘led’,boffile=’latest-build’,ifcfg=cfg_list):
-
open_dsoc(dsoc_desc)¶ Open socket for data reception and bind.
Parameters: dsoc_desc (tuple) – Tuple of IP address / hostname and port as passed to socket.bind().
-
read_ddc_1st_config(tag='a')¶ Extract configuration of 1st stage DDC.
Parameters: tag (string) – Tag associated with the digital channel, should be one of {‘a’,’b’,’c’,’d’,’e’,’f’}. Default is ‘a’. Returns: ddc1_cfg – Dictionary containing configuration information of 1st stage DDC. Return type: dict
-
registers¶
-
roach2¶
-
set_fft_shift(shift_vec='1101010101010', tag='ab')¶ Set shift vector for FFT engine.
Parameters: - shift_vec (string) – String given in bit-format, ‘1’s and ‘0’s where 1 indicates right-shift at stage associated with the bit position. Only the first 13 characters in the string are used. Default is ‘1101010101010’ which ensures no overflow.
- tag (string) – Tag selects the FFT engine to which the shift-vector is applied. Default is ‘ab’.
-
set_gain(g=1.0, tag='a')¶ Set gain on output of 1st stage DDC.
Parameters: - g (float) – Real-valued gain to apply to output of first downconversion module. Binary representation is Fix_8_4 and the caller should ensure that the gain is within the allowable range [-8,7.9375]. Values outside this range will saturate. Default is 1.0.
- tag (string) – Tag associated with the digital channel, should be one of {‘a’,’b’,’c’,’d’,’e’,’f’}. Default is ‘a’.
Notes
No gain control register for channels {‘e’,’f’} yet.
-
string_version(ver=None)¶ Return human-readable detailed bitcode version information.
Parameters: ver (tuple) – The version tuple to interpret, as returned by the ArtooDaq.version property. If None, then the tuple is first obtained from the current ArtooDaq instance. Default is None. Returns: str – A nice display of version information. Return type: str
-
tune_ddc_1st_to_freq(f_c, tag='a')¶ Tune 1st stage DDC to the given center frequency.
Parameters: - fc (float) – Desired center frequency for the 100 MHz channel.
- tag (string) – Tag associated with the digital channel, should be one of {‘a’,’b’,’c’,’d’,’e’,’f’}. Default is ‘a’.
Returns: fc_d – Actual center frequency of the 100MHz digital channel, taking into account the finite frequency resolution of the digitally synthesized LO in the first downconversion stage.
Return type: float
-
version¶
-
class
dragonfly.implementations.r2daq.Packet(ut=0, pktnum=0, did=0, ifid=0, ud0=0, ud1=0, res0=0, res1=0, fnt=False, data=None)¶ Encapsulate an R2DAQ packet
Initialize Packet with the given attributes
-
BYTES_IN_HEADER= 32¶
-
BYTES_IN_PACKET= 8224¶
-
BYTES_IN_PAYLOAD= 8192¶
-
classmethod
FromByteString(bytestr)¶ Initialize Packet from the given byte string
-
data¶
-
digital_id¶
-
freq_not_time¶
-
if_id¶
-
interpret_data()¶ Interprets the raw 8bit data as complex-valued Fix_8_7.
Returns: x – Complex-valued array represented by the data. Return type: ndarray
-
pkt_in_batch¶
-
reserved_0¶
-
reserverd_1¶
-
unix_time¶
-
user_data_0¶
-
user_data_1¶
-
End of modules condition
Data:
End of data condition