1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#!/usr/bin/env python3
"""
benchmark ecef2geodetic
"""
import argparse
import time
import numpy as np
from pymap3d.ecef import ecef2geodetic
ll0 = (42.0, 82.0)
def bench(N: int) -> float:
x = np.random.random(N)
y = np.random.random(N)
z = np.random.random(N)
tic = time.monotonic()
_, _, _ = ecef2geodetic(x, y, z)
return time.monotonic() - tic
if __name__ == "__main__":
p = argparse.ArgumentParser()
p.add_argument("N", type=int)
args = p.parse_args()
N = args.N
print(f"ecef2geodetic: {bench(N):.3f} seconds")
|