Skip to content
Snippets Groups Projects
Commit e1806b0e authored by Eric Kooistra's avatar Eric Kooistra
Browse files

View content of databuffer for multiple SP.

parent 51f76d74
No related branches found
No related tags found
1 merge request!190Resolve L2SDP-1089
Pipeline #121723 passed with warnings
#! /usr/bin/env python3
# ##########################################################################
# Copyright 2023
# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ##########################################################################
# ##########################################################################
# Author:
# . Eric Kooistra
# Purpose:
# . Read data buffer file
# Description:
# . Capture signal input data buffer:
# sdp_rw.py --host 10.151.255.1 --port 4842 -r signal_input_data_buffer > x.txt
# . The data has format [4, 12*1024](int16)
# . Print first data of each signal input to see their alignment, in case
# ADC is setup to output synchronized test sequence.
# ##########################################################################
import argparse
import numpy as np
# Parse arguments to derive user parameters
_parser = argparse.ArgumentParser('view_data_buffer')
_parser.add_argument('-f', default='x.txt', type=str, help='Filename')
args = _parser.parse_args()
# Read data captured with sdp_rw.py -r signal_input_data_buffer
with open(args.f, "r") as fp:
fileLines = fp.readlines()
# Parse x.txt into signal_inputs array
N_pn = len(fileLines) - 1
S_pn = 12
S_adc = N_pn * S_pn
N_points = 1024
shape = (N_pn * S_pn, N_points)
signal_inputs = np.zeros(shape, np.int16)
for li, line in enumerate(fileLines):
# skip first line
ni = li - 1
if ni >= 0:
data = line.split(':')[1]
data = data.split()
for si in range(S_pn):
for di in range(N_points):
signal_inputs[ni * S_pn + si][di] = data[si * N_points + di]
# Print first data for each signal input
for si in range(S_adc):
print('%2d : %s' % (si, signal_inputs[si][9:15]))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment