def disconnect(self):
        """Disconnect from the scanner

        Raises:
            Exception -- Disconnection error
            Exception -- Delete error
        """

        # Disconnect
        ret = llt.disconnect(self.hLLT)
        if ret < 1:
            raise Exception("Error while disconnect: " + str(ret))

        ret = llt.del_device(self.hLLT)
        if ret < 1:
            raise Exception("Error while delete: " + str(ret))
Ejemplo n.º 2
0
# Warm-up time
time.sleep(2)

ret = llt.get_actual_profile(hLLT, profile_buffer, len(profile_buffer), llt.TProfileConfig.CONTAINER,
                           ct.byref(lost_profiles))
if ret != len(profile_buffer):
    raise ValueError("Error get profile buffer data: " + str(ret))

# Stop transmission
ret = llt.transfer_profiles(hLLT, llt.TTransferProfileType.NORMAL_CONTAINER_MODE, 0)
if ret < 1:
    raise ValueError("Error stopping transfer profiles: " + str(ret))

# Disconnect
ret = llt.disconnect(hLLT)
if ret < 1:
    raise ConnectionAbortedError("Error while disconnect: " + str(ret))

ret = llt.del_device(hLLT)
if ret < 1:
    raise ConnectionAbortedError("Error while delete: " + str(ret))

# Convert buffer to big-endian ushort values and reshape them to 2D array
Z = np.frombuffer(profile_buffer, dtype='>H').reshape((container_size, resolution))

fig = plt.figure()
fig.subplots_adjust(wspace=0.3)
plt.pcolormesh(X, Y, Z)
plt.colorbar()
plt.show()