spectre-core 0.0.8__py3-none-any.whl → 0.0.10__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/__init__.py +0 -3
- spectre_core/_file_io/__init__.py +15 -0
- spectre_core/_file_io/file_handlers.py +128 -0
- spectre_core/capture_configs/__init__.py +29 -0
- spectre_core/capture_configs/_capture_config.py +85 -0
- spectre_core/capture_configs/_capture_templates.py +222 -0
- spectre_core/capture_configs/_parameters.py +110 -0
- spectre_core/capture_configs/_pconstraints.py +82 -0
- spectre_core/capture_configs/_ptemplates.py +450 -0
- spectre_core/capture_configs/_pvalidators.py +173 -0
- spectre_core/chunks/__init__.py +17 -201
- spectre_core/chunks/{base.py → _base.py} +15 -60
- spectre_core/chunks/_chunks.py +200 -0
- spectre_core/chunks/{factory.py → _factory.py} +6 -7
- spectre_core/chunks/library/{callisto/chunk.py → _callisto.py} +4 -7
- spectre_core/chunks/library/{fixed/chunk.py → _fixed_center_frequency.py} +7 -64
- spectre_core/chunks/library/_swept_center_frequency.py +103 -0
- spectre_core/config/__init__.py +20 -0
- spectre_core/config/_paths.py +77 -0
- spectre_core/config/_time_formats.py +15 -0
- spectre_core/exceptions.py +4 -5
- spectre_core/logging/__init__.py +11 -0
- spectre_core/logging/_configure.py +35 -0
- spectre_core/logging/_decorators.py +19 -0
- spectre_core/{logging.py → logging/_log_handlers.py} +13 -58
- spectre_core/plotting/__init__.py +7 -1
- spectre_core/plotting/{base.py → _base.py} +40 -20
- spectre_core/plotting/_format.py +18 -0
- spectre_core/plotting/{panel_stack.py → _panel_stack.py} +50 -48
- spectre_core/plotting/_panels.py +234 -0
- spectre_core/post_processing/__init__.py +14 -0
- spectre_core/post_processing/_base.py +119 -0
- spectre_core/post_processing/_factory.py +23 -0
- spectre_core/post_processing/_post_processor.py +40 -0
- spectre_core/post_processing/library/_fixed_center_frequency.py +115 -0
- spectre_core/post_processing/library/_swept_center_frequency.py +382 -0
- spectre_core/receivers/__init__.py +12 -2
- spectre_core/receivers/_base.py +352 -0
- spectre_core/receivers/{factory.py → _factory.py} +2 -2
- spectre_core/receivers/_spec_names.py +20 -0
- spectre_core/receivers/gr/__init__.py +3 -0
- spectre_core/receivers/gr/_base.py +33 -0
- spectre_core/receivers/gr/_rsp1a.py +158 -0
- spectre_core/receivers/gr/_test.py +123 -0
- spectre_core/receivers/library/_rsp1a.py +61 -0
- spectre_core/receivers/library/_test.py +221 -0
- spectre_core/spectrograms/__init__.py +18 -0
- spectre_core/spectrograms/{analytical.py → _analytical.py} +29 -27
- spectre_core/spectrograms/{array_operations.py → _array_operations.py} +47 -1
- spectre_core/spectrograms/{spectrogram.py → _spectrogram.py} +62 -35
- spectre_core/spectrograms/{transform.py → _transform.py} +76 -89
- spectre_core/{receivers/library → wgetting}/__init__.py +4 -2
- spectre_core/wgetting/_callisto.py +155 -0
- {spectre_core-0.0.8.dist-info → spectre_core-0.0.10.dist-info}/METADATA +1 -1
- spectre_core-0.0.10.dist-info/RECORD +63 -0
- spectre_core/cfg.py +0 -116
- spectre_core/chunks/library/__init__.py +0 -8
- spectre_core/chunks/library/sweep/__init__.py +0 -0
- spectre_core/chunks/library/sweep/chunk.py +0 -400
- spectre_core/dynamic_imports.py +0 -22
- spectre_core/file_handlers/base.py +0 -68
- spectre_core/file_handlers/configs.py +0 -271
- spectre_core/file_handlers/json.py +0 -40
- spectre_core/file_handlers/text.py +0 -21
- spectre_core/plotting/factory.py +0 -26
- spectre_core/plotting/format.py +0 -19
- spectre_core/plotting/library/__init__.py +0 -7
- spectre_core/plotting/library/frequency_cuts/panel.py +0 -74
- spectre_core/plotting/library/integral_over_frequency/panel.py +0 -34
- spectre_core/plotting/library/spectrogram/panel.py +0 -92
- spectre_core/plotting/library/time_cuts/panel.py +0 -77
- spectre_core/plotting/panel_register.py +0 -13
- spectre_core/receivers/base.py +0 -415
- spectre_core/receivers/library/rsp1a/__init__.py +0 -0
- spectre_core/receivers/library/rsp1a/gr/__init__.py +0 -0
- spectre_core/receivers/library/rsp1a/gr/fixed.py +0 -104
- spectre_core/receivers/library/rsp1a/gr/sweep.py +0 -129
- spectre_core/receivers/library/rsp1a/receiver.py +0 -68
- spectre_core/receivers/library/rspduo/__init__.py +0 -0
- spectre_core/receivers/library/rspduo/gr/__init__.py +0 -0
- spectre_core/receivers/library/rspduo/gr/tuner_1_fixed.py +0 -114
- spectre_core/receivers/library/rspduo/gr/tuner_1_sweep.py +0 -131
- spectre_core/receivers/library/rspduo/gr/tuner_2_fixed.py +0 -120
- spectre_core/receivers/library/rspduo/gr/tuner_2_sweep.py +0 -119
- spectre_core/receivers/library/rspduo/receiver.py +0 -97
- spectre_core/receivers/library/test/__init__.py +0 -0
- spectre_core/receivers/library/test/gr/__init__.py +0 -0
- spectre_core/receivers/library/test/gr/cosine_signal_1.py +0 -83
- spectre_core/receivers/library/test/gr/tagged_staircase.py +0 -93
- spectre_core/receivers/library/test/receiver.py +0 -178
- spectre_core/receivers/validators.py +0 -193
- spectre_core/watchdog/__init__.py +0 -6
- spectre_core/watchdog/base.py +0 -105
- spectre_core/watchdog/factory.py +0 -22
- spectre_core/watchdog/library/__init__.py +0 -10
- spectre_core/watchdog/library/fixed/__init__.py +0 -0
- spectre_core/watchdog/library/fixed/event_handler.py +0 -41
- spectre_core/watchdog/library/sweep/event_handler.py +0 -55
- spectre_core/watchdog/post_processor.py +0 -50
- spectre_core/web_fetch/callisto.py +0 -101
- spectre_core-0.0.8.dist-info/RECORD +0 -74
- /spectre_core/chunks/{chunk_register.py → _register.py} +0 -0
- /spectre_core/{watchdog/event_handler_register.py → post_processing/_register.py} +0 -0
- /spectre_core/receivers/{receiver_register.py → _register.py} +0 -0
- /spectre_core/{chunks/library/callisto/__init__.py → receivers/gr/_rspduo.py} +0 -0
- /spectre_core/{chunks/library/fixed/__init__.py → receivers/library/_rspduo.py} +0 -0
- {spectre_core-0.0.8.dist-info → spectre_core-0.0.10.dist-info}/LICENSE +0 -0
- {spectre_core-0.0.8.dist-info → spectre_core-0.0.10.dist-info}/WHEEL +0 -0
- {spectre_core-0.0.8.dist-info → spectre_core-0.0.10.dist-info}/top_level.txt +0 -0
@@ -1,129 +0,0 @@
|
|
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: Not titled yet
|
9
|
-
# GNU Radio version: 3.10.1.1
|
10
|
-
|
11
|
-
import sys
|
12
|
-
import signal
|
13
|
-
from argparse import ArgumentParser
|
14
|
-
from typing import Any
|
15
|
-
|
16
|
-
from gnuradio import gr
|
17
|
-
from gnuradio.filter import firdes
|
18
|
-
from gnuradio.fft import window
|
19
|
-
from gnuradio.eng_arg import eng_float, intx
|
20
|
-
from gnuradio import eng_notation
|
21
|
-
from gnuradio import sdrplay3
|
22
|
-
from gnuradio import spectre
|
23
|
-
|
24
|
-
from spectre_core.cfg import CHUNKS_DIR_PATH
|
25
|
-
from spectre_core.file_handlers.configs import CaptureConfig
|
26
|
-
|
27
|
-
|
28
|
-
class sweep(gr.top_block):
|
29
|
-
def __init__(self,
|
30
|
-
capture_config: CaptureConfig):
|
31
|
-
gr.top_block.__init__(self, "sweep", catch_exceptions=True)
|
32
|
-
|
33
|
-
##################################################
|
34
|
-
# Unpack capture config
|
35
|
-
##################################################
|
36
|
-
samp_rate = capture_config['samp_rate']
|
37
|
-
bandwidth = capture_config['bandwidth']
|
38
|
-
min_freq = capture_config['min_freq']
|
39
|
-
max_freq = capture_config['max_freq']
|
40
|
-
freq_step = capture_config['freq_step']
|
41
|
-
samples_per_step = capture_config['samples_per_step']
|
42
|
-
IF_gain = capture_config['IF_gain']
|
43
|
-
RF_gain = capture_config['RF_gain']
|
44
|
-
chunk_size = capture_config['chunk_size']
|
45
|
-
start_freq = min_freq + samp_rate/2
|
46
|
-
tag = capture_config['tag']
|
47
|
-
|
48
|
-
##################################################
|
49
|
-
# Blocks
|
50
|
-
##################################################
|
51
|
-
self.spectre_sweep_driver_0 = spectre.sweep_driver(min_freq,
|
52
|
-
max_freq,
|
53
|
-
freq_step,
|
54
|
-
samp_rate,
|
55
|
-
samples_per_step,
|
56
|
-
'freq')
|
57
|
-
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(CHUNKS_DIR_PATH,
|
58
|
-
tag,
|
59
|
-
chunk_size,
|
60
|
-
samp_rate,
|
61
|
-
True,
|
62
|
-
'freq',
|
63
|
-
start_freq)
|
64
|
-
self.sdrplay3_rsp1a_0 = sdrplay3.rsp1a(
|
65
|
-
'',
|
66
|
-
stream_args=sdrplay3.stream_args(
|
67
|
-
output_type='fc32',
|
68
|
-
channels_size=1
|
69
|
-
),
|
70
|
-
)
|
71
|
-
self.sdrplay3_rsp1a_0.set_sample_rate(samp_rate, True)
|
72
|
-
self.sdrplay3_rsp1a_0.set_center_freq(start_freq, True)
|
73
|
-
self.sdrplay3_rsp1a_0.set_bandwidth(bandwidth)
|
74
|
-
self.sdrplay3_rsp1a_0.set_gain_mode(False)
|
75
|
-
self.sdrplay3_rsp1a_0.set_gain(IF_gain, 'IF', True)
|
76
|
-
self.sdrplay3_rsp1a_0.set_gain(RF_gain, 'RF', True)
|
77
|
-
self.sdrplay3_rsp1a_0.set_freq_corr(0)
|
78
|
-
self.sdrplay3_rsp1a_0.set_dc_offset_mode(False)
|
79
|
-
self.sdrplay3_rsp1a_0.set_iq_balance_mode(False)
|
80
|
-
self.sdrplay3_rsp1a_0.set_agc_setpoint(-30)
|
81
|
-
self.sdrplay3_rsp1a_0.set_rf_notch_filter(False)
|
82
|
-
self.sdrplay3_rsp1a_0.set_dab_notch_filter(False)
|
83
|
-
self.sdrplay3_rsp1a_0.set_biasT(False)
|
84
|
-
self.sdrplay3_rsp1a_0.set_stream_tags(True)
|
85
|
-
self.sdrplay3_rsp1a_0.set_debug_mode(False)
|
86
|
-
self.sdrplay3_rsp1a_0.set_sample_sequence_gaps_check(False)
|
87
|
-
self.sdrplay3_rsp1a_0.set_show_gain_changes(False)
|
88
|
-
|
89
|
-
|
90
|
-
##################################################
|
91
|
-
# Connections
|
92
|
-
##################################################
|
93
|
-
self.msg_connect((self.spectre_sweep_driver_0, 'freq'), (self.sdrplay3_rsp1a_0, 'freq'))
|
94
|
-
self.connect((self.sdrplay3_rsp1a_0, 0), (self.spectre_batched_file_sink_0, 0))
|
95
|
-
self.connect((self.sdrplay3_rsp1a_0, 0), (self.spectre_sweep_driver_0, 0))
|
96
|
-
|
97
|
-
|
98
|
-
def get_samp_rate(self):
|
99
|
-
return self.samp_rate
|
100
|
-
|
101
|
-
def set_samp_rate(self, samp_rate):
|
102
|
-
self.samp_rate = samp_rate
|
103
|
-
self.sdrplay3_rsp1a_0.set_sample_rate(self.samp_rate, True)
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
def main(capture_config: CaptureConfig,
|
109
|
-
top_block_cls=sweep,
|
110
|
-
options=None):
|
111
|
-
|
112
|
-
tb = top_block_cls(capture_config)
|
113
|
-
|
114
|
-
def sig_handler(sig=None, frame=None):
|
115
|
-
tb.stop()
|
116
|
-
tb.wait()
|
117
|
-
|
118
|
-
sys.exit(0)
|
119
|
-
|
120
|
-
signal.signal(signal.SIGINT, sig_handler)
|
121
|
-
signal.signal(signal.SIGTERM, sig_handler)
|
122
|
-
|
123
|
-
tb.start(512)
|
124
|
-
|
125
|
-
tb.wait()
|
126
|
-
|
127
|
-
|
128
|
-
if __name__ == '__main__':
|
129
|
-
main()
|
@@ -1,68 +0,0 @@
|
|
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 spectre_core.receivers.base import SDRPlayReceiver
|
6
|
-
from spectre_core.receivers.receiver_register import register_receiver
|
7
|
-
from spectre_core.receivers.library.rsp1a.gr import fixed, sweep
|
8
|
-
from spectre_core.file_handlers.configs import CaptureConfig
|
9
|
-
|
10
|
-
@register_receiver("rsp1a")
|
11
|
-
class Receiver(SDRPlayReceiver):
|
12
|
-
def __init__(self, *args, **kwargs):
|
13
|
-
super().__init__(*args, **kwargs)
|
14
|
-
|
15
|
-
|
16
|
-
def _set_capture_methods(self) -> None:
|
17
|
-
self._capture_methods = {
|
18
|
-
"fixed": self.__fixed,
|
19
|
-
"sweep": self.__sweep
|
20
|
-
}
|
21
|
-
return
|
22
|
-
|
23
|
-
|
24
|
-
def _set_validators(self) -> None:
|
25
|
-
self._validators = {
|
26
|
-
"fixed": self.__fixed_validator,
|
27
|
-
"sweep": self.__sweep_validator
|
28
|
-
}
|
29
|
-
return
|
30
|
-
|
31
|
-
|
32
|
-
def _set_type_templates(self) -> None:
|
33
|
-
self._type_templates = {
|
34
|
-
"fixed": self._get_default_type_template("fixed"),
|
35
|
-
"sweep": self._get_default_type_template("sweep")
|
36
|
-
}
|
37
|
-
|
38
|
-
|
39
|
-
def _set_specifications(self) -> None:
|
40
|
-
self._specifications = {
|
41
|
-
"center_freq_lower_bound": 1e3, # [Hz]
|
42
|
-
"center_freq_upper_bound": 2e9, # [Hz]
|
43
|
-
"samp_rate_lower_bound": 200e3, # [Hz]
|
44
|
-
"samp_rate_upper_bound": 10e6, # [Hz]
|
45
|
-
"bandwidth_lower_bound": 200e3, # [Hz]
|
46
|
-
"bandwidth_upper_bound": 8e6, # [Hz]
|
47
|
-
"IF_gain_upper_bound": -20, # [dB]
|
48
|
-
"RF_gain_upper_bound": 0, # [dB]
|
49
|
-
"api_latency": 50 * 1e-3 # [s]
|
50
|
-
}
|
51
|
-
|
52
|
-
|
53
|
-
def __fixed(self, capture_config: CaptureConfig) -> None:
|
54
|
-
fixed.main(capture_config)
|
55
|
-
|
56
|
-
|
57
|
-
def __sweep(self, capture_config: CaptureConfig) -> None:
|
58
|
-
sweep.main(capture_config)
|
59
|
-
|
60
|
-
|
61
|
-
def __fixed_validator(self, capture_config: CaptureConfig) -> None:
|
62
|
-
self._default_fixed_validator(capture_config)
|
63
|
-
self._sdrplay_validator(capture_config)
|
64
|
-
|
65
|
-
|
66
|
-
def __sweep_validator(self, capture_config: CaptureConfig) -> None:
|
67
|
-
self._default_sweep_validator(capture_config)
|
68
|
-
self._sdrplay_validator(capture_config)
|
File without changes
|
File without changes
|
@@ -1,114 +0,0 @@
|
|
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: tuner_1_fixed
|
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
|
-
import sys
|
16
|
-
import signal
|
17
|
-
from argparse import ArgumentParser
|
18
|
-
from typing import Any
|
19
|
-
|
20
|
-
from gnuradio import gr
|
21
|
-
from gnuradio.filter import firdes
|
22
|
-
from gnuradio.fft import window
|
23
|
-
from gnuradio.eng_arg import eng_float, intx
|
24
|
-
from gnuradio import eng_notation
|
25
|
-
from gnuradio import sdrplay3
|
26
|
-
from gnuradio import spectre
|
27
|
-
|
28
|
-
from spectre_core.cfg import CHUNKS_DIR_PATH
|
29
|
-
from spectre_core.file_handlers.configs import CaptureConfig
|
30
|
-
|
31
|
-
|
32
|
-
class tuner_1_fixed(gr.top_block):
|
33
|
-
|
34
|
-
def __init__(self,
|
35
|
-
capture_config: CaptureConfig):
|
36
|
-
gr.top_block.__init__(self, "tuner_1_fixed", catch_exceptions=True)
|
37
|
-
|
38
|
-
##################################################
|
39
|
-
# Unpack capture config
|
40
|
-
##################################################
|
41
|
-
samp_rate = capture_config['samp_rate']
|
42
|
-
tag = capture_config['tag']
|
43
|
-
chunk_size = capture_config['chunk_size']
|
44
|
-
center_freq = capture_config['center_freq']
|
45
|
-
bandwidth = capture_config['bandwidth']
|
46
|
-
IF_gain = capture_config['IF_gain']
|
47
|
-
RF_gain = capture_config['RF_gain']
|
48
|
-
is_sweeping = False
|
49
|
-
|
50
|
-
##################################################
|
51
|
-
# Blocks
|
52
|
-
##################################################
|
53
|
-
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(CHUNKS_DIR_PATH,
|
54
|
-
tag,
|
55
|
-
chunk_size,
|
56
|
-
samp_rate,
|
57
|
-
is_sweeping)
|
58
|
-
self.sdrplay3_rspduo_0 = sdrplay3.rspduo(
|
59
|
-
'',
|
60
|
-
rspduo_mode="Single Tuner",
|
61
|
-
antenna="Tuner 1 50 ohm",
|
62
|
-
stream_args=sdrplay3.stream_args(
|
63
|
-
output_type='fc32',
|
64
|
-
channels_size=1
|
65
|
-
),
|
66
|
-
)
|
67
|
-
self.sdrplay3_rspduo_0.set_sample_rate(samp_rate)
|
68
|
-
self.sdrplay3_rspduo_0.set_center_freq(center_freq)
|
69
|
-
self.sdrplay3_rspduo_0.set_bandwidth(bandwidth)
|
70
|
-
self.sdrplay3_rspduo_0.set_antenna("Tuner 1 50 ohm")
|
71
|
-
self.sdrplay3_rspduo_0.set_gain_mode(False)
|
72
|
-
self.sdrplay3_rspduo_0.set_gain(IF_gain, 'IF')
|
73
|
-
self.sdrplay3_rspduo_0.set_gain(RF_gain, 'RF')
|
74
|
-
self.sdrplay3_rspduo_0.set_freq_corr(0)
|
75
|
-
self.sdrplay3_rspduo_0.set_dc_offset_mode(False)
|
76
|
-
self.sdrplay3_rspduo_0.set_iq_balance_mode(False)
|
77
|
-
self.sdrplay3_rspduo_0.set_agc_setpoint(-30)
|
78
|
-
self.sdrplay3_rspduo_0.set_rf_notch_filter(False)
|
79
|
-
self.sdrplay3_rspduo_0.set_dab_notch_filter(False)
|
80
|
-
self.sdrplay3_rspduo_0.set_am_notch_filter(False)
|
81
|
-
self.sdrplay3_rspduo_0.set_biasT(False)
|
82
|
-
self.sdrplay3_rspduo_0.set_debug_mode(False)
|
83
|
-
self.sdrplay3_rspduo_0.set_sample_sequence_gaps_check(False)
|
84
|
-
self.sdrplay3_rspduo_0.set_show_gain_changes(False)
|
85
|
-
|
86
|
-
|
87
|
-
##################################################
|
88
|
-
# Connections
|
89
|
-
##################################################
|
90
|
-
self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_batched_file_sink_0, 0))
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
def main(capture_config: CaptureConfig,
|
97
|
-
top_block_cls=tuner_1_fixed,
|
98
|
-
options=None):
|
99
|
-
|
100
|
-
tb = top_block_cls(capture_config)
|
101
|
-
|
102
|
-
def sig_handler(sig=None, frame=None):
|
103
|
-
tb.stop()
|
104
|
-
tb.wait()
|
105
|
-
|
106
|
-
sys.exit(0)
|
107
|
-
|
108
|
-
signal.signal(signal.SIGINT, sig_handler)
|
109
|
-
signal.signal(signal.SIGTERM, sig_handler)
|
110
|
-
|
111
|
-
tb.start()
|
112
|
-
|
113
|
-
tb.wait()
|
114
|
-
|
@@ -1,131 +0,0 @@
|
|
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: tuner_1_sweep
|
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
|
-
import sys
|
16
|
-
import signal
|
17
|
-
from argparse import ArgumentParser
|
18
|
-
from typing import Any
|
19
|
-
|
20
|
-
from gnuradio import blocks
|
21
|
-
from gnuradio import gr
|
22
|
-
from gnuradio.filter import firdes
|
23
|
-
from gnuradio.fft import window
|
24
|
-
from gnuradio.eng_arg import eng_float, intx
|
25
|
-
from gnuradio import eng_notation
|
26
|
-
from gnuradio import sdrplay3
|
27
|
-
from gnuradio import spectre
|
28
|
-
|
29
|
-
from spectre_core.cfg import CHUNKS_DIR_PATH
|
30
|
-
from spectre_core.file_handlers.configs import CaptureConfig
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
class tuner_1_sweep(gr.top_block):
|
36
|
-
def __init__(self,
|
37
|
-
capture_config: CaptureConfig):
|
38
|
-
gr.top_block.__init__(self, "tuner_1_sweep", catch_exceptions=True)
|
39
|
-
|
40
|
-
##################################################
|
41
|
-
# Unpack capture config
|
42
|
-
##################################################
|
43
|
-
samp_rate = capture_config['samp_rate']
|
44
|
-
bandwidth = capture_config['bandwidth']
|
45
|
-
min_freq = capture_config['min_freq']
|
46
|
-
max_freq = capture_config['max_freq']
|
47
|
-
freq_step = capture_config['freq_step']
|
48
|
-
samples_per_step = capture_config['samples_per_step']
|
49
|
-
IF_gain = capture_config['IF_gain']
|
50
|
-
RF_gain = capture_config['RF_gain']
|
51
|
-
chunk_size = capture_config['chunk_size']
|
52
|
-
start_freq = min_freq + samp_rate/2
|
53
|
-
tag = capture_config['tag']
|
54
|
-
|
55
|
-
|
56
|
-
##################################################
|
57
|
-
# Blocks
|
58
|
-
##################################################
|
59
|
-
self.spectre_sweep_driver_0 = spectre.sweep_driver(min_freq,
|
60
|
-
max_freq,
|
61
|
-
freq_step,
|
62
|
-
samp_rate,
|
63
|
-
samples_per_step,
|
64
|
-
'freq')
|
65
|
-
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(CHUNKS_DIR_PATH,
|
66
|
-
tag,
|
67
|
-
chunk_size,
|
68
|
-
samp_rate,
|
69
|
-
True,
|
70
|
-
'freq',
|
71
|
-
start_freq)
|
72
|
-
self.sdrplay3_rspduo_0 = sdrplay3.rspduo(
|
73
|
-
'',
|
74
|
-
rspduo_mode="Single Tuner",
|
75
|
-
antenna="Tuner 1 50 ohm",
|
76
|
-
stream_args=sdrplay3.stream_args(
|
77
|
-
output_type='fc32',
|
78
|
-
channels_size=1
|
79
|
-
),
|
80
|
-
)
|
81
|
-
self.sdrplay3_rspduo_0.set_sample_rate(samp_rate, True)
|
82
|
-
self.sdrplay3_rspduo_0.set_center_freq(start_freq, True)
|
83
|
-
self.sdrplay3_rspduo_0.set_bandwidth(bandwidth)
|
84
|
-
self.sdrplay3_rspduo_0.set_antenna("Tuner 1 50 ohm")
|
85
|
-
self.sdrplay3_rspduo_0.set_gain_mode(False)
|
86
|
-
self.sdrplay3_rspduo_0.set_gain(IF_gain, 'IF', True)
|
87
|
-
self.sdrplay3_rspduo_0.set_gain(RF_gain, 'RF', True)
|
88
|
-
self.sdrplay3_rspduo_0.set_freq_corr(0)
|
89
|
-
self.sdrplay3_rspduo_0.set_dc_offset_mode(False)
|
90
|
-
self.sdrplay3_rspduo_0.set_iq_balance_mode(False)
|
91
|
-
self.sdrplay3_rspduo_0.set_agc_setpoint(-30)
|
92
|
-
self.sdrplay3_rspduo_0.set_rf_notch_filter(False)
|
93
|
-
self.sdrplay3_rspduo_0.set_dab_notch_filter(True)
|
94
|
-
self.sdrplay3_rspduo_0.set_am_notch_filter(False)
|
95
|
-
self.sdrplay3_rspduo_0.set_biasT(False)
|
96
|
-
self.sdrplay3_rspduo_0.set_stream_tags(True)
|
97
|
-
self.sdrplay3_rspduo_0.set_debug_mode(False)
|
98
|
-
self.sdrplay3_rspduo_0.set_sample_sequence_gaps_check(False)
|
99
|
-
self.sdrplay3_rspduo_0.set_show_gain_changes(False)
|
100
|
-
# self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_gr_complex*1, 'freq', "freq")
|
101
|
-
# self.blocks_tag_debug_0.set_display(True)
|
102
|
-
|
103
|
-
|
104
|
-
##################################################
|
105
|
-
# Connections
|
106
|
-
##################################################
|
107
|
-
self.msg_connect((self.spectre_sweep_driver_0, 'freq'), (self.sdrplay3_rspduo_0, 'freq'))
|
108
|
-
self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_batched_file_sink_0, 0))
|
109
|
-
self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_sweep_driver_0, 0))
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
def main(capture_config: CaptureConfig,
|
115
|
-
top_block_cls=tuner_1_sweep,
|
116
|
-
options=None):
|
117
|
-
tb = top_block_cls(capture_config)
|
118
|
-
|
119
|
-
def sig_handler(sig=None, frame=None):
|
120
|
-
tb.stop()
|
121
|
-
tb.wait()
|
122
|
-
|
123
|
-
sys.exit(0)
|
124
|
-
|
125
|
-
signal.signal(signal.SIGINT, sig_handler)
|
126
|
-
signal.signal(signal.SIGTERM, sig_handler)
|
127
|
-
|
128
|
-
tb.start(1024)
|
129
|
-
|
130
|
-
tb.wait()
|
131
|
-
|
@@ -1,120 +0,0 @@
|
|
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: Not titled yet
|
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
|
-
from gnuradio import gr
|
16
|
-
from gnuradio.filter import firdes
|
17
|
-
from gnuradio.fft import window
|
18
|
-
import sys
|
19
|
-
import signal
|
20
|
-
from argparse import ArgumentParser
|
21
|
-
from gnuradio.eng_arg import eng_float, intx
|
22
|
-
from gnuradio import eng_notation
|
23
|
-
from gnuradio import sdrplay3
|
24
|
-
from gnuradio import spectre
|
25
|
-
|
26
|
-
from spectre_core.cfg import CHUNKS_DIR_PATH
|
27
|
-
from spectre_core.file_handlers.configs import CaptureConfig
|
28
|
-
|
29
|
-
|
30
|
-
class tuner_2_fixed(gr.top_block):
|
31
|
-
|
32
|
-
def __init__(self,
|
33
|
-
capture_config: CaptureConfig):
|
34
|
-
gr.top_block.__init__(self, "tuner_2_fixed", catch_exceptions=True)
|
35
|
-
|
36
|
-
##################################################
|
37
|
-
# Unpack capture config
|
38
|
-
##################################################
|
39
|
-
samp_rate = capture_config['samp_rate']
|
40
|
-
tag = capture_config['tag']
|
41
|
-
chunk_size = capture_config['chunk_size']
|
42
|
-
center_freq = capture_config['center_freq']
|
43
|
-
bandwidth = capture_config['bandwidth']
|
44
|
-
IF_gain = capture_config['IF_gain']
|
45
|
-
RF_gain = capture_config['RF_gain']
|
46
|
-
is_sweeping = False
|
47
|
-
|
48
|
-
##################################################
|
49
|
-
# Blocks
|
50
|
-
##################################################
|
51
|
-
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(CHUNKS_DIR_PATH,
|
52
|
-
tag,
|
53
|
-
chunk_size,
|
54
|
-
samp_rate,
|
55
|
-
is_sweeping)
|
56
|
-
self.sdrplay3_rspduo_0 = sdrplay3.rspduo(
|
57
|
-
'',
|
58
|
-
rspduo_mode="Single Tuner",
|
59
|
-
antenna="Tuner 2 50 ohm",
|
60
|
-
stream_args=sdrplay3.stream_args(
|
61
|
-
output_type='fc32',
|
62
|
-
channels_size=1
|
63
|
-
),
|
64
|
-
)
|
65
|
-
self.sdrplay3_rspduo_0.set_sample_rate(samp_rate)
|
66
|
-
self.sdrplay3_rspduo_0.set_center_freq(center_freq)
|
67
|
-
self.sdrplay3_rspduo_0.set_bandwidth(bandwidth)
|
68
|
-
self.sdrplay3_rspduo_0.set_antenna("Tuner 2 50 ohm")
|
69
|
-
self.sdrplay3_rspduo_0.set_gain_mode(False)
|
70
|
-
self.sdrplay3_rspduo_0.set_gain(IF_gain, 'IF')
|
71
|
-
self.sdrplay3_rspduo_0.set_gain(RF_gain, 'RF', False)
|
72
|
-
self.sdrplay3_rspduo_0.set_freq_corr(0)
|
73
|
-
self.sdrplay3_rspduo_0.set_dc_offset_mode(False)
|
74
|
-
self.sdrplay3_rspduo_0.set_iq_balance_mode(False)
|
75
|
-
self.sdrplay3_rspduo_0.set_agc_setpoint(-30)
|
76
|
-
self.sdrplay3_rspduo_0.set_rf_notch_filter(False)
|
77
|
-
self.sdrplay3_rspduo_0.set_dab_notch_filter(False)
|
78
|
-
self.sdrplay3_rspduo_0.set_am_notch_filter(False)
|
79
|
-
self.sdrplay3_rspduo_0.set_biasT(False)
|
80
|
-
self.sdrplay3_rspduo_0.set_stream_tags(False)
|
81
|
-
self.sdrplay3_rspduo_0.set_debug_mode(False)
|
82
|
-
self.sdrplay3_rspduo_0.set_sample_sequence_gaps_check(False)
|
83
|
-
self.sdrplay3_rspduo_0.set_show_gain_changes(False)
|
84
|
-
|
85
|
-
|
86
|
-
##################################################
|
87
|
-
# Connections
|
88
|
-
##################################################
|
89
|
-
self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_batched_file_sink_0, 0))
|
90
|
-
|
91
|
-
|
92
|
-
def get_samp_rate(self):
|
93
|
-
return self.samp_rate
|
94
|
-
|
95
|
-
def set_samp_rate(self, samp_rate):
|
96
|
-
self.samp_rate = samp_rate
|
97
|
-
self.sdrplay3_rspduo_0.set_sample_rate(self.samp_rate, False)
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
def main(capture_config: CaptureConfig,
|
103
|
-
top_block_cls=tuner_2_fixed,
|
104
|
-
options=None):
|
105
|
-
|
106
|
-
tb = top_block_cls(capture_config)
|
107
|
-
|
108
|
-
def sig_handler(sig=None, frame=None):
|
109
|
-
tb.stop()
|
110
|
-
tb.wait()
|
111
|
-
|
112
|
-
sys.exit(0)
|
113
|
-
|
114
|
-
signal.signal(signal.SIGINT, sig_handler)
|
115
|
-
signal.signal(signal.SIGTERM, sig_handler)
|
116
|
-
|
117
|
-
tb.start()
|
118
|
-
|
119
|
-
tb.wait()
|
120
|
-
|
@@ -1,119 +0,0 @@
|
|
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: Not titled yet
|
9
|
-
# GNU Radio version: 3.10.1.1
|
10
|
-
|
11
|
-
from gnuradio import gr
|
12
|
-
from gnuradio.filter import firdes
|
13
|
-
from gnuradio.fft import window
|
14
|
-
import sys
|
15
|
-
import signal
|
16
|
-
from argparse import ArgumentParser
|
17
|
-
from gnuradio.eng_arg import eng_float, intx
|
18
|
-
from gnuradio import eng_notation
|
19
|
-
from gnuradio import sdrplay3
|
20
|
-
from gnuradio import spectre
|
21
|
-
|
22
|
-
from spectre_core.cfg import CHUNKS_DIR_PATH
|
23
|
-
from spectre_core.file_handlers.configs import CaptureConfig
|
24
|
-
|
25
|
-
|
26
|
-
class tuner_2_sweep(gr.top_block):
|
27
|
-
def __init__(self,
|
28
|
-
capture_config: CaptureConfig):
|
29
|
-
gr.top_block.__init__(self, "tuner_2_sweep", catch_exceptions=True)
|
30
|
-
|
31
|
-
##################################################
|
32
|
-
# Unpack capture config
|
33
|
-
##################################################
|
34
|
-
samp_rate = capture_config['samp_rate']
|
35
|
-
bandwidth = capture_config['bandwidth']
|
36
|
-
min_freq = capture_config['min_freq']
|
37
|
-
max_freq = capture_config['max_freq']
|
38
|
-
freq_step = capture_config['freq_step']
|
39
|
-
samples_per_step = capture_config['samples_per_step']
|
40
|
-
IF_gain = capture_config['IF_gain']
|
41
|
-
RF_gain = capture_config['RF_gain']
|
42
|
-
chunk_size = capture_config['chunk_size']
|
43
|
-
start_freq = min_freq + samp_rate/2
|
44
|
-
tag = capture_config['tag']
|
45
|
-
|
46
|
-
##################################################
|
47
|
-
# Blocks
|
48
|
-
##################################################
|
49
|
-
self.spectre_sweep_driver_0 = spectre.sweep_driver(min_freq,
|
50
|
-
max_freq,
|
51
|
-
freq_step,
|
52
|
-
samp_rate,
|
53
|
-
samples_per_step,
|
54
|
-
'freq')
|
55
|
-
self.spectre_batched_file_sink_0 = spectre.batched_file_sink(CHUNKS_DIR_PATH,
|
56
|
-
tag,
|
57
|
-
chunk_size,
|
58
|
-
samp_rate,
|
59
|
-
True,
|
60
|
-
'freq',
|
61
|
-
start_freq)
|
62
|
-
self.sdrplay3_rspduo_0 = sdrplay3.rspduo(
|
63
|
-
'',
|
64
|
-
rspduo_mode="Single Tuner",
|
65
|
-
antenna="Tuner 2 50 ohm",
|
66
|
-
stream_args=sdrplay3.stream_args(
|
67
|
-
output_type='fc32',
|
68
|
-
channels_size=1
|
69
|
-
),
|
70
|
-
)
|
71
|
-
self.sdrplay3_rspduo_0.set_sample_rate(samp_rate, True)
|
72
|
-
self.sdrplay3_rspduo_0.set_center_freq(start_freq, True)
|
73
|
-
self.sdrplay3_rspduo_0.set_bandwidth(bandwidth)
|
74
|
-
self.sdrplay3_rspduo_0.set_antenna("Tuner 2 50 ohm")
|
75
|
-
self.sdrplay3_rspduo_0.set_gain_mode(False)
|
76
|
-
self.sdrplay3_rspduo_0.set_gain(IF_gain, 'IF', True)
|
77
|
-
self.sdrplay3_rspduo_0.set_gain(RF_gain, 'RF', True)
|
78
|
-
self.sdrplay3_rspduo_0.set_freq_corr(0)
|
79
|
-
self.sdrplay3_rspduo_0.set_dc_offset_mode(False)
|
80
|
-
self.sdrplay3_rspduo_0.set_iq_balance_mode(False)
|
81
|
-
self.sdrplay3_rspduo_0.set_agc_setpoint(-30)
|
82
|
-
self.sdrplay3_rspduo_0.set_rf_notch_filter(False)
|
83
|
-
self.sdrplay3_rspduo_0.set_dab_notch_filter(True)
|
84
|
-
self.sdrplay3_rspduo_0.set_am_notch_filter(False)
|
85
|
-
self.sdrplay3_rspduo_0.set_biasT(False)
|
86
|
-
self.sdrplay3_rspduo_0.set_stream_tags(True)
|
87
|
-
self.sdrplay3_rspduo_0.set_debug_mode(False)
|
88
|
-
self.sdrplay3_rspduo_0.set_sample_sequence_gaps_check(False)
|
89
|
-
self.sdrplay3_rspduo_0.set_show_gain_changes(False)
|
90
|
-
|
91
|
-
|
92
|
-
##################################################
|
93
|
-
# Connections
|
94
|
-
##################################################
|
95
|
-
self.msg_connect((self.spectre_sweep_driver_0, 'freq'), (self.sdrplay3_rspduo_0, 'freq'))
|
96
|
-
self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_batched_file_sink_0, 0))
|
97
|
-
self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_sweep_driver_0, 0))
|
98
|
-
|
99
|
-
|
100
|
-
def main(capture_config: CaptureConfig,
|
101
|
-
top_block_cls=tuner_2_sweep,
|
102
|
-
options=None):
|
103
|
-
tb = top_block_cls(capture_config)
|
104
|
-
|
105
|
-
def sig_handler(sig=None, frame=None):
|
106
|
-
tb.stop()
|
107
|
-
tb.wait()
|
108
|
-
|
109
|
-
sys.exit(0)
|
110
|
-
|
111
|
-
signal.signal(signal.SIGINT, sig_handler)
|
112
|
-
signal.signal(signal.SIGTERM, sig_handler)
|
113
|
-
|
114
|
-
tb.start(1024)
|
115
|
-
|
116
|
-
tb.wait()
|
117
|
-
|
118
|
-
if __name__ == '__main__':
|
119
|
-
main()
|