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

-Fixed extraction of complex values from PCAP file;

-Added comments;
-Plotted apertif_unb1_correlator output from hardware:
 . We can see correlation matrices with almost correc phases, but in
   the wrong place and with wrong phase ranges.
 . Overall the plots look good given the fact that we're using wrong
   filter coefficients.
parent 5c496ab8
Branches
Tags
No related merge requests found
...@@ -25,8 +25,13 @@ Purpose: ...@@ -25,8 +25,13 @@ Purpose:
Description: Description:
. Processes PCAP dump files stored by e.g. tcpdump. . Processes PCAP dump files stored by e.g. tcpdump.
Usage: Usage:
. Capture a PCAP file: sudo /usr/sbin/tcpdump -vvxSnelfi eth1 -n dst port 4000 -c 1000 -w ~/apertif_unb1_correlator_offload.dump . Capture a PCAP file:
. sudo /usr/sbin/tcpdump -vvxSnelfi eth1 -n dst port 4000 -c 1000 -w ~/apertif_unb1_correlator_offload.dump
. Examine a PCAP file with this script:
. python tc_apertif_unb1_correlator_offload.py ~/apertif_unb1_correlator_offload.dump
Extra:
. Print back a dumped PCAP file to the screen (example: 1 packet, -c 1):
. sudo /usr/sbin/tcpdump -e -c 1 -vvX -r ~/apertif_unb1_correlator_offload.dump
""" """
import struct import struct
...@@ -47,7 +52,7 @@ def dumpfile_to_array(dumpfile): ...@@ -47,7 +52,7 @@ def dumpfile_to_array(dumpfile):
# Strip off the PCAP header # Strip off the PCAP header
pcap_global_hdr_raw = f.read(24) pcap_global_hdr_raw = f.read(24)
for packet in range(64): # FIXME: 64 packets (channels) maar mag ook veelvoud van 64ch zijn. for packet in range(960): # 960 channels = 15 integration periods of 64 channels.
pcap_pkt_hdr_raw = f.read(16) pcap_pkt_hdr_raw = f.read(16)
eth_hdr_raw = f.read(14) eth_hdr_raw = f.read(14)
ip_hdr_raw = f.read(20) ip_hdr_raw = f.read(20)
...@@ -143,14 +148,15 @@ def dumpfile_to_array(dumpfile): ...@@ -143,14 +148,15 @@ def dumpfile_to_array(dumpfile):
# Visibilities: 300 visibilities * 32b complex (64b total) = 600 # Visibilities: 300 visibilities * 32b complex (64b total) = 600
# little endian signed integers. # little endian signed integers.
########################################################################### ###########################################################################
visibilities_struct = struct.unpack('>600i', visibilities_raw) visibilities_struct = struct.unpack('600i', visibilities_raw)
# Split the 600-word list into a 300-tuple list # Split the 600-word list into a 300-tuple list
visibilities_tuples = split_list(visibilities_struct, 2) visibilities_tuples = split_list(visibilities_struct, 2)
# Convert the tuples to complex # Convert the tuples to complex
visibilities_complex = [complex(*i) for i in visibilities_tuples] visibilities_complex = [complex(i[0],i[1]) for i in visibilities_tuples]
# Print the complex values
for i,v in enumerate(visibilities_complex): for i,v in enumerate(visibilities_complex):
print 'Packet', packet, '-', 'Visibility %03d ' %i, v print 'Packet', packet, '-', 'Visibility %03d ' %i, v
...@@ -167,8 +173,12 @@ if __name__ == '__main__': ...@@ -167,8 +173,12 @@ if __name__ == '__main__':
# Read the dump file and pour it visibility content in a 2d array # Read the dump file and pour it visibility content in a 2d array
dump_arr = dumpfile_to_array(sys.argv[1]) dump_arr = dumpfile_to_array(sys.argv[1])
# Split the list into sublists of 64 channels (one integration period)
integration_periods = split_list(dump_arr, 64)
for integration_period in integration_periods:
# The correlator outputs channels in the same order as the FFT, so reorder first: # The correlator outputs channels in the same order as the FFT, so reorder first:
integration_period = fft_reorder(dump_arr) reordered_integration_period = fft_reorder(integration_period)
# Plot the phase shifts # Plot the phase shifts
plot_phase_shifts(integration_period, NOF_VISIBILITIES) plot_phase_shifts(reordered_integration_period, NOF_VISIBILITIES)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment