From 5737991163efec5d077947d384208b84c479c9ca Mon Sep 17 00:00:00 2001
From: Daniel van der Schuur <schuur@astron.nl>
Date: Fri, 21 Nov 2014 12:34:15 +0000
Subject: [PATCH] -Now plotting each of the 4 captured timesamples.

---
 .../dsp/correlator/tb/python/tc_correlator.py | 73 ++++++++++---------
 1 file changed, 38 insertions(+), 35 deletions(-)

diff --git a/libraries/dsp/correlator/tb/python/tc_correlator.py b/libraries/dsp/correlator/tb/python/tc_correlator.py
index bcac2360d6..6dc2bb0c2c 100644
--- a/libraries/dsp/correlator/tb/python/tc_correlator.py
+++ b/libraries/dsp/correlator/tb/python/tc_correlator.py
@@ -35,6 +35,7 @@ COMPLEX_WIDTH = 16
 NOF_INPUTS = 10
 NOF_OUTPUTS = NOF_INPUTS*(NOF_INPUTS+1)/2
 NOF_CHANNELS = 64
+NOF_TIMESAMPLES = 4
 
 #BUFFER_DEPTH = 256
 BUFFER_WIDTH = 64 #2*COMPLEX_WIDTH
@@ -55,45 +56,47 @@ for output_nr in range(NOF_OUTPUTS):
     data.append( db.read_data_buffer(streamNr=output_nr, n=2*256, radix='uns', width=BUFFER_WIDTH, nofColumns=12)[0] )
 
 ###############################################################################
-# 'data' is now a 2d array of [NOF_OUTPUTS][NOF_CHANNELS]. We want to group the
-# outputs by channel, so transpose this 2d array into [NOF_CHANNELS][NOF_OUTPUTS]
+# 'data' is now a 2d array of [NOF_OUTPUTS][NOF_TIMESAMPLES*NOF_CHANNELS]. We
+# want to group the outputs by channel, so transpose this 2d array into 
+# [NOF_TIMESAMPLES*NOF_CHANNELS][NOF_OUTPUTS]
 ###############################################################################
 data = transpose(data)
 
-mat_list = []
-for channel_nr in range(NOF_CHANNELS):
-    ###############################################################################
-    # Convert the unsigned words to complex
-    ###############################################################################
-    channel_data = data[channel_nr]
-    for index,word in enumerate(channel_data):
-        word_bits = CommonBits(word, BUFFER_WIDTH)
-        re = word_bits[BUFFER_WIDTH-1:BUFFER_WIDTH/2]
-        im = word_bits[BUFFER_WIDTH/2-1:0]
-        channel_data[index] = complex(im, re)
-    
-    ###############################################################################
-    # Convert binomials to complex phasor notation
-    ###############################################################################
-    for index,word in enumerate(channel_data):
-        channel_data[index] = complex_binomial_to_phasor(word)
-    
-    ###############################################################################
-    # Extract the phases from the complex data
-    ###############################################################################
-    phases = []
-    for word in channel_data:
-        phases.append(word[1])
+for sample_nr in range(NOF_TIMESAMPLES):
+    mat_list = []
+    for channel_nr in range(NOF_CHANNELS):
+        ###############################################################################
+        # Convert the unsigned words to complex
+        ###############################################################################
+        channel_data = data[sample_nr*NOF_CHANNELS+channel_nr]
+        for index,word in enumerate(channel_data):
+            word_bits = CommonBits(word, BUFFER_WIDTH)
+            re = word_bits[BUFFER_WIDTH-1:BUFFER_WIDTH/2]
+            im = word_bits[BUFFER_WIDTH/2-1:0]
+            channel_data[index] = complex(im, re)
+        
+        ###############################################################################
+        # Convert binomials to complex phasor notation
+        ###############################################################################
+        for index,word in enumerate(channel_data):
+            channel_data[index] = complex_binomial_to_phasor(word)
+        
+        ###############################################################################
+        # Extract the phases from the complex data
+        ###############################################################################
+        phases = []
+        for word in channel_data:
+            phases.append(word[1])
+        
+        ################################################################################
+        # Re-shape the flat list into a matrix
+        ################################################################################
+        mat = unique_vis_to_full_matrix(phases)    
+        mat_list.append(mat)
     
     ################################################################################
-    # Re-shape the flat list into a matrix
+    # re-shape the flat list of 64 matrices into a an 8*8 matrix of matrices, plot
     ################################################################################
-    mat = unique_vis_to_full_matrix(phases)    
-    mat_list.append(mat)
-
-################################################################################
-# re-shape the flat list of 64 matrices into a an 8*8 matrix of matrices, plot
-################################################################################
-mat_mat = split_list(mat_list, 8)
-plot_matrix_color(mat_mat)
+    mat_mat = split_list(mat_list, 8)
+    plot_matrix_color(mat_mat)
 
-- 
GitLab