Skip to content

Commit

Permalink
Updated jamming avoidance code
Browse files Browse the repository at this point in the history
  • Loading branch information
dania-tii authored and martin-tii committed Oct 24, 2023
1 parent 061f732 commit 2e22492
Show file tree
Hide file tree
Showing 18 changed files with 485 additions and 609 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from options import Options, VALID_CHANNELS
from util import map_freq_to_channel
from log_config import logger


class ChannelQualityEstimator:
Expand Down Expand Up @@ -39,7 +40,7 @@ def __init__(self) -> None:
except FileNotFoundError:
raise FileNotFoundError("Model file not found")
except Exception as e:
print(f"Exception error in loading pretrained model: {e}") if self.args.debug else None
logger.info(f"Exception error in loading pretrained model: {e}")

def _forward(self, feat_array: np.ndarray) -> np.ndarray:
"""
Expand Down Expand Up @@ -84,7 +85,7 @@ def _compute_channel_quality(self, probs: np.ndarray) -> np.ndarray:

return channel_quality

def check_arrays(self, feat_array: np.ndarray, frequencies: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
def _check_arrays(self, feat_array: np.ndarray, frequencies: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
"""
Check if numpy arrays contain NaN values or contain inf values.
Expand Down Expand Up @@ -126,7 +127,7 @@ def estimate(self, feat_array: np.ndarray, frequencies: np.ndarray) -> Tuple[np.
:return: A tuple containing the estimated channel quality scores (1D NumPy array) and the class probabilities
(2D NumPy array).
"""
feat_array, frequencies = self.check_arrays(feat_array, frequencies)
feat_array, frequencies = self._check_arrays(feat_array, frequencies)

# Check if feat_array and frequencies arrays are empty
if feat_array.size == 0 or frequencies.size == 0:
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2e22492

Please sign in to comment.