File: benchmark_ecef2geo.py

package info (click to toggle)
pymap3d 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 540 kB
  • sloc: python: 3,742; ruby: 105; makefile: 4
file content (31 lines) | stat: -rw-r--r-- 567 bytes parent folder | download | duplicates (2)
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")