Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
xoolive committed Nov 3, 2024
1 parent 67aea13 commit 10bac92
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
2 changes: 2 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ colour based on the vertical rate average value.

.. jupyter-execute::

import pandas as pd

with plt.style.context("traffic"):
fig, ax = plt.subplots(subplot_kw=dict(projection=Lambert93()))

Expand Down
16 changes: 1 addition & 15 deletions src/traffic/algorithms/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,23 +1022,9 @@ def holding_pattern(
trajectories landing at different European airports including London
Heathrow.
.. warning::
The ``onnxruntime`` package is an optional dependency required for
this function to properly work. At the time being, it is not
available for pip with Python 3.10 but still available on
conda-forge servers.
(new in version 2.8)
"""
try:
import onnxruntime as rt
except ImportError:
warnings.warn(
"Missing optional dependency: onnxruntime.\n"
"Retry after installing with pip or conda."
)
raise
import onnxruntime as rt

# The following cast secures the typing
self = cast("Flight", self)
Expand Down
2 changes: 1 addition & 1 deletion src/traffic/core/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def label(

result = self.assign(
**dict(
(key, False if value is True else None)
(key, False if value is True else pd.NA)
for key, value in kwargs.items()
)
)
Expand Down
9 changes: 5 additions & 4 deletions tests/test_flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ def test_DME_NSE_computation() -> None:
assert_frame_equal(result_df[["NSE", "NSE_idx"]], expected, rtol=1e-3)


@pytest.mark.skipif(version > (3, 12), reason="onnxruntime not ready for 3.12")
# @pytest.mark.skipif(version > (3, 13), reason="onnxruntime not ready")
def test_holding_pattern() -> None:
holding_pattern = belevingsvlucht.holding_pattern().next()
assert holding_pattern is not None
Expand All @@ -887,7 +887,7 @@ def test_holding_pattern() -> None:
)


@pytest.mark.skipif(version > (3, 12), reason="onnxruntime not ready for 3.12")
# @pytest.mark.skipif(version > (3, 13), reason="onnxruntime not ready")
def test_label() -> None:
from traffic.data.datasets import landing_zurich_2019

Expand All @@ -909,9 +909,10 @@ def test_label() -> None:
)

assert labelled.index_max == 2
ils = set(ils for ils in labelled.ILS_unique if ils is not None)
ils = set(ils for ils in labelled.ILS_unique if not pd.isna(ils))
assert ils == {"14", "28"}
assert labelled.duration_min > pd.Timedelta("2 min 30 s")
min_duration = labelled.data.duration.astype("timedelta64[s]").min()
assert min_duration > pd.Timedelta("2 min 30 s")


def test_split_condition() -> None:
Expand Down

0 comments on commit 10bac92

Please sign in to comment.