Skip to content
Snippets Groups Projects
Commit ceff82d7 authored by Daniel van der Schuur's avatar Daniel van der Schuur
Browse files

-Added plot_rec_file.py.

parent 383df67a
Branches
No related tags found
No related merge requests found
# 0 1 2 3 4 5 6 7 8 9 10
# [sync] [bsn] [data] [re] [im] [valid] [sop] [eop] [empty] [channel] [err]
from common import *
from common_dsp import *
import os
import numpy
NOF_VISIBILITIES = 300
REC_FILE = os.environ['RADIOHDL']+'/libraries/dsp/correlator/correlator_src_out_arr0.rec2'
################################################################################
# Read the lines from the file and turn them into a list
################################################################################
with open (REC_FILE, "r") as recfile:
lines = recfile.read().splitlines()
################################################################################
# Extract the complex fields; create new complex list
################################################################################
complex_list = []
raw_data_int = []
raw_data_str = []
for line in lines:
line = line.replace('X', '0') # Get rid of the 'X' on bit 24 (we only use 0..23)
split_line = line.split(' ')
# print split_line
str_re = split_line[3]
str_im = split_line[4]
raw_data_str.append( [str_re, str_im] )
# print str_re,str_im
re = int(str_re, 16)
im = int(str_im, 16)
raw_data_int.append( [re, im] )
# print re,im
complex_word = complex(re,im)
complex_list.append( complex_word )
#print 'COMPLEX LIST'
#print complex_list
################################################################################
# Extract the phases
################################################################################
phases = []
for word in complex_list:
phases.append(complex_binomial_to_phasor(word)[1])
################################################################################
# Split the list into chunks of NOF_VISIBILITIES, plot them channel after channel
################################################################################
phases_per_channel = split_list(phases, NOF_VISIBILITIES)
#print 'Nof channels in file:', len(phases_per_channel)
#
#print 'CHANNEL 40 - PHASES'
#print phases_per_channel[40]
#print 'CHANNEL 40 - COMPLEX'
#print split_list(complex_list, NOF_VISIBILITIES)[40]
#print 'CHANNEL 40 - RAW DATA, INTEGER'
#print split_list(raw_data_int, NOF_VISIBILITIES)[40]
#print 'CHANNEL 40 - RAW DATA, HEX'
#print split_list(raw_data_str, NOF_VISIBILITIES)[40]
#
#print 'CHANNEL 41 - PHASES'
#print phases_per_channel[41]
#print 'CHANNEL 41 - COMPLEX'
#print split_list(complex_list, NOF_VISIBILITIES)[41]
#print 'CHANNEL 41 - RAW DATA, INTEGER'
#print split_list(raw_data_int, NOF_VISIBILITIES)[41]
#print 'CHANNEL 41 - RAW DATA, HEX'
#print split_list(raw_data_str, NOF_VISIBILITIES)[41]
for channel_phases in phases_per_channel[40:]:
phases_mat = numpy.array(channel_phases)
mat = unique_vis_to_full_matrix(phases_mat)
plot_matrix_color([[mat]])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment