From 773efff9bcbf2ea9bf03a1fb1509c1ea24315015 Mon Sep 17 00:00:00 2001 From: Junzi Sun Date: Tue, 27 Mar 2018 18:24:22 +0200 Subject: [PATCH] added deprecation waring --- pyModeS/decoder/__init__.py | 2 ++ pyModeS/decoder/ehs.py | 14 ++++++++++++++ pyModeS/decoder/util.py | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pyModeS/decoder/__init__.py b/pyModeS/decoder/__init__.py index f298a61..031efee 100644 --- a/pyModeS/decoder/__init__.py +++ b/pyModeS/decoder/__init__.py @@ -1 +1,3 @@ from __future__ import absolute_import, print_function, division + +from pyModeS.decoder import * diff --git a/pyModeS/decoder/ehs.py b/pyModeS/decoder/ehs.py index 56e8386..b5ec48c 100644 --- a/pyModeS/decoder/ehs.py +++ b/pyModeS/decoder/ehs.py @@ -5,3 +5,17 @@ from pyModeS.decoder.bds.bds44 import * from pyModeS.decoder.bds.bds50 import * from pyModeS.decoder.bds.bds53 import * from pyModeS.decoder.bds.bds60 import * + +def BDS(msg): + import warnings + from pyModeS.decoder.bds import infer + warnings.simplefilter('always', DeprecationWarning) + warnings.warn("pms.ehs.BDS() is deprecated, use pms.bds.infer() instead", DeprecationWarning) + return infer(msg) + +def icao(msg): + import warnings + from pyModeS.decoder.modes import icao + warnings.simplefilter('always', DeprecationWarning) + warnings.warn("pms.ehs.icao() deprecated, please use pms.modes.icao() instead", DeprecationWarning) + return icao(msg) diff --git a/pyModeS/decoder/util.py b/pyModeS/decoder/util.py index d561ded..ae82162 100644 --- a/pyModeS/decoder/util.py +++ b/pyModeS/decoder/util.py @@ -41,7 +41,7 @@ def hex2int(hexstr): def bin2np(binstr): """Convert a binary string to numpy array. """ - return np.fromstring(binstr, 'u1') - ord('0') + return np.array([int(i) for i in binstr]) def np2bin(npbin):