1

I am stuck in a problem and tried lots of solutions present on this community. But I am not able to figure out the solution for my problem.

Currently, I am able to create a program through which I am able to collect the points from TCP socket in an array continuously. I am able to receive continuous output from the socket. Now I want to visualize scatterplot 3D graph from these points. But I am unable to view the graph. Whatever solutions present on this community I tried all that. But I am receiving errors and unable to get the result. Following is my code to collect data from TCP:

from __future__ import print_function
from mpl_toolkits.mplot3d import Axes3D  # noqa: F401 unused import
import matplotlib.pyplot as plt
import numpy as np
import socket
import sys
import time
from time import sleep

start = time.time()
def comm_dists(ip, port):

    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server_address = (ip, port)
    print(sys.stderr, 'connecting to %s port %s' % server_address)
    sock.connect(server_address)
    print("Connected")
    try:

        # Send data
        message = b'\x02\x02\x02\x02\x00\x00\x00\x10sMI 0 3 F4724744 ' #This will initiate the scanning process
        sock.sendall(message)
        print(sys.stderr, 'sending "%s"' % message)
        print('sent "%s"' % message)
        data = sock.recv(5000)
        sleep(0.05)
        n = 52
        while True:
            data = sock.recv(5000)
            data = data.decode("utf-8", errors='ignore')
            data = data.split()
            integer_data = [int.from_bytes(bytes.fromhex(item), 'big') for item in data[:-8]] #Convert the received values in Integer.
            print('received "%s"' % integer_data) #Print the data received from TCP socket 

    finally:
        print(sys.stderr, 'closing socket')
    return data

i=0
dados_csv = []

while i < int(1):
    data = comm_dists('192.168.0.1', 2111) #IP and port of the socket

    i=i+1

This is the the output looks like: Output:

received "[197, 580, 580, 579, 571, 574, 571, 569, 572, 564, 562, 564, 560, 564, 558, 556, 558, 550, 549, 550, 548, 546, 550, 545, 547, 542, 540, 541, 537, 536, 534, 528, 529, 531, 525, 533, 528, 525, 530, 521, 518, 515, 521, 516, 518, 513, 513, 511, 515, 515, 509, 0, 509, 511, 511, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 510, 510, 0, 0, 510, 510, 511, 515, 510, 510, 514, 519, 518, 517, 525, 518, 525, 523, 529, 530, 526, 527, 532, 523, 534, 532, 537, 540, 538]"
received "[583, 581, 583, 578, 574, 574, 566, 566, 573, 570, 563, 561, 556, 563, 555, 552, 554, 550, 551, 546, 551, 545, 540, 545, 539, 548, 536, 543, 533, 533, 534, 530, 528, 528, 526, 531, 531, 524, 522, 520, 516, 523, 516, 516, 517, 516, 510, 518, 0, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 510, 0, 0, 0, 0, 0, 514, 510, 510, 508, 520, 509, 0, 515, 513, 515, 518, 512, 523, 522, 522, 524, 519, 524, 528, 525, 520, 534, 530, 533, 540, 536, 538]"
received "[577, 581, 577, 576, 571, 573, 569, 567, 564, 560, 560, 561, 560, 561, 557, 552, 549, 554, 546, 549, 552, 542, 542, 540, 542, 541, 536, 540, 543, 535, 532, 533, 528, 531, 528, 527, 527, 533, 525, 530, 529, 521, 517, 517, 514, 521, 517, 517, 513, 510, 0, 512, 0, 0, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 511, 0, 510, 0, 511, 512, 509, 510, 515, 523, 515, 515, 516, 518, 519, 524, 523, 525, 522, 525, 529, 534, 532, 538, 533, 534, 536]"
received "[574, 576, 579, 573, 572, 568, 563, 566, 568, 560, 562, 561, 561, 553, 554, 549, 556, 553, 551, 549, 547, 542, 544, 534, 542, 541, 529, 535, 541, 536, 534, 534, 530, 530, 528, 526, 525, 522, 523, 524, 522, 516, 521, 513, 517, 510, 0, 510, 516, 520, 0, 511, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 512, 0, 0, 513, 520, 510, 514, 527, 515, 0, 521, 515, 519, 519, 526, 529, 522, 539, 531, 524, 531, 528, 529, 527, 530, 537]"
received "[582, 576, 580, 576, 573, 576, 569, 571, 571, 563, 565, 566, 558, 558, 561, 552, 550, 546, 543, 551, 549, 547, 536, 540, 536, 543, 549, 545, 542, 538, 534, 532, 540, 528, 532, 526, 513, 524, 523, 523, 530, 517, 513, 521, 517, 521, 516, 517, 0, 0, 0, 0, 511, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 510, 0, 0, 0, 0, 509, 0, 510, 508, 510, 0, 512, 511, 519, 515, 520, 520, 513, 516, 524, 516, 522, 524, 521, 525, 521, 528, 527, 530, 537, 533, 535, 532, 540, 543]"
received "[578, 576, 572, 574, 575, 571, 566, 570, 558, 567, 562, 559, 561, 558, 558, 560, 550, 551, 548, 544, 546, 544, 539, 539, 540, 537, 538, 537, 543, 532, 538, 530, 528, 524, 523, 525, 523, 529, 520, 522, 521, 519, 518, 518, 518, 521, 513, 0, 512, 515, 0, 0, 0, 509, 0, 0, 509, 0, 0, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 509, 0, 0, 0, 509, 0, 514, 508, 512, 516, 514, 520, 515, 521, 523, 520, 519, 520, 524, 532, 530, 526, 528, 527, 534, 533, 543, 532, 530]"
received "[581, 577, 574, 577, 572, 567, 576, 570, 568, 566, 567, 567, 556, 560, 551, 549, 547, 551, 550, 549, 550, 547, 542, 546, 538, 538, 535, 535, 534, 530, 529, 528, 535, 529, 533, 526, 524, 521, 519, 521, 524, 519, 517, 514, 511, 510, 514, 513, 518, 517, 513, 513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 513, 515, 0, 511, 0, 509, 509, 515, 526, 516, 512, 516, 518, 517, 521, 517, 516, 523, 528, 528, 528, 529, 534, 531, 532, 536, 544, 544]"
received "[579, 578, 573, 573, 566, 569, 566, 564, 569, 560, 562, 558, 560, 550, 557, 560, 560, 546, 556, 545, 545, 543, 548, 539, 540, 541, 539, 532, 535, 534, 536, 530, 528, 531, 533, 525, 523, 529, 525, 531, 522, 523, 522, 518, 517, 517, 512, 0, 518, 0, 0, 0, 0, 511, 0, 0, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 510, 0, 0, 0, 511, 0, 0, 514, 527, 517, 518, 510, 517, 526, 524, 526, 528, 518, 525, 522, 530, 530, 533, 530, 526, 533, 534]"
received "[583, 583, 581, 577, 573, 573, 569, 565, 567, 562, 568, 559, 551, 559, 557, 548, 546, 555, 551, 549, 550, 544, 542, 540, 542, 538, 536, 538, 533, 529, 530, 530, 524, 528, 526, 531, 528, 524, 520, 519, 522, 517, 516, 517, 517, 511, 516, 512, 514, 515, 0, 0, 0, 511, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 509, 509, 0, 511, 510, 513, 508, 514, 510, 514, 512, 518, 519, 518, 518, 522, 525, 526, 525, 528, 533, 525, 531, 529, 531, 531, 533, 538]"
received "[582, 582, 581, 576, 574, 572, 575, 571, 567, 565, 564, 561, 557, 561, 550, 557, 554, 549, 553, 550, 544, 545, 538, 544, 541, 536, 535, 535, 532, 532, 528, 537, 528, 523, 525, 524, 519, 526, 522, 523, 524, 526, 519, 521, 514, 515, 509, 514, 513, 512, 0, 510, 512, 509, 0, 0, 0, 0, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 511, 512, 0, 508, 518, 512, 521, 516, 516, 525, 516, 519, 524, 518, 522, 529, 532, 532, 529, 530, 530, 539, 535, 530, 539, 542]"
received "[576, 580, 574, 576, 573, 574, 575, 571, 568, 562, 561, 564, 562, 562, 550, 554, 553, 550, 546, 548, 545, 542, 542, 541, 538, 534, 534, 537, 536, 538, 526, 534, 529, 527, 533, 530, 524, 521, 515, 526, 518, 523, 515, 521, 514, 517, 511, 511, 0, 0, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 512, 511, 0, 514, 0, 0, 510, 511, 509, 0, 513, 523, 523, 526, 520, 522, 520, 520, 525, 522, 525, 524, 532, 531, 531, 535, 535, 528, 540, 537]"
received "[581, 576, 579, 570, 577, 568, 568, 567, 569, 561, 555, 560, 564, 560, 565, 550, 548, 554, 558, 543, 549, 548, 543, 546, 541, 540, 540, 537, 536, 545, 533, 530, 532, 530, 523, 521, 534, 522, 527, 526, 530, 521, 518, 519, 522, 516, 0, 510, 516, 515, 0, 511, 515, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 509, 0, 0, 0, 512, 0, 0, 0, 511, 508, 515, 512, 516, 509, 521, 511, 521, 519, 514, 520, 523, 521, 528, 529, 525, 533, 531, 524, 536, 527, 538, 537]"
received "[585, 578, 579, 578, 573, 574, 563, 564, 561, 568, 566, 560, 561, 554, 556, 548, 550, 556, 552, 544, 544, 544, 540, 541, 535, 543, 535, 536, 531, 539, 533, 529, 529, 525, 528, 524, 523, 527, 526, 519, 525, 518, 516, 519, 518, 511, 514, 520, 511, 510, 511, 510, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 509, 0, 511, 515, 0, 514, 508, 511, 517, 516, 510, 515, 518, 517, 520, 516, 519, 523, 524, 521, 530, 531, 529, 532, 530, 536, 528, 532]"
received "[580, 578, 571, 578, 577, 568, 566, 573, 564, 566, 564, 564, 560, 556, 560, 553, 557, 550, 551, 543, 549, 547, 539, 542, 537, 539, 540, 538, 535, 538, 534, 533, 530, 527, 524, 524, 529, 523, 526, 515, 521, 519, 521, 525, 511, 523, 513, 514, 516, 511, 510, 0, 0, 0, 0, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 510, 0, 510, 513, 515, 0, 0, 0, 0, 517, 518, 518, 522, 518, 521, 515, 522, 516, 526, 519, 522, 527, 531, 536, 534, 532, 543, 530, 533]"
received "[578, 576, 573, 575, 574, 574, 569, 565, 572, 564, 568, 559, 557, 557, 555, 551, 544, 555, 551, 553, 546, 547, 548, 542, 544, 532, 538, 539, 536, 537, 536, 528, 532, 533, 531, 526, 524, 516, 518, 520, 519, 517, 525, 521, 515, 517, 0, 510, 517, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 510, 512, 0, 509, 509, 0, 517, 511, 515, 515, 527, 513, 516, 517, 518, 522, 523, 524, 522, 521, 520, 523, 531, 527, 536, 534, 536, 537, 546]"
received "[578, 578, 582, 577, 574, 578, 568, 568, 572, 568, 566, 558, 564, 554, 557, 551, 560, 556, 550, 554, 549, 548, 539, 548, 544, 537, 546, 536, 540, 540, 533, 529, 538, 525, 531, 533, 529, 527, 518, 516, 519, 523, 522, 517, 513, 520, 510, 514, 0, 512, 0, 0, 0, 511, 511, 0, 511, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 509, 0, 510, 508, 0, 0, 0, 515, 514, 510, 512, 513, 519, 518, 521, 517, 514, 513, 527, 526, 522, 523, 529, 527, 530, 526, 536, 540, 534, 535, 541]"
received "[587, 580, 574, 575, 575, 573, 574, 567, 569, 559, 564, 565, 562, 557, 554, 556, 550, 554, 553, 548, 547, 542, 544, 548, 539, 542, 540, 540, 533, 534, 534, 530, 531, 523, 534, 531, 524, 526, 519, 519, 524, 515, 516, 518, 514, 516, 522, 512, 509, 510, 510, 512, 0, 0, 0, 0, 0, 0, 0, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 509, 0, 510, 511, 510, 517, 509, 507, 518, 518, 521, 518, 519, 519, 521, 518, 520, 528, 529, 529, 530, 526, 533, 535, 537, 534, 536]"
received "[580, 573, 579, 571, 569, 571, 570, 566, 566, 567, 564, 562, 561, 560, 552, 557, 552, 553, 549, 546, 543, 546, 547, 541, 537, 539, 543, 534, 535, 536, 539, 538, 528, 527, 530, 525, 521, 529, 520, 521, 520, 522, 514, 518, 521, 516, 517, 510, 511, 0, 512, 0, 0, 0, 0, 0, 0, 0, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 508, 0, 0, 0, 510, 0, 0, 510, 0, 515, 509, 518, 516, 516, 520, 523, 525, 520, 531, 530, 527, 526, 536, 526, 534, 529, 537, 535, 534]"
received "[577, 579, 577, 577, 571, 570, 574, 570, 559, 558, 560, 568, 557, 556, 560, 555, 552, 546, 548, 549, 548, 544, 547, 539, 541, 533, 539, 537, 534, 533, 529, 529, 527, 536, 525, 528, 525, 525, 524, 514, 521, 523, 516, 515, 513, 514, 512, 518, 513, 0, 0, 513, 511, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 513, 0, 0, 0, 0, 0, 513, 0, 510, 515, 511, 517, 517, 522, 522, 516, 520, 526, 531, 526, 522, 524, 525, 530, 528, 529, 532, 530, 536, 542, 540]"
received "[583, 586, 580, 579, 576, 572, 574, 568, 561, 566, 561, 565, 557, 564, 561, 559, 554, 548, 547, 544, 552, 545, 551, 541, 539, 536, 541, 537, 535, 532, 535, 535, 532, 532, 533, 523, 522, 522, 522, 526, 526, 515, 518, 519, 512, 516, 516, 514, 516, 513, 511, 511, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 510, 0, 0, 0, 0, 510, 512, 515, 512, 512, 517, 519, 524, 515, 516, 517, 523, 524, 522, 521, 531, 529, 519, 526, 530, 530, 532, 534, 538, 542]"
received "[579, 581, 577, 579, 572, 570, 573, 572, 572, 564, 570, 563, 558, 556, 558, 548, 550, 547, 544, 549, 546, 548, 546, 548, 543, 540, 536, 541, 540, 534, 538, 531, 532, 533, 534, 526, 528, 518, 522, 518, 520, 522, 522, 517, 520, 514, 515, 0, 515, 0, 511, 0, 0, 0, 510, 0, 0, 0, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 510, 515, 511, 0, 514, 508, 524, 519, 516, 515, 518, 514, 524, 517, 523, 522, 526, 528, 520, 534, 536, 535, 541, 540, 531, 539]"
received "[577, 581, 582, 573, 577, 567, 571, 567, 562, 567, 560, 561, 555, 558, 553, 557, 549, 551, 546, 545, 545, 546, 545, 544, 540, 538, 534, 532, 541, 534, 530, 528, 531, 529, 522, 528, 525, 522, 529, 516, 519, 510, 522, 521, 514, 523, 515, 511, 510, 513, 512, 0, 0, 0, 510, 0, 0, 0, 0, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 513, 514, 514, 511, 512, 514, 517, 513, 522, 517, 523, 512, 530, 524, 529, 524, 536, 524, 536, 536, 537, 536, 538]"
received "[580, 578, 579, 575, 575, 568, 565, 565, 564, 565, 560, 560, 565, 555, 556, 551, 551, 550, 547, 546, 541, 545, 541, 546, 531, 545, 532, 540, 536, 535, 535, 527, 531, 531, 528, 519, 529, 524, 526, 519, 523, 523, 514, 515, 513, 518, 515, 520, 0, 511, 511, 0, 0, 0, 0, 513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 0, 0, 0, 510, 0, 0, 0, 0, 0, 0, 510, 510, 520, 519, 515, 515, 523, 515, 515, 515, 526, 512, 515, 518, 524, 531, 525, 528, 531, 529, 527, 532, 531, 533, 539]"
received "[581, 579, 581, 574, 577, 572, 574, 569, 562, 563, 558, 567, 560, 561, 555, 554, 556, 549, 547, 548, 542, 540, 539, 546, 539, 541, 539, 540, 538, 529, 533, 526, 529, 528, 531, 523, 523, 520, 522, 527, 521, 519, 514, 516, 514, 516, 516, 516, 514, 509, 509, 513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 508, 509, 507, 511, 0, 0, 514, 520, 514, 514, 516, 521, 520, 523, 518, 520, 522, 522, 525, 526, 526, 529, 528, 533, 529, 531, 537, 536]"
received "[579, 579, 576, 580, 571, 574, 572, 569, 564, 562, 563, 563, 561, 558, 555, 555, 554, 557, 544, 548, 547, 544, 537, 548, 541, 536, 545, 535, 541, 535, 535, 543, 536, 529, 528, 528, 517, 528, 519, 522, 522, 521, 521, 520, 513, 0, 515, 512, 512, 515, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 512, 512, 512, 510, 515, 509, 517, 514, 519, 519, 517, 523, 527, 524, 524, 525, 535, 522, 524, 528, 526, 531, 530, 532, 541]"
received "[576, 577, 573, 570, 579, 569, 570, 566, 559, 564, 560, 555, 555, 562, 553, 557, 545, 558, 549, 546, 543, 542, 546, 538, 543, 545, 538, 537, 535, 528, 538, 527, 530, 532, 526, 526, 525, 528, 521, 518, 518, 522, 518, 514, 523, 510, 517, 514, 515, 0, 519, 510, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 509, 0, 0, 0, 0, 0, 0, 0, 511, 519, 519, 0, 521, 520, 521, 520, 520, 517, 519, 528, 524, 522, 529, 531, 527, 529, 529, 532, 537, 532, 535, 537]"
received "[582, 579, 575, 575, 566, 569, 572, 571, 563, 567, 569, 559, 555, 557, 553, 556, 557, 549, 549, 546, 546, 542, 543, 541, 537, 543, 536, 539, 538, 531, 523, 531, 533, 530, 524, 522, 524, 524, 519, 523, 521, 520, 519, 518, 524, 517, 514, 0, 0, 513, 512, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 510, 511, 514, 511, 511, 512, 511, 521, 517, 518, 519, 516, 518, 529, 521, 522, 521, 530, 525, 528, 532, 529, 538, 539, 538]"


I tried to implement following code also for my program. But it didn't worked. I also tried several other solutions present on this community.

import matplotlib.pyplot as plt
import numpy as np


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

# Create the mesh in polar coordinates and compute corresponding Z.
r = np.linspace(0, 1.25, 50)
p = np.linspace(0, 2*np.pi, 50)
R, P = np.meshgrid(r, p)
Z = ((R**2 - 1)**2)

# Express the mesh in the cartesian system.
X, Y = R*np.cos(P), R*np.sin(P)

# Plot the surface.
ax.plot_surface(X, Y, Z, cmap=plt.cm.YlGnBu_r)

# Tweak the limits and add latex math labels.
ax.set_zlim(0, 1)
ax.set_xlabel(r'$\phi_\mathrm{real}$')
ax.set_ylabel(r'$\phi_\mathrm{im}$')
ax.set_zlabel(r'$V(\phi)$')

plt.show()

But I am unable to plot the above points in 3d plot. Please help in plotting the graph. Thanks in advance.

Edit: Theta range is from 55 deg to 125 deg. with resolution 0.25 deg. i.e 1st point is at 55 deg, 2nd point is at 55.25 deg, third point is at 55.5 deg.....nth point is at 125 deg. And I have fixed my sensor on the wall so phi is fixed at 90 deg.

  • You need to use `mplot3d` instead of regular `matplotlib.pyplot`. Have a look at the tutorials https://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html for the basic syntax – Liris Mar 03 '20 at 09:02
  • @Liris I tried doing that too. But I wasn't able to get my solution. I was getting error **`AttributeError: 'int' object has no attribute 'cos' The above exception was the direct cause of the following exception:`** – shantmanu karna Mar 03 '20 at 09:14
  • @Liris, can you help me suggesting in the above code. – shantmanu karna Mar 03 '20 at 09:16
  • What is `integer_data` ? Is this `xyz position` flattened? What is your code to plot the positions of the tcp? In general `ax.scatter(x, y, z)` should work. – scleronomic Mar 03 '20 at 09:25
  • @scleronomic as in question above, there is output mention. That data I have received is in integer form. and my theta range is between 55 deg to 125 deg. – shantmanu karna Mar 03 '20 at 09:29
  • angle about what axis? and what does as value of `580` mean `55deg + 580 * 0.25deg = 200deg` so it is not in the range. Do you just have a single joint? So an arm of lenght `l` and an angle `theta`. If so you do not need to plot it in 3D – scleronomic Mar 03 '20 at 09:40
  • @shantmanu karna modifying your small code with the use of matplotlib 3d works fine (see my answer). The error you have might occur if you renamed a variable `np` in your code, while you should'nt because it stands for `numpy` – Liris Mar 03 '20 at 13:56
  • @scleronomic 580 is the distance from from origin to the object I am sensing. Or you can say it is R in the polar plot. – shantmanu karna Mar 04 '20 at 04:44
  • So integer_data is R? Then what is theta? Could you provide your code to plot the tcp or a small sketch of what you want to achieve. It is hard to help you in the current situation – scleronomic Mar 04 '20 at 21:34

1 Answers1

-1

The code you give at the end does not run. As mentioned in my comment, you have to use mpl_toolkits.mplot3d. From https://matplotlib.org/3.1.1/gallery/mplot3d/surface3d.html, you directly obtain:

from mpl_toolkits.mplot3d import Axes3D  
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np



fig = plt.figure()
ax = fig.gca(projection='3d')

# Create the mesh in polar coordinates and compute corresponding Z.
r = np.linspace(0, 1.25, 50)
p = np.linspace(0, 2*np.pi, 50)
R, P = np.meshgrid(r, p)
Z = ((R**2 - 1)**2)

# Express the mesh in the cartesian system.
X, Y = R*np.cos(P), R*np.sin(P)

# Plot the surface.
ax.plot_surface(X, Y, Z, cmap=plt.cm.YlGnBu_r)

# Tweak the limits and add latex math labels.
ax.set_zlim(0, 1)
ax.set_xlabel(r'$\phi_\mathrm{real}$')
ax.set_ylabel(r'$\phi_\mathrm{im}$')
ax.set_zlabel(r'$V(\phi)$')

plt.show()

Which runs and gives : enter image description here

EDIT: From your comments, I think in your case you need to replace in the above code:

  • r = integer_data
  • p = np.linspace(55, 125, len(integer_data))*np.pi/180 or p = np.arange(55, 125 + 0.25, 0.25)*np.pi/180. In the first option, you have to check that the spacing is .25 (in degree). In the last, you have to check that the length of integer_data correspond to the length of p. If it does not, your angle range/step is wrong with respect to the data you want to plot.

I won't be able to help more unless you give specific information on the error you obtain, and the variable it is linked to.

Liris
  • 1,399
  • 3
  • 11
  • 29
  • Instead of **`r = np.linspace(0, 1.25, 50)`** I have to put the values I am receiving from TCP port. I am getting the values by using `**data = sock.recv(5000)**` the values I was receiving was in HEX format. So I converted the Hex value in int format using **`integer_data = [int.from_bytes(bytes.fromhex(item), 'big') for item in data[:-8]]`** So Now I have to put this value in place of r in your suggested code. Can you help me in this. – shantmanu karna Mar 04 '20 at 04:52
  • In place of **`p = np.linspace(0, 2*np.pi, 50)`** I am using **`p = np.linspace(11*np.pi/36, 25*np.pi/36, 0.25)`** as the range of angle is from 55 deg to 125 deg. with resolution of 0.25 deg – shantmanu karna Mar 04 '20 at 05:02
  • If you know what you have to put in place of `r` and `p` what don't you do it ? What error do you obtain ? By the way, the syntax you use `p = np.linspace(11*np.pi/36, 25*np.pi/36, 0.25)`, check the documentation for `np.linspace`. I – Liris Mar 04 '20 at 16:09
  • I won't be able to help if you keep giving pieces of you code one by one in the comment. Please edit your initial post by posting the code that gives the error and the error you are obtain, both after correction using my initial answer an comments. The error will probably relate to a variable, which it will be usefull to describe (object type, length, etc ..) – Liris Mar 04 '20 at 16:14
  • @Liris https://stackoverflow.com/questions/60448707/unable-to-plot-polar-point-it-in-3d-matplotlib-using-python I don|t know what he wants anymore.... – Jason Chia Mar 12 '20 at 17:52
  • I gave up, as he stopped answering after (I assume) the last edit to my answer was ok for him, though he did not say it. – Liris Mar 12 '20 at 17:59