spectre-core 0.0.10__py3-none-any.whl → 0.0.12__py3-none-any.whl
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.
- spectre_core/_file_io/file_handlers.py +12 -12
- spectre_core/batches/__init__.py +22 -0
- spectre_core/batches/_base.py +146 -0
- spectre_core/batches/_batches.py +197 -0
- spectre_core/batches/_factory.py +27 -0
- spectre_core/{chunks → batches}/_register.py +5 -5
- spectre_core/{chunks → batches}/library/_callisto.py +31 -33
- spectre_core/{chunks → batches}/library/_fixed_center_frequency.py +43 -38
- spectre_core/{chunks → batches}/library/_swept_center_frequency.py +22 -20
- spectre_core/capture_configs/_capture_templates.py +6 -6
- spectre_core/capture_configs/_parameters.py +3 -6
- spectre_core/capture_configs/_ptemplates.py +3 -3
- spectre_core/capture_configs/_pvalidators.py +6 -8
- spectre_core/config/__init__.py +2 -2
- spectre_core/config/_paths.py +5 -5
- spectre_core/config/_time_formats.py +5 -3
- spectre_core/exceptions.py +2 -2
- spectre_core/logging/_configure.py +1 -1
- spectre_core/logging/_log_handlers.py +1 -1
- spectre_core/plotting/_panels.py +1 -1
- spectre_core/post_processing/__init__.py +2 -2
- spectre_core/post_processing/_base.py +6 -6
- spectre_core/post_processing/_factory.py +3 -3
- spectre_core/post_processing/_post_processor.py +5 -5
- spectre_core/post_processing/library/_fixed_center_frequency.py +24 -25
- spectre_core/post_processing/library/_swept_center_frequency.py +68 -83
- spectre_core/receivers/__init__.py +1 -0
- spectre_core/receivers/_base.py +1 -173
- spectre_core/receivers/gr/_base.py +1 -1
- spectre_core/receivers/gr/_rsp1a.py +8 -8
- spectre_core/receivers/gr/_rspduo.py +227 -0
- spectre_core/receivers/gr/_test.py +5 -5
- spectre_core/receivers/library/_rsp1a.py +4 -4
- spectre_core/receivers/library/_rspduo.py +69 -0
- spectre_core/receivers/library/_sdrplay_receiver.py +185 -0
- spectre_core/receivers/library/_test.py +3 -3
- spectre_core/spectrograms/_analytical.py +0 -6
- spectre_core/spectrograms/_spectrogram.py +113 -79
- spectre_core/spectrograms/_transform.py +19 -36
- spectre_core/wgetting/_callisto.py +20 -24
- {spectre_core-0.0.10.dist-info → spectre_core-0.0.12.dist-info}/METADATA +1 -1
- spectre_core-0.0.12.dist-info/RECORD +64 -0
- spectre_core/chunks/__init__.py +0 -22
- spectre_core/chunks/_base.py +0 -116
- spectre_core/chunks/_chunks.py +0 -200
- spectre_core/chunks/_factory.py +0 -25
- spectre_core-0.0.10.dist-info/RECORD +0 -63
- {spectre_core-0.0.10.dist-info → spectre_core-0.0.12.dist-info}/LICENSE +0 -0
- {spectre_core-0.0.10.dist-info → spectre_core-0.0.12.dist-info}/WHEEL +0 -0
- {spectre_core-0.0.10.dist-info → spectre_core-0.0.12.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,227 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: GPL-3.0
|
6
|
+
#
|
7
|
+
# GNU Radio Python Flow Graph
|
8
|
+
# Title: Test receiver
|
9
|
+
# GNU Radio version: 3.10.1.1
|
10
|
+
|
11
|
+
# SPDX-FileCopyrightText: © 2024 Jimmy Fitzpatrick <jcfitzpatrick12@gmail.com>
|
12
|
+
# This file is part of SPECTRE
|
13
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
14
|
+
|
15
|
+
#
|
16
|
+
# RSPduo receiver top blocks
|
17
|
+
#
|
18
|
+
|
19
|
+
from functools import partial
|
20
|
+
from dataclasses import dataclass
|
21
|
+
|
22
|
+
from gnuradio import gr
|
23
|
+
from gnuradio import spectre
|
24
|
+
from gnuradio import sdrplay3
|
25
|
+
|
26
|
+
from spectre_core.capture_configs import Parameters, PNames
|
27
|
+
from spectre_core.config import get_batches_dir_path
|
28
|
+
from ._base import capture
|
29
|
+
|
30
|
+
|
31
|
+
class _tuner_1_fixed_center_frequency(gr.top_block):
|
32
|
+
def __init__(self,
|
33
|
+
tag: str,
|
34
|
+
parameters: Parameters):
|
35
|
+
gr.top_block.__init__(self, catch_exceptions=True)
|
36
|
+
gr.top_block.__init__(self, "tuner_1_fixed", catch_exceptions=True)
|
37
|
+
|
38
|
+
##################################################
|
39
|
+
# Unpack capture config
|
40
|
+
##################################################
|
41
|
+
sample_rate = parameters.get_parameter_value(PNames.SAMPLE_RATE)
|
42
|
+
batch_size = parameters.get_parameter_value(PNames.BATCH_SIZE)
|
43
|
+
center_freq = parameters.get_parameter_value(PNames.CENTER_FREQUENCY)
|
44
|
+
bandwidth = parameters.get_parameter_value(PNames.BANDWIDTH)
|
45
|
+
if_gain = parameters.get_parameter_value(PNames.IF_GAIN)
|
46
|
+
rf_gain = parameters.get_parameter_value(PNames.RF_GAIN)
|
47
|
+
|
48
|
+
##################################################
|
49
|
+
# Blocks
|
50
|
+
##################################################
|
51
|
+
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(get_batches_dir_path(),
|
52
|
+
tag,
|
53
|
+
batch_size,
|
54
|
+
sample_rate)
|
55
|
+
self.sdrplay3_rspduo_0 = sdrplay3.rspduo(
|
56
|
+
'',
|
57
|
+
rspduo_mode="Single Tuner",
|
58
|
+
antenna="Tuner 1 50 ohm",
|
59
|
+
stream_args=sdrplay3.stream_args(
|
60
|
+
output_type='fc32',
|
61
|
+
channels_size=1
|
62
|
+
),
|
63
|
+
)
|
64
|
+
self.sdrplay3_rspduo_0.set_sample_rate(sample_rate)
|
65
|
+
self.sdrplay3_rspduo_0.set_center_freq(center_freq)
|
66
|
+
self.sdrplay3_rspduo_0.set_bandwidth(bandwidth)
|
67
|
+
self.sdrplay3_rspduo_0.set_antenna("Tuner 1 50 ohm")
|
68
|
+
self.sdrplay3_rspduo_0.set_gain_mode(False)
|
69
|
+
self.sdrplay3_rspduo_0.set_gain(if_gain, 'IF')
|
70
|
+
self.sdrplay3_rspduo_0.set_gain(rf_gain, 'RF')
|
71
|
+
self.sdrplay3_rspduo_0.set_freq_corr(0)
|
72
|
+
self.sdrplay3_rspduo_0.set_dc_offset_mode(False)
|
73
|
+
self.sdrplay3_rspduo_0.set_iq_balance_mode(False)
|
74
|
+
self.sdrplay3_rspduo_0.set_agc_setpoint(-30)
|
75
|
+
self.sdrplay3_rspduo_0.set_rf_notch_filter(False)
|
76
|
+
self.sdrplay3_rspduo_0.set_dab_notch_filter(False)
|
77
|
+
self.sdrplay3_rspduo_0.set_am_notch_filter(False)
|
78
|
+
self.sdrplay3_rspduo_0.set_biasT(False)
|
79
|
+
self.sdrplay3_rspduo_0.set_debug_mode(False)
|
80
|
+
self.sdrplay3_rspduo_0.set_sample_sequence_gaps_check(False)
|
81
|
+
self.sdrplay3_rspduo_0.set_show_gain_changes(False)
|
82
|
+
|
83
|
+
|
84
|
+
##################################################
|
85
|
+
# Connections
|
86
|
+
##################################################
|
87
|
+
self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_batched_file_sink_0, 0))
|
88
|
+
|
89
|
+
|
90
|
+
class _tuner_2_fixed_center_frequency(gr.top_block):
|
91
|
+
def __init__(self,
|
92
|
+
tag: str,
|
93
|
+
parameters: Parameters):
|
94
|
+
gr.top_block.__init__(self, catch_exceptions=True)
|
95
|
+
gr.top_block.__init__(self, "tuner_1_fixed", catch_exceptions=True)
|
96
|
+
|
97
|
+
##################################################
|
98
|
+
# Unpack capture config
|
99
|
+
##################################################
|
100
|
+
sample_rate = parameters.get_parameter_value(PNames.SAMPLE_RATE)
|
101
|
+
batch_size = parameters.get_parameter_value(PNames.BATCH_SIZE)
|
102
|
+
center_freq = parameters.get_parameter_value(PNames.CENTER_FREQUENCY)
|
103
|
+
bandwidth = parameters.get_parameter_value(PNames.BANDWIDTH)
|
104
|
+
if_gain = parameters.get_parameter_value(PNames.IF_GAIN)
|
105
|
+
rf_gain = parameters.get_parameter_value(PNames.RF_GAIN)
|
106
|
+
|
107
|
+
##################################################
|
108
|
+
# Blocks
|
109
|
+
##################################################
|
110
|
+
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(get_batches_dir_path(),
|
111
|
+
tag,
|
112
|
+
batch_size,
|
113
|
+
sample_rate)
|
114
|
+
self.sdrplay3_rspduo_0 = sdrplay3.rspduo(
|
115
|
+
'',
|
116
|
+
rspduo_mode="Single Tuner",
|
117
|
+
antenna="Tuner 2 50 ohm",
|
118
|
+
stream_args=sdrplay3.stream_args(
|
119
|
+
output_type='fc32',
|
120
|
+
channels_size=1
|
121
|
+
),
|
122
|
+
)
|
123
|
+
self.sdrplay3_rspduo_0.set_sample_rate(sample_rate)
|
124
|
+
self.sdrplay3_rspduo_0.set_center_freq(center_freq)
|
125
|
+
self.sdrplay3_rspduo_0.set_bandwidth(bandwidth)
|
126
|
+
self.sdrplay3_rspduo_0.set_antenna("Tuner 2 50 ohm")
|
127
|
+
self.sdrplay3_rspduo_0.set_gain_mode(False)
|
128
|
+
self.sdrplay3_rspduo_0.set_gain(if_gain, 'IF')
|
129
|
+
self.sdrplay3_rspduo_0.set_gain(rf_gain, 'RF', False)
|
130
|
+
self.sdrplay3_rspduo_0.set_freq_corr(0)
|
131
|
+
self.sdrplay3_rspduo_0.set_dc_offset_mode(False)
|
132
|
+
self.sdrplay3_rspduo_0.set_iq_balance_mode(False)
|
133
|
+
self.sdrplay3_rspduo_0.set_agc_setpoint(-30)
|
134
|
+
self.sdrplay3_rspduo_0.set_rf_notch_filter(False)
|
135
|
+
self.sdrplay3_rspduo_0.set_dab_notch_filter(False)
|
136
|
+
self.sdrplay3_rspduo_0.set_am_notch_filter(False)
|
137
|
+
self.sdrplay3_rspduo_0.set_biasT(False)
|
138
|
+
self.sdrplay3_rspduo_0.set_stream_tags(False)
|
139
|
+
self.sdrplay3_rspduo_0.set_debug_mode(False)
|
140
|
+
self.sdrplay3_rspduo_0.set_sample_sequence_gaps_check(False)
|
141
|
+
self.sdrplay3_rspduo_0.set_show_gain_changes(False)
|
142
|
+
|
143
|
+
|
144
|
+
##################################################
|
145
|
+
# Connections
|
146
|
+
##################################################
|
147
|
+
self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_batched_file_sink_0, 0))
|
148
|
+
|
149
|
+
|
150
|
+
class _tuner_1_swept_center_frequency(gr.top_block):
|
151
|
+
def __init__(self,
|
152
|
+
tag: str,
|
153
|
+
parameters: Parameters):
|
154
|
+
gr.top_block.__init__(self, catch_exceptions=True)
|
155
|
+
|
156
|
+
##################################################
|
157
|
+
# Unpack capture config
|
158
|
+
##################################################
|
159
|
+
sample_rate = parameters.get_parameter_value(PNames.SAMPLE_RATE)
|
160
|
+
bandwidth = parameters.get_parameter_value(PNames.BANDWIDTH)
|
161
|
+
min_frequency = parameters.get_parameter_value(PNames.MIN_FREQUENCY)
|
162
|
+
max_frequency = parameters.get_parameter_value(PNames.MAX_FREQUENCY)
|
163
|
+
frequency_step = parameters.get_parameter_value(PNames.FREQUENCY_STEP)
|
164
|
+
samples_per_step = parameters.get_parameter_value(PNames.SAMPLES_PER_STEP)
|
165
|
+
if_gain = parameters.get_parameter_value(PNames.IF_GAIN)
|
166
|
+
rf_gain = parameters.get_parameter_value(PNames.RF_GAIN)
|
167
|
+
batch_size = parameters.get_parameter_value(PNames.BATCH_SIZE)
|
168
|
+
|
169
|
+
##################################################
|
170
|
+
# Blocks
|
171
|
+
##################################################
|
172
|
+
self.spectre_sweep_driver_0 = spectre.sweep_driver(min_frequency,
|
173
|
+
max_frequency,
|
174
|
+
frequency_step,
|
175
|
+
sample_rate,
|
176
|
+
samples_per_step,
|
177
|
+
'freq')
|
178
|
+
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(get_batches_dir_path(),
|
179
|
+
tag,
|
180
|
+
batch_size,
|
181
|
+
sample_rate,
|
182
|
+
True,
|
183
|
+
'freq',
|
184
|
+
min_frequency)
|
185
|
+
self.sdrplay3_rspduo_0 = sdrplay3.rspduo(
|
186
|
+
'',
|
187
|
+
rspduo_mode="Single Tuner",
|
188
|
+
antenna="Tuner 1 50 ohm",
|
189
|
+
stream_args=sdrplay3.stream_args(
|
190
|
+
output_type='fc32',
|
191
|
+
channels_size=1
|
192
|
+
),
|
193
|
+
)
|
194
|
+
self.sdrplay3_rspduo_0.set_sample_rate(sample_rate, True)
|
195
|
+
self.sdrplay3_rspduo_0.set_center_freq(min_frequency, True)
|
196
|
+
self.sdrplay3_rspduo_0.set_bandwidth(bandwidth)
|
197
|
+
self.sdrplay3_rspduo_0.set_antenna("Tuner 1 50 ohm")
|
198
|
+
self.sdrplay3_rspduo_0.set_gain_mode(False)
|
199
|
+
self.sdrplay3_rspduo_0.set_gain(if_gain, 'IF', True)
|
200
|
+
self.sdrplay3_rspduo_0.set_gain(rf_gain, 'RF', True)
|
201
|
+
self.sdrplay3_rspduo_0.set_freq_corr(0)
|
202
|
+
self.sdrplay3_rspduo_0.set_dc_offset_mode(False)
|
203
|
+
self.sdrplay3_rspduo_0.set_iq_balance_mode(False)
|
204
|
+
self.sdrplay3_rspduo_0.set_agc_setpoint(-30)
|
205
|
+
self.sdrplay3_rspduo_0.set_rf_notch_filter(False)
|
206
|
+
self.sdrplay3_rspduo_0.set_dab_notch_filter(True)
|
207
|
+
self.sdrplay3_rspduo_0.set_am_notch_filter(False)
|
208
|
+
self.sdrplay3_rspduo_0.set_biasT(False)
|
209
|
+
self.sdrplay3_rspduo_0.set_stream_tags(True)
|
210
|
+
self.sdrplay3_rspduo_0.set_debug_mode(False)
|
211
|
+
self.sdrplay3_rspduo_0.set_sample_sequence_gaps_check(False)
|
212
|
+
self.sdrplay3_rspduo_0.set_show_gain_changes(False)
|
213
|
+
|
214
|
+
|
215
|
+
##################################################
|
216
|
+
# Connections
|
217
|
+
##################################################
|
218
|
+
self.msg_connect((self.spectre_sweep_driver_0, 'freq'), (self.sdrplay3_rspduo_0, 'freq'))
|
219
|
+
self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_batched_file_sink_0, 0))
|
220
|
+
self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_sweep_driver_0, 0))
|
221
|
+
|
222
|
+
|
223
|
+
@dataclass(frozen=True)
|
224
|
+
class CaptureMethods:
|
225
|
+
tuner_1_fixed_center_frequency = partial(capture, top_block_cls=_tuner_1_fixed_center_frequency)
|
226
|
+
tuner_2_fixed_center_frequency = partial(capture, top_block_cls=_tuner_2_fixed_center_frequency)
|
227
|
+
tuner_1_swept_center_frequency = partial(capture, top_block_cls=_tuner_1_swept_center_frequency)
|
@@ -25,7 +25,7 @@ from gnuradio import spectre
|
|
25
25
|
from gnuradio import analog
|
26
26
|
|
27
27
|
from spectre_core.capture_configs import Parameters, PNames
|
28
|
-
from spectre_core.config import
|
28
|
+
from spectre_core.config import get_batches_dir_path
|
29
29
|
from ._base import capture
|
30
30
|
|
31
31
|
|
@@ -33,7 +33,7 @@ class _cosine_signal_1(gr.top_block):
|
|
33
33
|
def __init__(self,
|
34
34
|
tag: str,
|
35
35
|
parameters: Parameters):
|
36
|
-
gr.top_block.__init__(self,
|
36
|
+
gr.top_block.__init__(self, catch_exceptions=True)
|
37
37
|
|
38
38
|
##################################################
|
39
39
|
# Unpack capture config
|
@@ -46,7 +46,7 @@ class _cosine_signal_1(gr.top_block):
|
|
46
46
|
##################################################
|
47
47
|
# Blocks
|
48
48
|
##################################################
|
49
|
-
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(
|
49
|
+
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(get_batches_dir_path(),
|
50
50
|
tag,
|
51
51
|
batch_size,
|
52
52
|
samp_rate)
|
@@ -80,7 +80,7 @@ class _tagged_staircase(gr.top_block):
|
|
80
80
|
def __init__(self,
|
81
81
|
tag: str,
|
82
82
|
parameters: Parameters):
|
83
|
-
gr.top_block.__init__(self,
|
83
|
+
gr.top_block.__init__(self, catch_exceptions=True)
|
84
84
|
|
85
85
|
##################################################
|
86
86
|
# Unpack capture config
|
@@ -100,7 +100,7 @@ class _tagged_staircase(gr.top_block):
|
|
100
100
|
frequency_step,
|
101
101
|
step_increment,
|
102
102
|
samp_rate)
|
103
|
-
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(
|
103
|
+
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(get_batches_dir_path(),
|
104
104
|
tag,
|
105
105
|
batch_size,
|
106
106
|
samp_rate,
|
@@ -11,7 +11,7 @@ from spectre_core.capture_configs import (
|
|
11
11
|
)
|
12
12
|
from ..gr._rsp1a import CaptureMethods
|
13
13
|
from .._spec_names import SpecNames
|
14
|
-
from
|
14
|
+
from ._sdrplay_receiver import SDRPlayReceiver
|
15
15
|
from .._register import register_receiver
|
16
16
|
|
17
17
|
@dataclass
|
@@ -44,7 +44,7 @@ class _Receiver(SDRPlayReceiver):
|
|
44
44
|
self.add_capture_method(Modes.FIXED_CENTER_FREQUENCY,
|
45
45
|
CaptureMethods.fixed_center_frequency)
|
46
46
|
self.add_capture_method(Modes.SWEPT_CENTER_FREQUENCY,
|
47
|
-
CaptureMethods.
|
47
|
+
CaptureMethods.swept_center_frequency)
|
48
48
|
|
49
49
|
|
50
50
|
def _add_capture_templates(self):
|
@@ -55,7 +55,7 @@ class _Receiver(SDRPlayReceiver):
|
|
55
55
|
|
56
56
|
|
57
57
|
def _add_pvalidators(self):
|
58
|
-
self.add_pvalidator(
|
58
|
+
self.add_pvalidator(Modes.FIXED_CENTER_FREQUENCY,
|
59
59
|
self._get_pvalidator_fixed_center_frequency())
|
60
|
-
self.add_pvalidator(
|
60
|
+
self.add_pvalidator(Modes.SWEPT_CENTER_FREQUENCY,
|
61
61
|
self._get_pvalidator_swept_center_frequency())
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# SPDX-FileCopyrightText: © 2024 Jimmy Fitzpatrick <jcfitzpatrick12@gmail.com>
|
2
|
+
# This file is part of SPECTRE
|
3
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
4
|
+
|
5
|
+
from typing import Optional
|
6
|
+
from dataclasses import dataclass
|
7
|
+
from functools import partial
|
8
|
+
|
9
|
+
from spectre_core.capture_configs import (
|
10
|
+
CaptureModes
|
11
|
+
)
|
12
|
+
from ..gr._rspduo import CaptureMethods
|
13
|
+
from .._spec_names import SpecNames
|
14
|
+
from ._sdrplay_receiver import SDRPlayReceiver
|
15
|
+
from .._register import register_receiver
|
16
|
+
|
17
|
+
@dataclass
|
18
|
+
class Modes:
|
19
|
+
TUNER_1_FIXED_CENTER_FREQUENCY = f"tuner-1-{CaptureModes.FIXED_CENTER_FREQUENCY}"
|
20
|
+
TUNER_2_FIXED_CENTER_FREQUENCY = f"tuner-2-{CaptureModes.FIXED_CENTER_FREQUENCY}"
|
21
|
+
TUNER_1_SWEPT_CENTER_FREQUENCY = f"tuner-1-{CaptureModes.SWEPT_CENTER_FREQUENCY}"
|
22
|
+
|
23
|
+
|
24
|
+
@register_receiver("rspduo")
|
25
|
+
class _Receiver(SDRPlayReceiver):
|
26
|
+
def __init__(self,
|
27
|
+
name: str,
|
28
|
+
mode: Optional[str]):
|
29
|
+
super().__init__(name,
|
30
|
+
mode)
|
31
|
+
|
32
|
+
|
33
|
+
def _add_specs(self) -> None:
|
34
|
+
self.add_spec( SpecNames.SAMPLE_RATE_LOWER_BOUND, 200e3 ) # Hz
|
35
|
+
self.add_spec( SpecNames.SAMPLE_RATE_UPPER_BOUND, 10e6 ) # Hz
|
36
|
+
self.add_spec( SpecNames.FREQUENCY_LOWER_BOUND , 1e3 ) # Hz
|
37
|
+
self.add_spec( SpecNames.FREQUENCY_UPPER_BOUND , 2e9 ) # Hz
|
38
|
+
self.add_spec( SpecNames.IF_GAIN_UPPER_BOUND , -20 ) # dB
|
39
|
+
self.add_spec( SpecNames.RF_GAIN_UPPER_BOUND , 0 ) # dB
|
40
|
+
self.add_spec( SpecNames.API_RETUNING_LATENCY , 50 * 1e-3 ) # s
|
41
|
+
self.add_spec( SpecNames.BANDWIDTH_OPTIONS,
|
42
|
+
[200000, 300000, 600000, 1536000, 5000000, 6000000, 7000000, 8000000])
|
43
|
+
|
44
|
+
|
45
|
+
def _add_capture_methods(self) -> None:
|
46
|
+
self.add_capture_method(Modes.TUNER_1_FIXED_CENTER_FREQUENCY,
|
47
|
+
CaptureMethods.tuner_1_fixed_center_frequency)
|
48
|
+
self.add_capture_method(Modes.TUNER_2_FIXED_CENTER_FREQUENCY,
|
49
|
+
CaptureMethods.tuner_2_fixed_center_frequency)
|
50
|
+
self.add_capture_method(Modes.TUNER_1_SWEPT_CENTER_FREQUENCY,
|
51
|
+
CaptureMethods.tuner_1_swept_center_frequency)
|
52
|
+
|
53
|
+
|
54
|
+
def _add_capture_templates(self):
|
55
|
+
self.add_capture_template(Modes.TUNER_1_FIXED_CENTER_FREQUENCY,
|
56
|
+
self._get_capture_template_fixed_center_frequency())
|
57
|
+
self.add_capture_template(Modes.TUNER_2_FIXED_CENTER_FREQUENCY,
|
58
|
+
self._get_capture_template_fixed_center_frequency())
|
59
|
+
self.add_capture_template(Modes.TUNER_1_SWEPT_CENTER_FREQUENCY,
|
60
|
+
self._get_capture_template_swept_center_frequency())
|
61
|
+
|
62
|
+
|
63
|
+
def _add_pvalidators(self):
|
64
|
+
self.add_pvalidator(Modes.TUNER_1_FIXED_CENTER_FREQUENCY,
|
65
|
+
self._get_pvalidator_fixed_center_frequency())
|
66
|
+
self.add_pvalidator(Modes.TUNER_2_FIXED_CENTER_FREQUENCY,
|
67
|
+
self._get_pvalidator_fixed_center_frequency())
|
68
|
+
self.add_pvalidator(Modes.TUNER_1_SWEPT_CENTER_FREQUENCY,
|
69
|
+
self._get_pvalidator_swept_center_frequency())
|
@@ -0,0 +1,185 @@
|
|
1
|
+
# SPDX-FileCopyrightText: © 2024 Jimmy Fitzpatrick <jcfitzpatrick12@gmail.com>
|
2
|
+
# This file is part of SPECTRE
|
3
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
4
|
+
|
5
|
+
from abc import ABC, abstractmethod
|
6
|
+
from typing import Callable, Optional
|
7
|
+
from numbers import Number
|
8
|
+
|
9
|
+
from spectre_core.capture_configs import (
|
10
|
+
CaptureTemplate, CaptureModes, Parameters, Bound, PValidators, PNames,
|
11
|
+
get_base_capture_template, get_base_ptemplate, OneOf, CaptureConfig
|
12
|
+
)
|
13
|
+
from .._base import BaseReceiver
|
14
|
+
from .._spec_names import SpecNames
|
15
|
+
|
16
|
+
class SDRPlayReceiver(BaseReceiver):
|
17
|
+
def _get_pvalidator_fixed_center_frequency(self) -> Callable:
|
18
|
+
def pvalidator(parameters: Parameters):
|
19
|
+
PValidators.fixed_center_frequency(parameters)
|
20
|
+
return pvalidator
|
21
|
+
|
22
|
+
|
23
|
+
def _get_pvalidator_swept_center_frequency(self) -> None:
|
24
|
+
def pvalidator(parameters: Parameters):
|
25
|
+
PValidators.swept_center_frequency(parameters,
|
26
|
+
self.get_spec(SpecNames.API_RETUNING_LATENCY))
|
27
|
+
return pvalidator
|
28
|
+
|
29
|
+
|
30
|
+
def _get_capture_template_fixed_center_frequency(self) -> CaptureTemplate:
|
31
|
+
#
|
32
|
+
# Create the base template
|
33
|
+
#
|
34
|
+
capture_template = get_base_capture_template( CaptureModes.FIXED_CENTER_FREQUENCY )
|
35
|
+
capture_template.add_ptemplate( get_base_ptemplate(PNames.BANDWIDTH) )
|
36
|
+
capture_template.add_ptemplate( get_base_ptemplate(PNames.IF_GAIN) )
|
37
|
+
capture_template.add_ptemplate( get_base_ptemplate(PNames.RF_GAIN) )
|
38
|
+
|
39
|
+
#
|
40
|
+
# Update the defaults
|
41
|
+
#
|
42
|
+
capture_template.set_defaults(
|
43
|
+
(PNames.BATCH_SIZE, 3.0),
|
44
|
+
(PNames.CENTER_FREQUENCY, 95800000),
|
45
|
+
(PNames.SAMPLE_RATE, 600000),
|
46
|
+
(PNames.BANDWIDTH, 600000),
|
47
|
+
(PNames.WINDOW_HOP, 512),
|
48
|
+
(PNames.WINDOW_SIZE, 1024),
|
49
|
+
(PNames.WINDOW_TYPE, "blackman"),
|
50
|
+
(PNames.RF_GAIN, -30),
|
51
|
+
(PNames.IF_GAIN, -30)
|
52
|
+
)
|
53
|
+
|
54
|
+
#
|
55
|
+
# Adding pconstraints
|
56
|
+
#
|
57
|
+
capture_template.add_pconstraint(
|
58
|
+
PNames.CENTER_FREQUENCY,
|
59
|
+
[
|
60
|
+
Bound(
|
61
|
+
lower_bound=self.get_spec(SpecNames.FREQUENCY_LOWER_BOUND),
|
62
|
+
upper_bound=self.get_spec(SpecNames.FREQUENCY_UPPER_BOUND)
|
63
|
+
)
|
64
|
+
]
|
65
|
+
)
|
66
|
+
capture_template.add_pconstraint(
|
67
|
+
PNames.SAMPLE_RATE,
|
68
|
+
[
|
69
|
+
Bound(
|
70
|
+
lower_bound=self.get_spec(SpecNames.SAMPLE_RATE_LOWER_BOUND),
|
71
|
+
upper_bound=self.get_spec(SpecNames.SAMPLE_RATE_UPPER_BOUND)
|
72
|
+
)
|
73
|
+
]
|
74
|
+
)
|
75
|
+
capture_template.add_pconstraint(
|
76
|
+
PNames.BANDWIDTH,
|
77
|
+
[
|
78
|
+
OneOf(
|
79
|
+
self.get_spec( SpecNames.BANDWIDTH_OPTIONS )
|
80
|
+
)
|
81
|
+
]
|
82
|
+
)
|
83
|
+
capture_template.add_pconstraint(
|
84
|
+
PNames.IF_GAIN,
|
85
|
+
[
|
86
|
+
Bound(
|
87
|
+
upper_bound=self.get_spec(SpecNames.IF_GAIN_UPPER_BOUND)
|
88
|
+
)
|
89
|
+
]
|
90
|
+
)
|
91
|
+
capture_template.add_pconstraint(
|
92
|
+
PNames.RF_GAIN,
|
93
|
+
[
|
94
|
+
Bound(
|
95
|
+
upper_bound=self.get_spec(SpecNames.RF_GAIN_UPPER_BOUND)
|
96
|
+
)
|
97
|
+
]
|
98
|
+
)
|
99
|
+
return capture_template
|
100
|
+
|
101
|
+
|
102
|
+
def _get_capture_template_swept_center_frequency(self) -> CaptureTemplate:
|
103
|
+
#
|
104
|
+
# Create the base template
|
105
|
+
#
|
106
|
+
capture_template = get_base_capture_template( CaptureModes.SWEPT_CENTER_FREQUENCY )
|
107
|
+
capture_template.add_ptemplate( get_base_ptemplate(PNames.BANDWIDTH) )
|
108
|
+
capture_template.add_ptemplate( get_base_ptemplate(PNames.IF_GAIN) )
|
109
|
+
capture_template.add_ptemplate( get_base_ptemplate(PNames.RF_GAIN) )
|
110
|
+
|
111
|
+
|
112
|
+
#
|
113
|
+
# Update the defaults
|
114
|
+
#
|
115
|
+
capture_template.set_defaults(
|
116
|
+
(PNames.BATCH_SIZE, 4.0),
|
117
|
+
(PNames.MIN_FREQUENCY, 95000000),
|
118
|
+
(PNames.MAX_FREQUENCY, 100000000),
|
119
|
+
(PNames.SAMPLES_PER_STEP, 80000),
|
120
|
+
(PNames.FREQUENCY_STEP, 1536000),
|
121
|
+
(PNames.SAMPLE_RATE, 1536000),
|
122
|
+
(PNames.BANDWIDTH, 1536000),
|
123
|
+
(PNames.WINDOW_HOP, 512),
|
124
|
+
(PNames.WINDOW_SIZE, 1024),
|
125
|
+
(PNames.WINDOW_TYPE, "blackman"),
|
126
|
+
(PNames.RF_GAIN, -30),
|
127
|
+
(PNames.IF_GAIN, -30)
|
128
|
+
)
|
129
|
+
|
130
|
+
|
131
|
+
#
|
132
|
+
# Adding pconstraints
|
133
|
+
#
|
134
|
+
capture_template.add_pconstraint(
|
135
|
+
PNames.MIN_FREQUENCY,
|
136
|
+
[
|
137
|
+
Bound(
|
138
|
+
lower_bound=self.get_spec(SpecNames.FREQUENCY_LOWER_BOUND),
|
139
|
+
upper_bound=self.get_spec(SpecNames.FREQUENCY_UPPER_BOUND)
|
140
|
+
)
|
141
|
+
]
|
142
|
+
)
|
143
|
+
capture_template.add_pconstraint(
|
144
|
+
PNames.MAX_FREQUENCY,
|
145
|
+
[
|
146
|
+
Bound(
|
147
|
+
lower_bound=self.get_spec(SpecNames.FREQUENCY_LOWER_BOUND),
|
148
|
+
upper_bound=self.get_spec(SpecNames.FREQUENCY_UPPER_BOUND)
|
149
|
+
)
|
150
|
+
]
|
151
|
+
)
|
152
|
+
capture_template.add_pconstraint(
|
153
|
+
PNames.SAMPLE_RATE,
|
154
|
+
[
|
155
|
+
Bound(
|
156
|
+
lower_bound=self.get_spec(SpecNames.SAMPLE_RATE_LOWER_BOUND),
|
157
|
+
upper_bound=self.get_spec(SpecNames.SAMPLE_RATE_UPPER_BOUND)
|
158
|
+
)
|
159
|
+
]
|
160
|
+
)
|
161
|
+
capture_template.add_pconstraint(
|
162
|
+
PNames.BANDWIDTH,
|
163
|
+
[
|
164
|
+
OneOf(
|
165
|
+
self.get_spec( SpecNames.BANDWIDTH_OPTIONS )
|
166
|
+
)
|
167
|
+
]
|
168
|
+
)
|
169
|
+
capture_template.add_pconstraint(
|
170
|
+
PNames.IF_GAIN,
|
171
|
+
[
|
172
|
+
Bound(
|
173
|
+
upper_bound=self.get_spec(SpecNames.IF_GAIN_UPPER_BOUND)
|
174
|
+
)
|
175
|
+
]
|
176
|
+
)
|
177
|
+
capture_template.add_pconstraint(
|
178
|
+
PNames.RF_GAIN,
|
179
|
+
[
|
180
|
+
Bound(
|
181
|
+
upper_bound=self.get_spec(SpecNames.RF_GAIN_UPPER_BOUND)
|
182
|
+
)
|
183
|
+
]
|
184
|
+
)
|
185
|
+
return capture_template
|
@@ -123,7 +123,7 @@ class _Receiver(BaseReceiver):
|
|
123
123
|
PNames.WINDOW_HOP,
|
124
124
|
PNames.WINDOW_SIZE,
|
125
125
|
PNames.EVENT_HANDLER_KEY,
|
126
|
-
PNames.
|
126
|
+
PNames.BATCH_KEY,
|
127
127
|
PNames.WATCH_EXTENSION,
|
128
128
|
PNames.MIN_SAMPLES_PER_STEP,
|
129
129
|
PNames.MAX_SAMPLES_PER_STEP,
|
@@ -152,7 +152,7 @@ class _Receiver(BaseReceiver):
|
|
152
152
|
(PNames.WINDOW_SIZE, 512),
|
153
153
|
(PNames.WINDOW_TYPE, "boxcar"),
|
154
154
|
(PNames.EVENT_HANDLER_KEY, CaptureModes.SWEPT_CENTER_FREQUENCY),
|
155
|
-
(PNames.
|
155
|
+
(PNames.BATCH_KEY, CaptureModes.SWEPT_CENTER_FREQUENCY),
|
156
156
|
(PNames.WATCH_EXTENSION, "bin")
|
157
157
|
)
|
158
158
|
|
@@ -166,7 +166,7 @@ class _Receiver(BaseReceiver):
|
|
166
166
|
PNames.FREQUENCY_RESOLUTION,
|
167
167
|
PNames.WINDOW_TYPE,
|
168
168
|
PNames.EVENT_HANDLER_KEY,
|
169
|
-
PNames.
|
169
|
+
PNames.BATCH_KEY,
|
170
170
|
PNames.WATCH_EXTENSION
|
171
171
|
)
|
172
172
|
|
@@ -12,12 +12,6 @@ from spectre_core.exceptions import ModeNotFoundError
|
|
12
12
|
from ._spectrogram import Spectrogram
|
13
13
|
from ._array_operations import is_close
|
14
14
|
|
15
|
-
__all__ = [
|
16
|
-
"get_analytical_spectrogram",
|
17
|
-
"validate_analytically",
|
18
|
-
"TestResults"
|
19
|
-
]
|
20
|
-
|
21
15
|
@dataclass
|
22
16
|
class TestResults:
|
23
17
|
# Whether the times array matches analytically
|