# Path: pyModeS/decoder/adsb.py
# def df(msg):
# def icao(msg):
# def typecode(msg):
# def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None):
# def position_with_ref(msg, lat_ref, lon_ref):
# def altitude(msg):
# def velocity(msg, source=False):
# def speed_heading(msg):
# def oe_flag(msg):
# def version(msg):
# def nuc_p(msg):
# def nuc_v(msg):
# def nic_v1(msg, NICs):
# def nic_v2(msg, NICa, NICbc):
# def nic_s(msg):
# def nic_a_c(msg):
# def nic_b(msg):
# def nac_p(msg):
# def nac_v(msg):
# def sil(msg, version):
#         HPL = uncertainty.NUCp[NUCp]["HPL"]
#         HVE = uncertainty.NUCv[NUCv]["HVE"]
#         VVE = uncertainty.NUCv[NUCv]["VVE"]
#         HVE, VVE = uncertainty.NA, uncertainty.NA
#     NIC = uncertainty.TC_NICv1_lookup[tc]
#         NIC = NIC[NICs]
#         VPL = uncertainty.NICv1[NIC][NICs]["VPL"]
#     NIC = uncertainty.TC_NICv2_lookup[tc]
#             NIC = NIC[NICs]
#         EPU = uncertainty.NACp[NACp]["EPU"]
#         VEPU = uncertainty.NACp[NACp]["VEPU"]
#         EPU, VEPU = uncertainty.NA, uncertainty.NA
#         SIL = common.bin2int(msgbin[76:78])
#         SIL = common.bin2int(msgbin[82:84])
#         PE_VPL = uncertainty.SIL[SIL]["PE_VPL"]
#             SIL_SUP = common.bin2int(msgbin[39])
#             SIL_SUP = common.bin2int(msgbin[86])


import sys
import time
import pandas as pd
from tqdm import tqdm
from pyModeS.decoder import adsb
    from pyModeS.decoder import common
    from pyModeS.decoder import c_common as common

fin = sys.argv[1]

df = pd.read_csv(fin, names=["ts", "df", "icao", "msg"])
df_adsb = df[df["df"] == 17].copy()

total = df_adsb.shape[0]


def native():


    # airborne position
    m_air_0 = None
    m_air_1 = None

    # surface position
    m_surf_0 = None
    m_surf_1 = None

    for i, r in tqdm(df_adsb.iterrows(), total=total):
        ts = r.ts
        m = r.msg

        downlink_format = common.df(m)
        crc = common.crc(m)

# Path: pyModeS/decoder/adsb.py
# def df(msg):
# def icao(msg):
# def typecode(msg):
# def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None):
# def position_with_ref(msg, lat_ref, lon_ref):
# def altitude(msg):
# def velocity(msg, source=False):
# def speed_heading(msg):
# def oe_flag(msg):
# def version(msg):
# def nuc_p(msg):
# def nuc_v(msg):
# def nic_v1(msg, NICs):
# def nic_v2(msg, NICa, NICbc):
# def nic_s(msg):
# def nic_a_c(msg):
# def nic_b(msg):
# def nac_p(msg):
# def nac_v(msg):
# def sil(msg, version):
#         HPL = uncertainty.NUCp[NUCp]["HPL"]
#         HVE = uncertainty.NUCv[NUCv]["HVE"]
#         VVE = uncertainty.NUCv[NUCv]["VVE"]
#         HVE, VVE = uncertainty.NA, uncertainty.NA
#     NIC = uncertainty.TC_NICv1_lookup[tc]
#         NIC = NIC[NICs]
#         VPL = uncertainty.NICv1[NIC][NICs]["VPL"]
#     NIC = uncertainty.TC_NICv2_lookup[tc]
#             NIC = NIC[NICs]
#         EPU = uncertainty.NACp[NACp]["EPU"]
#         VEPU = uncertainty.NACp[NACp]["VEPU"]
#         EPU, VEPU = uncertainty.NA, uncertainty.NA
#         SIL = common.bin2int(msgbin[76:78])
#         SIL = common.bin2int(msgbin[82:84])
#         PE_VPL = uncertainty.SIL[SIL]["PE_VPL"]
#             SIL_SUP = common.bin2int(msgbin[39])
#             SIL_SUP = common.bin2int(msgbin[86])


# Path: tests/benchmark.py
import sys
import time
import pandas as pd
from tqdm import tqdm
from pyModeS.decoder import adsb
    from pyModeS.decoder import common
    from pyModeS.decoder import c_common as common


fin = sys.argv[1]

df = pd.read_csv(fin, names=["ts", "df", "icao", "msg"])
df_adsb = df[df["df"] == 17].copy()

total = df_adsb.shape[0]


def native():


    # airborne position
    m_air_0 = None
    m_air_1 = None

    # surface position
    m_surf_0 = None
    m_surf_1 = None

    for i, r in tqdm(df_adsb.iterrows(), total=total):
        ts = r.ts
        m = r.msg

        downlink_format = common.df(m)
        crc = common.crc(m)

        icao = adsb.icao(m)