Skip to content

Commit

Permalink
avoid all logging in DSP functions
Browse files Browse the repository at this point in the history
DSP methods have been tested and documented, and avoiding use of loggers within them can help streamline parallelized action implementations
  • Loading branch information
aromanielloNTIA committed Apr 25, 2023
1 parent 8bfea89 commit 31b3acc
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 26 deletions.
5 changes: 0 additions & 5 deletions scos_actions/signal_processing/apd.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import logging
from typing import Tuple

import numexpr as ne
import numpy as np

from scos_actions.signal_processing.unit_conversion import convert_linear_to_dB

logger = logging.getLogger(__name__)


def get_apd(
time_data: np.ndarray,
Expand Down
3 changes: 0 additions & 3 deletions scos_actions/signal_processing/fft.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import logging
import os

import numexpr as ne
import numpy as np
from scipy.fft import fft as sp_fft
from scipy.signal import get_window

logger = logging.getLogger(__name__)


def get_fft(
time_data: np.ndarray,
Expand Down
15 changes: 0 additions & 15 deletions scos_actions/signal_processing/filtering.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import logging
from multiprocessing.sharedctypes import Value
from typing import Tuple, Union

import numexpr as ne
import numpy as np
from scipy.signal import ellip, ellipord, firwin, kaiserord, sos2zpk, sosfreqz

from scos_actions.signal_processing.unit_conversion import convert_linear_to_dB

logger = logging.getLogger(__name__)


def generate_elliptic_iir_low_pass_filter(
gpass_dB: float,
Expand Down Expand Up @@ -46,7 +39,6 @@ def generate_elliptic_iir_low_pass_filter(
pb_edge_Hz, sb_edge_Hz, gpass_dB, gstop_dB, False, sample_rate_Hz
)
sos = ellip(ord, gpass_dB, gstop_dB, wn, "lowpass", False, "sos", sample_rate_Hz)
logger.debug(f"Generated low-pass IIR filter with order {ord}.")
return sos


Expand Down Expand Up @@ -80,9 +72,6 @@ def generate_fir_low_pass_filter(
True,
fs=sample_rate_Hz,
)
logger.debug(
f"Generated Type {'I' if ord % 2 == 0 else 'II'} low-pass FIR filter with order {ord} and length {ord + 1}."
)
return taps


Expand Down Expand Up @@ -150,10 +139,6 @@ def get_iir_enbw(
raise ValueError(
"Supplied frequency values must fall within +/- Nyquist frequency at baseband."
)
logger.debug(
f"Calculating filter ENBW using a frequency response of {len(worN)} points "
+ f"from {min(worN)} Hz to {max(worN)} Hz."
)
w, h = get_iir_frequency_response(sos, worN, sample_rate_Hz)
dw = np.mean(np.diff(w))
h = np.abs(h) ** 2.0
Expand Down
3 changes: 0 additions & 3 deletions scos_actions/signal_processing/power_analysis.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import logging
from enum import Enum, EnumMeta

import numexpr as ne
import numpy as np

logger = logging.getLogger(__name__)


def calculate_power_watts(val_volts, impedance_ohms: float = 50.0):
"""
Expand Down

0 comments on commit 31b3acc

Please sign in to comment.