rf-funcitons-py 0.1.1__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rf_funcitons_py-0.1.1 → rf_funcitons_py-0.1.3}/PKG-INFO +4 -1
- {rf_funcitons_py-0.1.1 → rf_funcitons_py-0.1.3}/pyproject.toml +6 -2
- rf_funcitons_py-0.1.3/rafpy/__init__.py +3 -0
- rf_funcitons_py-0.1.3/rafpy/bpf_kernal.py +3 -0
- {rf_funcitons_py-0.1.1 → rf_funcitons_py-0.1.3}/rafpy/logic.py +1 -7
- rf_funcitons_py-0.1.3/rafpy/rf_filter.py +38 -0
- {rf_funcitons_py-0.1.1 → rf_funcitons_py-0.1.3}/rf_funcitons_py.egg-info/PKG-INFO +4 -1
- {rf_funcitons_py-0.1.1 → rf_funcitons_py-0.1.3}/rf_funcitons_py.egg-info/SOURCES.txt +3 -0
- rf_funcitons_py-0.1.3/rf_funcitons_py.egg-info/requires.txt +3 -0
- rf_funcitons_py-0.1.1/rafpy/__init__.py +0 -1
- {rf_funcitons_py-0.1.1 → rf_funcitons_py-0.1.3}/README.md +0 -0
- {rf_funcitons_py-0.1.1 → rf_funcitons_py-0.1.3}/rf_funcitons_py.egg-info/dependency_links.txt +0 -0
- {rf_funcitons_py-0.1.1 → rf_funcitons_py-0.1.3}/rf_funcitons_py.egg-info/top_level.txt +0 -0
- {rf_funcitons_py-0.1.1 → rf_funcitons_py-0.1.3}/setup.cfg +0 -0
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rf_funcitons_py
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: First package from a notebook
|
|
5
5
|
Author-email: Avery Books <abooks104@gmail.com>
|
|
6
6
|
Requires-Python: >3.8
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Requires-Dist: matplotlib
|
|
10
|
+
Requires-Dist: scipy
|
|
8
11
|
|
|
9
12
|
#My First Package
|
|
10
13
|
This package contains my alias source signal identification function
|
|
@@ -4,12 +4,16 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "rf_funcitons_py"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.3"
|
|
8
8
|
description = "First package from a notebook"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{name = "Avery Books", email = "abooks104@gmail.com"}]
|
|
11
11
|
requires-python = ">3.8"
|
|
12
|
-
dependencies = [
|
|
12
|
+
dependencies = [
|
|
13
|
+
"numpy",
|
|
14
|
+
"matplotlib",
|
|
15
|
+
"scipy",
|
|
16
|
+
]
|
|
13
17
|
|
|
14
18
|
[tool.setuptools]
|
|
15
19
|
packages = ["rafpy"]
|
|
@@ -3,7 +3,7 @@ def id_signal_candidates(fig_num, observed, current_fs, filter_range=None, show_
|
|
|
3
3
|
#filter_range: tuple (f_min, f_max)
|
|
4
4
|
|
|
5
5
|
candidates =[]
|
|
6
|
-
f_nyquist =
|
|
6
|
+
f_nyquist = current_fs /2
|
|
7
7
|
|
|
8
8
|
#logic for finding frequency within filter range
|
|
9
9
|
match = None
|
|
@@ -56,12 +56,6 @@ def id_signal_candidates(fig_num, observed, current_fs, filter_range=None, show_
|
|
|
56
56
|
ax.set_title(f"Fig {fig_num}. Signal Identification (Observed: {observed} Hz | $f_s$: {current_fs} Hz | Bandpass {np.min(filter_range)}-{np.max(filter_range)} Hz)", fontweight='bold')
|
|
57
57
|
ax.set_xlabel("Frequency (Hz)", fontweight='bold')
|
|
58
58
|
ax.set_ylim(0, 1.6)
|
|
59
|
-
desc = (
|
|
60
|
-
f"""Fig {fig_num}. You saw a signal at {observed} Hz with a sampling rate of {current_fs} Hz. If you used a bandpass filter then the highlighted frequency is the original frequency considering any aliasing observed and which Nyquist zone it resides in. If you did not use a bandpass filter, then this lists the possible frequencies associated with the sampled signal, which can be filtered manually using known physics of your source."""
|
|
61
|
-
)
|
|
62
|
-
wrapped_desc = textwrap.fill(desc, width=90)
|
|
63
|
-
plt.figtext(0.5, 0.05, wrapped_desc, ha='center', fontsize=10,
|
|
64
|
-
bbox=dict(boxstyle="round,pad=0.3", fc="#f0f0f0", ec="black", alpha=0.5))
|
|
65
59
|
plt.legend(loc='upper right')
|
|
66
60
|
print("-" * 30)
|
|
67
61
|
print(f"ANALYSIS FOR {observed} Hz (Fs = {current_fs} Hz)")
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
def RF_filter(signal_array, filter_kernel, caption_text1, caption_text2, sampling_rate=1.0, show_graph=True):
|
|
2
|
+
normalized_kernel = filter_kernel / np.sum(filter_kernel)
|
|
3
|
+
filtered_signal = signal.fftconvolve(signal_array, normalized_kernel, mode='same')
|
|
4
|
+
if show_graph:
|
|
5
|
+
N = len(signal_array)
|
|
6
|
+
t = np.arange(N) / sampling_rate
|
|
7
|
+
M = len(filter_kernel)
|
|
8
|
+
t_kernel = np.arange(M) / sampling_rate
|
|
9
|
+
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 10))
|
|
10
|
+
plt.subplots_adjust(bottom=0.1, hspace=0.6)
|
|
11
|
+
ax1.set_title("Fig 1. Input 1: Signal & Filter Kernel", fontweight='bold')
|
|
12
|
+
ax1.plot(t, signal_array, color='steelblue', alpha=0.6, label='Input Signal (Left Axis)')
|
|
13
|
+
ax1.tick_params(axis='y', labelcolor='steelblue')
|
|
14
|
+
ax1_twin = ax1.twinx()
|
|
15
|
+
ax1_twin.plot(t_kernel, normalized_kernel, color='#D62728', linewidth=2, label='Filter Kernal (Right Axis)')
|
|
16
|
+
ax1_twin.fill_between(t_kernel, 0, normalized_kernel, color='#D62728', alpha=0.3)
|
|
17
|
+
ax1_twin.tick_params(axis='y', labelcolor='#D62728')
|
|
18
|
+
ax1_twin.set_ylim(bottom=0)
|
|
19
|
+
ax1_twin.set_ylabel("Normalized Amplitude", color='#D62728')
|
|
20
|
+
lines_1, labels_1 = ax1.get_legend_handles_labels()
|
|
21
|
+
lines_2, labels_2 = ax1_twin.get_legend_handles_labels()
|
|
22
|
+
ax1.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')
|
|
23
|
+
ax1.set_xlabel(f"Time (s)if Fs={sampling_rate} Hz")
|
|
24
|
+
ax1.set_ylabel("Amplitude", color = 'steelblue')
|
|
25
|
+
desc_1 = caption_text1
|
|
26
|
+
desc_2 = caption_text2
|
|
27
|
+
ax1.text(0.5, -0.25, textwrap.fill(desc_1, width = 100), transform=ax1.transAxes, ha='center', va='top', fontsize=10, color='darkred', bbox=dict(boxstyle="round,pad=0.3", fc="white", ec="gray", alpha=0.5))
|
|
28
|
+
ax2.set_title("Fig 2. Output: Convolved Result", fontweight='bold')
|
|
29
|
+
ax2.plot(t, signal_array, color='gray', alpha=0.3, label='(Original Input)')
|
|
30
|
+
ax2.plot(t, filtered_signal, color='green', linewidth=2, label='Filtered Output')
|
|
31
|
+
ax2.set_xlabel(f"Time (seconds) if Fs={sampling_rate}Hz")
|
|
32
|
+
ax2.set_ylabel("Amplitude")
|
|
33
|
+
ax2.legend(loc='upper right')
|
|
34
|
+
ax2.grid(True, alpha=0.3)
|
|
35
|
+
ax2.text(0.5, -0.3, textwrap.fill(desc_2, width = 100), transform=ax2.transAxes, ha='center', va='top', fontsize=10, color='darkgreen', bbox=dict(boxstyle="round,pad=0.3", fc="white", ec="gray", alpha=0.5))
|
|
36
|
+
|
|
37
|
+
plt.show()
|
|
38
|
+
return filtered_signal
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rf_funcitons_py
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: First package from a notebook
|
|
5
5
|
Author-email: Avery Books <abooks104@gmail.com>
|
|
6
6
|
Requires-Python: >3.8
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Requires-Dist: matplotlib
|
|
10
|
+
Requires-Dist: scipy
|
|
8
11
|
|
|
9
12
|
#My First Package
|
|
10
13
|
This package contains my alias source signal identification function
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
README.md
|
|
2
2
|
pyproject.toml
|
|
3
3
|
rafpy/__init__.py
|
|
4
|
+
rafpy/bpf_kernal.py
|
|
4
5
|
rafpy/logic.py
|
|
6
|
+
rafpy/rf_filter.py
|
|
5
7
|
rf_funcitons_py.egg-info/PKG-INFO
|
|
6
8
|
rf_funcitons_py.egg-info/SOURCES.txt
|
|
7
9
|
rf_funcitons_py.egg-info/dependency_links.txt
|
|
10
|
+
rf_funcitons_py.egg-info/requires.txt
|
|
8
11
|
rf_funcitons_py.egg-info/top_level.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .logic import id_signal_candidates
|
|
File without changes
|
{rf_funcitons_py-0.1.1 → rf_funcitons_py-0.1.3}/rf_funcitons_py.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|