traffic/algorithms/navigation.py
def aligned_on_navpoint(
        self,
        points: Iterable["Navaid"],
        angle_precision: int = 1,
        time_precision: str = "2T",
        min_time: str = "30s",
        min_distance: int = 80,
    ) -> Iterator["Flight"]:
        """Iterates on segments of trajectories aligned with one of the given
        navigational beacons passed in parameter.

        The name of the navigational beacon is assigned in a new column
        `navaid`.

        """

        # The following cast secures the typing
        self = cast("Flight", self)
        for navpoint in points:
            tentative = (
                self.distance(navpoint)
                .bearing(navpoint)
                .assign(
                    b_diff=lambda df: df.distance
                    * (np.radians(df.bearing - df.track).abs()),
                    delta=lambda df: (df.bearing - df.track).abs(),
                )
                .query(f"delta < {angle_precision} and distance < 500")
            )
            if tentative is not None:
                for chunk in tentative.split(time_precision):
                    if (
                        chunk.longer_than(min_time)
                        and chunk.min("distance") < min_distance
                    ):
                        yield chunk.assign(navaid=navpoint.name)
Iterates on segments of trajectories aligned with one of the given
        navigational beacons passed in parameter.

        The name of the navigational beacon is assigned in a new column
        `navaid`.

        
Iterates on segments of trajectories aligned with one of the given
navigational beacons passed in parameter.

The name of the navigational beacon is assigned in a new column
`navaid`.
Iterates on segments of trajectories aligned with one of the given navigational beacons passed in parameter . The name of the navigational beacon is assigned in a new column ` navaid ` .
def aligned_on_navpoint(
        self,
        points: Iterable["Navaid"],
        angle_precision: int = 1,
        time_precision: str = "2T",
        min_time: str = "30s",
        min_distance: int = 80,
    ) -> Iterator["Flight"]:
        self = cast("Flight", self)
        for navpoint in points:
            tentative = (
                self.distance(navpoint)
                .bearing(navpoint)
                .assign(
                    b_diff=lambda df: df.distance
                    * (np.radians(df.bearing - df.track).abs()),
                    delta=lambda df: (df.bearing - df.track).abs(),
                )
                .query(f"delta < {angle_precision} and distance < 500")
            )
            if tentative is not None:
                for chunk in tentative.split(time_precision):
                    if (
                        chunk.longer_than(min_time)
                        and chunk.min("distance") < min_distance
                    ):
                        yield chunk.assign(navaid=navpoint.name)
def aligned_on_navpoint ( self , points : Iterable [ "Navaid" ] , angle_precision : int = 1 , time_precision : str = "2T" , min_time : str = "30s" , min_distance : int = 80 , ) -> Iterator [ "Flight" ] : self = cast ( "Flight" , self ) for navpoint in points : tentative = ( self . distance ( navpoint ) . bearing ( navpoint ) . assign ( b_diff = lambda df : df . distance * ( np . radians ( df . bearing - df . track ) . abs ( ) ) , delta = lambda df : ( df . bearing - df . track ) . abs ( ) , ) . query ( f"delta < {angle_precision} and distance < 500" ) ) if tentative is not None : for chunk in tentative . split ( time_precision ) : if ( chunk . longer_than ( min_time ) and chunk . min ( "distance" ) < min_distance ) : yield chunk . assign ( navaid = navpoint . name )
Iterates on segments of trajectories aligned with one of the given
navigational beacons passed in parameter.
Iterates on segments of trajectories aligned with one of the given navigational beacons passed in parameter .
"""Iterates on segments of trajectories aligned with one of the given
        navigational beacons passed in parameter.

        The name of the navigational beacon is assigned in a new column
        `navaid`.

        """ # The following cast secures the typing
self
points
Iterable["Navaid"]
angle_precision
int
time_precision
str
min_time
str
min_distance
int