cleanup
This commit is contained in:
parent
1107a7f2bb
commit
cfe0227ca6
10
kglobe.py
10
kglobe.py
@ -7,21 +7,16 @@ import numpy as np
|
|||||||
import math
|
import math
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
import requests
|
|
||||||
import argparse
|
import argparse
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
|
||||||
import IP2Location
|
import IP2Location
|
||||||
from datetime import timezone, datetime
|
from datetime import timezone, datetime
|
||||||
|
|
||||||
from terminalplotter import TerminalPlotter
|
from terminalplotter import TerminalPlotter
|
||||||
|
|
||||||
# TODO: Color arches based on latency
|
# DONE: Color arches based on latency
|
||||||
# TODO: Text info (num hops etc.)
|
# TODO: Text info (num hops etc.)
|
||||||
# TODO: Mouse support
|
# TODO: Mouse support
|
||||||
# DONE: Interactive globe (spin w/ keys)
|
|
||||||
# DONE: Image spacing
|
|
||||||
# DONE: Async rendering?
|
|
||||||
|
|
||||||
EXAMPLE_ROUTE = [
|
EXAMPLE_ROUTE = [
|
||||||
(47.996, 7.849), # freiburg
|
(47.996, 7.849), # freiburg
|
||||||
@ -33,8 +28,8 @@ EXAMPLE_ROUTE = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# Convert lat/lon to Cartesian coordinates
|
|
||||||
def latlon_to_xyz(lat: float, lon: float, radius=1.0):
|
def latlon_to_xyz(lat: float, lon: float, radius=1.0):
|
||||||
|
'''Convert lat/lon to Cartesian coordinates'''
|
||||||
lat_rad = np.radians(lat)
|
lat_rad = np.radians(lat)
|
||||||
lon_rad = np.radians(lon)
|
lon_rad = np.radians(lon)
|
||||||
x = radius * np.cos(lat_rad) * np.cos(lon_rad)
|
x = radius * np.cos(lat_rad) * np.cos(lon_rad)
|
||||||
@ -71,6 +66,7 @@ def generate_arch(p1, p2, height_factor=0.2, n_points=100):
|
|||||||
|
|
||||||
|
|
||||||
def traceroute(target: str):
|
def traceroute(target: str):
|
||||||
|
'''Run traceroute and look up the coordinates in geo database'''
|
||||||
database = IP2Location.IP2Location("IP2LOCATION-LITE-DB5.BIN", "SHARED_MEMORY")
|
database = IP2Location.IP2Location("IP2LOCATION-LITE-DB5.BIN", "SHARED_MEMORY")
|
||||||
|
|
||||||
# Run traceroute command
|
# Run traceroute command
|
||||||
|
@ -6,9 +6,6 @@ import termios
|
|||||||
import tty
|
import tty
|
||||||
import vtk
|
import vtk
|
||||||
from vtk.util import numpy_support
|
from vtk.util import numpy_support
|
||||||
import numpy as np
|
|
||||||
from io import BytesIO
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
import pyvista as pv
|
import pyvista as pv
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user