Holography FPGA Agent

The Holography FPGA Agent is provided with OCS to help demonstrate and debug issues with the holography ROACH2 FPGA. It will connect the computer to the ROACH via an ethernet port, take data, and pass it to the OCS feed.

usage: python3 agent.py [-h] [--config_file CONFIG_FILE]

Agent Options

--config_file

Dependencies

Note

These dependencies only support Python 3.8! As such, they are not automatically installed when you install socs. You can manually install them, or follow the instructions below.

You can install these by first checking you are running Python 3.8:

$ python --version
Python 3.8.13

Then by either installing via pip:

$ python -m pip install 'casperfpga @ git+https://github.com/casper-astro/casperfpga.git@py38'
$ python -m pip install 'holog_daq @ git+https://github.com/McMahonCosmologyGroup/holog_daq.git@main'

Or by cloning the socs repository and using the provided requirements file:

$ git clone https://github.com/simonsobs/socs.git
$ python -m pip install -r socs/requirements/holography.txt

Configuration File Examples

Below are configuration examples for the ocs config file.

OCS Site Config

To configure the Holography FPGA Agent we need to add a FPGAAgent block to our ocs configuration file. Here is an example configuration block using all of the available arguments:

{'agent-class': 'FPGAAgent',
 'instance-id': 'fpga',
 'arguments': ['--config_file', 'holog_config.yaml']},

Holography Config File

roach: '192.168.4.20'
ghz_to_mhz: 1000
N_MULT: 8
F_OFFSET: 10
baseline: 'bd'
path_to_roach_init: "~/Desktop/holog_daq/scripts/upload_fpga_py2.py"
python2_env: "/opt/anaconda2/bin/python2 "

Description

The FPGAAgent contains functions which control the FPGA for holography measurements. Before the FPGA can take measuremnts, the user needs to initialize the FPGA using the init_FPGA() function. This will connect to the FPGA via an ethernet port (user specified in the holog_config.yaml file) and programs the FPGA using a .fpg file.

Once the FPGA is initialized, the user can take data using the take_data() function. This will record the cross-correlations A, BB, AB, and phase.

Agent API

class socs.agents.holo_fpga.agent.FPGAAgent(agent, config_file)[source]

Agent for programming FPGA and data acquisition for holography.

Parameters:

config_file (str) – ocs-site-configs/uchicago/field/holog_config.yaml

take_data()[source]

Task - A task to take data from the FPGA.

Examples

Example for calling in a client:

from ocs.ocs_client import OCSClient
agent_fpga = OCSClient("fpga") # create agent
agent_fpga.take_data() # take data

Notes

An example of the session data:

>>> response.session['data']
{"timestamp": 1601924482.722671,
 "block_name": "fpga",
 "data": {"amp_AA": 293.644,
          "amp_BB": 33.752,
          "amp_AB": 33.752,
          "arr_P": 33.752}
}