# Path: mlat/profile.py
# def trackcpu(f, **kwargs):
# def dump_cpu_profiles(tofile=None):
# def trackcpu(f, name=None, **kwargs):
#     def cpu_measurement_wrapper(*args, **kwargs):
# def dump_cpu_profiles(tofile=sys.stderr):
# 
# Path: mlat/server/kalman.py
# class KalmanState(object):
# class KalmanStateCV(KalmanState):
# class KalmanStateCA(KalmanState):
#     def __init__(self, icao):
#     def _reset(self):
#     def observation_function_without_altitude(self, state, *, positions):
#     def observation_function_with_altitude(self, state, *, positions):
#     def _update_derived(self):
#     def update(self, position_time, measurements, altitude, altitude_error,
#                leastsquares_position, leastsquares_cov, distinct, dof):
#     def set_initial_state(self, leastsquares_position, leastsquares_cov):
#     def transition_function(self, state, *, dt):
#     def transition_covariance(self, dt):
#     def set_initial_state(self, leastsquares_position, leastsquares_cov):
#     def transition_function(self, state, *, dt):
#     def transition_covariance(self, dt):
#     def set_initial_state(self, leastsquares_position, leastsquares_cov):
#     def transition_function(self, state, *, dt):
#     def transition_covariance(self, dt):
#         C = numpy.array([[-math.sin(lon_r), math.cos(lon_r), 0],
#                          [math.sin(-lat_r) * math.cos(lon_r), math.sin(-lat_r) * math.sin(lon_r), math.cos(-lat_r)],
#                          [math.cos(-lat_r) * math.cos(lon_r), math.cos(-lat_r) * math.sin(lon_r), -math.sin(-lat_r)]])


import asyncio
from mlat import profile
from mlat.server import kalman
        # last multilateration, time (monotonic)
        self.last_result_time = None
        # last multilateration, ECEF position
        self.last_result_position = None
        # last multilateration, variance
        self.last_result_var = None
        # last multilateration, distinct receivers
        self.last_result_distinct = None
        # kalman filter state
        self.kalman = kalman.KalmanStateCA(self.icao)

        self.callsign = None
        self.squawk = None

    @property
    def interesting(self):
        """Is this aircraft interesting, i.e. should we forward traffic for it?"""
        return bool(self.sync_interest or (self.allow_mlat and len(self.mlat_interest) >= 3))

    def __lt__(self, other):
        return self.icao < other.icao


class Tracker(object):
    """Tracks which receivers can see which aircraft, and asks receivers to
    forward traffic accordingly."""

    def __init__(self, partition):
        self.aircraft = {}
        self.partition_id = partition[0] - 1

# Path: mlat/profile.py
# def trackcpu(f, **kwargs):
# def dump_cpu_profiles(tofile=None):
# def trackcpu(f, name=None, **kwargs):
#     def cpu_measurement_wrapper(*args, **kwargs):
# def dump_cpu_profiles(tofile=sys.stderr):
# 
# Path: mlat/server/kalman.py
# class KalmanState(object):
# class KalmanStateCV(KalmanState):
# class KalmanStateCA(KalmanState):
#     def __init__(self, icao):
#     def _reset(self):
#     def observation_function_without_altitude(self, state, *, positions):
#     def observation_function_with_altitude(self, state, *, positions):
#     def _update_derived(self):
#     def update(self, position_time, measurements, altitude, altitude_error,
#                leastsquares_position, leastsquares_cov, distinct, dof):
#     def set_initial_state(self, leastsquares_position, leastsquares_cov):
#     def transition_function(self, state, *, dt):
#     def transition_covariance(self, dt):
#     def set_initial_state(self, leastsquares_position, leastsquares_cov):
#     def transition_function(self, state, *, dt):
#     def transition_covariance(self, dt):
#     def set_initial_state(self, leastsquares_position, leastsquares_cov):
#     def transition_function(self, state, *, dt):
#     def transition_covariance(self, dt):
#         C = numpy.array([[-math.sin(lon_r), math.cos(lon_r), 0],
#                          [math.sin(-lat_r) * math.cos(lon_r), math.sin(-lat_r) * math.sin(lon_r), math.cos(-lat_r)],
#                          [math.cos(-lat_r) * math.cos(lon_r), math.cos(-lat_r) * math.sin(lon_r), -math.sin(-lat_r)]])


# Path: mlat/server/tracker.py
import asyncio
from mlat import profile
from mlat.server import kalman

        # last multilateration, time (monotonic)
        self.last_result_time = None
        # last multilateration, ECEF position
        self.last_result_position = None
        # last multilateration, variance
        self.last_result_var = None
        # last multilateration, distinct receivers
        self.last_result_distinct = None
        # kalman filter state
        self.kalman = kalman.KalmanStateCA(self.icao)

        self.callsign = None
        self.squawk = None

    @property
    def interesting(self):
        """Is this aircraft interesting, i.e. should we forward traffic for it?"""
        return bool(self.sync_interest or (self.allow_mlat and len(self.mlat_interest) >= 3))

    def __lt__(self, other):
        return self.icao < other.icao


class Tracker(object):
    """Tracks which receivers can see which aircraft, and asks receivers to
    forward traffic accordingly."""

    def __init__(self, partition):
        self.aircraft = {}
        self.partition_id = partition[0] - 1

        self.partition_count = partition[1]