spectre-core 0.0.1__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.
Files changed (72) hide show
  1. spectre_core/__init__.py +3 -0
  2. spectre_core/cfg.py +116 -0
  3. spectre_core/chunks/__init__.py +206 -0
  4. spectre_core/chunks/base.py +160 -0
  5. spectre_core/chunks/chunk_register.py +15 -0
  6. spectre_core/chunks/factory.py +26 -0
  7. spectre_core/chunks/library/__init__.py +8 -0
  8. spectre_core/chunks/library/callisto/__init__.py +0 -0
  9. spectre_core/chunks/library/callisto/chunk.py +101 -0
  10. spectre_core/chunks/library/fixed/__init__.py +0 -0
  11. spectre_core/chunks/library/fixed/chunk.py +185 -0
  12. spectre_core/chunks/library/sweep/__init__.py +0 -0
  13. spectre_core/chunks/library/sweep/chunk.py +400 -0
  14. spectre_core/dynamic_imports.py +22 -0
  15. spectre_core/exceptions.py +17 -0
  16. spectre_core/file_handlers/base.py +94 -0
  17. spectre_core/file_handlers/configs.py +269 -0
  18. spectre_core/file_handlers/json.py +36 -0
  19. spectre_core/file_handlers/text.py +21 -0
  20. spectre_core/logging.py +222 -0
  21. spectre_core/plotting/__init__.py +5 -0
  22. spectre_core/plotting/base.py +194 -0
  23. spectre_core/plotting/factory.py +26 -0
  24. spectre_core/plotting/format.py +19 -0
  25. spectre_core/plotting/library/__init__.py +7 -0
  26. spectre_core/plotting/library/frequency_cuts/panel.py +74 -0
  27. spectre_core/plotting/library/integral_over_frequency/panel.py +34 -0
  28. spectre_core/plotting/library/spectrogram/panel.py +92 -0
  29. spectre_core/plotting/library/time_cuts/panel.py +77 -0
  30. spectre_core/plotting/panel_register.py +13 -0
  31. spectre_core/plotting/panel_stack.py +148 -0
  32. spectre_core/receivers/__init__.py +6 -0
  33. spectre_core/receivers/base.py +415 -0
  34. spectre_core/receivers/factory.py +19 -0
  35. spectre_core/receivers/library/__init__.py +7 -0
  36. spectre_core/receivers/library/rsp1a/__init__.py +0 -0
  37. spectre_core/receivers/library/rsp1a/gr/__init__.py +0 -0
  38. spectre_core/receivers/library/rsp1a/gr/fixed.py +104 -0
  39. spectre_core/receivers/library/rsp1a/gr/sweep.py +129 -0
  40. spectre_core/receivers/library/rsp1a/receiver.py +68 -0
  41. spectre_core/receivers/library/rspduo/__init__.py +0 -0
  42. spectre_core/receivers/library/rspduo/gr/__init__.py +0 -0
  43. spectre_core/receivers/library/rspduo/gr/tuner_1_fixed.py +110 -0
  44. spectre_core/receivers/library/rspduo/gr/tuner_1_sweep.py +135 -0
  45. spectre_core/receivers/library/rspduo/receiver.py +68 -0
  46. spectre_core/receivers/library/test/__init__.py +0 -0
  47. spectre_core/receivers/library/test/gr/__init__.py +0 -0
  48. spectre_core/receivers/library/test/gr/cosine_signal_1.py +83 -0
  49. spectre_core/receivers/library/test/gr/tagged_staircase.py +93 -0
  50. spectre_core/receivers/library/test/receiver.py +174 -0
  51. spectre_core/receivers/receiver_register.py +22 -0
  52. spectre_core/receivers/validators.py +205 -0
  53. spectre_core/spectrograms/__init__.py +3 -0
  54. spectre_core/spectrograms/analytical.py +205 -0
  55. spectre_core/spectrograms/array_operations.py +77 -0
  56. spectre_core/spectrograms/spectrogram.py +461 -0
  57. spectre_core/spectrograms/transform.py +267 -0
  58. spectre_core/watchdog/__init__.py +6 -0
  59. spectre_core/watchdog/base.py +105 -0
  60. spectre_core/watchdog/event_handler_register.py +15 -0
  61. spectre_core/watchdog/factory.py +22 -0
  62. spectre_core/watchdog/library/__init__.py +10 -0
  63. spectre_core/watchdog/library/fixed/__init__.py +0 -0
  64. spectre_core/watchdog/library/fixed/event_handler.py +41 -0
  65. spectre_core/watchdog/library/sweep/event_handler.py +55 -0
  66. spectre_core/watchdog/watcher.py +50 -0
  67. spectre_core/web_fetch/callisto.py +101 -0
  68. spectre_core-0.0.1.dist-info/LICENSE +674 -0
  69. spectre_core-0.0.1.dist-info/METADATA +40 -0
  70. spectre_core-0.0.1.dist-info/RECORD +72 -0
  71. spectre_core-0.0.1.dist-info/WHEEL +5 -0
  72. spectre_core-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,68 @@
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
@@ -0,0 +1,110 @@
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: Options 0
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, tag, chunk_size, samp_rate, is_sweeping)
54
+ self.sdrplay3_rspduo_0 = sdrplay3.rspduo(
55
+ '',
56
+ rspduo_mode="Single Tuner",
57
+ antenna="Tuner 1 50 ohm",
58
+ stream_args=sdrplay3.stream_args(
59
+ output_type='fc32',
60
+ channels_size=1
61
+ ),
62
+ )
63
+ self.sdrplay3_rspduo_0.set_sample_rate(samp_rate)
64
+ self.sdrplay3_rspduo_0.set_center_freq(center_freq)
65
+ self.sdrplay3_rspduo_0.set_bandwidth(bandwidth)
66
+ self.sdrplay3_rspduo_0.set_antenna("Tuner 1 50 ohm")
67
+ self.sdrplay3_rspduo_0.set_gain_mode(False)
68
+ self.sdrplay3_rspduo_0.set_gain(IF_gain, 'IF')
69
+ self.sdrplay3_rspduo_0.set_gain(RF_gain, 'RF')
70
+ self.sdrplay3_rspduo_0.set_freq_corr(0)
71
+ self.sdrplay3_rspduo_0.set_dc_offset_mode(False)
72
+ self.sdrplay3_rspduo_0.set_iq_balance_mode(False)
73
+ self.sdrplay3_rspduo_0.set_agc_setpoint(-30)
74
+ self.sdrplay3_rspduo_0.set_rf_notch_filter(False)
75
+ self.sdrplay3_rspduo_0.set_dab_notch_filter(False)
76
+ self.sdrplay3_rspduo_0.set_am_notch_filter(False)
77
+ self.sdrplay3_rspduo_0.set_biasT(False)
78
+ self.sdrplay3_rspduo_0.set_debug_mode(False)
79
+ self.sdrplay3_rspduo_0.set_sample_sequence_gaps_check(False)
80
+ self.sdrplay3_rspduo_0.set_show_gain_changes(False)
81
+
82
+
83
+ ##################################################
84
+ # Connections
85
+ ##################################################
86
+ self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_batched_file_sink_0, 0))
87
+
88
+
89
+
90
+
91
+
92
+ def main(capture_config: CaptureConfig,
93
+ top_block_cls=tuner_1_fixed,
94
+ options=None):
95
+
96
+ tb = top_block_cls(capture_config)
97
+
98
+ def sig_handler(sig=None, frame=None):
99
+ tb.stop()
100
+ tb.wait()
101
+
102
+ sys.exit(0)
103
+
104
+ signal.signal(signal.SIGINT, sig_handler)
105
+ signal.signal(signal.SIGTERM, sig_handler)
106
+
107
+ tb.start()
108
+
109
+ tb.wait()
110
+
@@ -0,0 +1,135 @@
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 blocks
17
+ from gnuradio import gr
18
+ from gnuradio.filter import firdes
19
+ from gnuradio.fft import window
20
+ from gnuradio.eng_arg import eng_float, intx
21
+ from gnuradio import eng_notation
22
+ from gnuradio import sdrplay3
23
+ from gnuradio import spectre
24
+
25
+ from spectre_core.cfg import CHUNKS_DIR_PATH
26
+ from spectre_core.file_handlers.configs import CaptureConfig
27
+
28
+
29
+
30
+
31
+ class tuner_1_sweep(gr.top_block):
32
+ def __init__(self,
33
+ capture_config: CaptureConfig):
34
+ gr.top_block.__init__(self, "tuner-1-sweep", catch_exceptions=True)
35
+
36
+ ##################################################
37
+ # Unpack capture config
38
+ ##################################################
39
+ samp_rate = capture_config['samp_rate']
40
+ bandwidth = capture_config['bandwidth']
41
+ min_freq = capture_config['min_freq']
42
+ max_freq = capture_config['max_freq']
43
+ freq_step = capture_config['freq_step']
44
+ samples_per_step = capture_config['samples_per_step']
45
+ IF_gain = capture_config['IF_gain']
46
+ RF_gain = capture_config['RF_gain']
47
+ chunk_size = capture_config['chunk_size']
48
+ start_freq = min_freq + samp_rate/2
49
+ tag = capture_config['tag']
50
+
51
+
52
+ ##################################################
53
+ # Blocks
54
+ ##################################################
55
+ self.spectre_sweep_driver_0 = spectre.sweep_driver(min_freq,
56
+ max_freq,
57
+ freq_step,
58
+ samp_rate,
59
+ samples_per_step,
60
+ 'freq')
61
+ self.spectre_batched_file_sink_0 = spectre.batched_file_sink(CHUNKS_DIR_PATH,
62
+ tag,
63
+ chunk_size,
64
+ samp_rate,
65
+ True,
66
+ 'freq',
67
+ start_freq)
68
+ self.sdrplay3_rspduo_0 = sdrplay3.rspduo(
69
+ '',
70
+ rspduo_mode="Single Tuner",
71
+ antenna="Tuner 1 50 ohm",
72
+ stream_args=sdrplay3.stream_args(
73
+ output_type='fc32',
74
+ channels_size=1
75
+ ),
76
+ )
77
+ self.sdrplay3_rspduo_0.set_sample_rate(samp_rate, True)
78
+ self.sdrplay3_rspduo_0.set_center_freq(start_freq, True)
79
+ self.sdrplay3_rspduo_0.set_bandwidth(bandwidth)
80
+ self.sdrplay3_rspduo_0.set_antenna("Tuner 1 50 ohm")
81
+ self.sdrplay3_rspduo_0.set_gain_mode(False)
82
+ self.sdrplay3_rspduo_0.set_gain(IF_gain, 'IF', True)
83
+ self.sdrplay3_rspduo_0.set_gain(RF_gain, 'RF', True)
84
+ self.sdrplay3_rspduo_0.set_freq_corr(0)
85
+ self.sdrplay3_rspduo_0.set_dc_offset_mode(False)
86
+ self.sdrplay3_rspduo_0.set_iq_balance_mode(False)
87
+ self.sdrplay3_rspduo_0.set_agc_setpoint(-30)
88
+ self.sdrplay3_rspduo_0.set_rf_notch_filter(False)
89
+ self.sdrplay3_rspduo_0.set_dab_notch_filter(True)
90
+ self.sdrplay3_rspduo_0.set_am_notch_filter(False)
91
+ self.sdrplay3_rspduo_0.set_biasT(False)
92
+ self.sdrplay3_rspduo_0.set_stream_tags(True)
93
+ self.sdrplay3_rspduo_0.set_debug_mode(False)
94
+ self.sdrplay3_rspduo_0.set_sample_sequence_gaps_check(False)
95
+ self.sdrplay3_rspduo_0.set_show_gain_changes(False)
96
+ self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_gr_complex*1, 'freq', "freq")
97
+ self.blocks_tag_debug_0.set_display(True)
98
+
99
+
100
+ ##################################################
101
+ # Connections
102
+ ##################################################
103
+ self.msg_connect((self.spectre_sweep_driver_0, 'freq'), (self.sdrplay3_rspduo_0, 'freq'))
104
+ self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_batched_file_sink_0, 0))
105
+ self.connect((self.sdrplay3_rspduo_0, 0), (self.spectre_sweep_driver_0, 0))
106
+
107
+
108
+ def get_samp_rate(self):
109
+ return self.samp_rate
110
+
111
+ def set_samp_rate(self, samp_rate):
112
+ self.samp_rate = samp_rate
113
+ self.sdrplay3_rspduo_0.set_sample_rate(self.samp_rate, True)
114
+
115
+
116
+
117
+
118
+ def main(capture_config: CaptureConfig,
119
+ top_block_cls=tuner_1_sweep,
120
+ options=None):
121
+ tb = top_block_cls(capture_config)
122
+
123
+ def sig_handler(sig=None, frame=None):
124
+ tb.stop()
125
+ tb.wait()
126
+
127
+ sys.exit(0)
128
+
129
+ signal.signal(signal.SIGINT, sig_handler)
130
+ signal.signal(signal.SIGTERM, sig_handler)
131
+
132
+ tb.start(1024)
133
+
134
+ tb.wait()
135
+
@@ -0,0 +1,68 @@
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.rspduo.gr import tuner_1_fixed, tuner_1_sweep
8
+ from spectre_core.file_handlers.configs import CaptureConfig
9
+
10
+
11
+ @register_receiver("rspduo")
12
+ class Receiver(SDRPlayReceiver):
13
+ def __init__(self, *args, **kwargs):
14
+ super().__init__(*args, **kwargs)
15
+
16
+
17
+ def _set_capture_methods(self) -> None:
18
+ self._capture_methods = {
19
+ "tuner-1-fixed": self.__tuner_1_fixed,
20
+ "tuner-1-sweep": self.__tuner_1_sweep
21
+ }
22
+
23
+
24
+ def _set_validators(self) -> None:
25
+ self._validators = {
26
+ "tuner-1-fixed": self.__tuner_1_fixed_validator,
27
+ "tuner-1-sweep": self.__tuner_1_sweep_validator
28
+ }
29
+ return
30
+
31
+
32
+ def _set_type_templates(self) -> None:
33
+ self._type_templates = {
34
+ "tuner-1-fixed": self._get_default_type_template("fixed"),
35
+ "tuner-1-sweep": self._get_default_type_template("sweep"),
36
+ }
37
+
38
+ def _set_specifications(self) -> None:
39
+ self._specifications = {
40
+ "center_freq_lower_bound": 1e3, # [Hz]
41
+ "center_freq_upper_bound": 2e9, # [Hz]
42
+ "samp_rate_lower_bound": 200e3, # [Hz]
43
+ "samp_rate_upper_bound": 10e6, # [Hz]
44
+ "bandwidth_lower_bound": 200e3, # [Hz]
45
+ "bandwidth_upper_bound": 8e6, # [Hz]
46
+ "IF_gain_upper_bound": -20, # [dB]
47
+ "RF_gain_upper_bound": 0, # [dB]
48
+ "api_latency": 50 * 1e-3 # [s]
49
+ }
50
+
51
+
52
+ def __tuner_1_fixed(self, capture_config: CaptureConfig) -> None:
53
+ tuner_1_fixed.main(capture_config)
54
+
55
+
56
+ def __tuner_1_sweep(self, capture_config: CaptureConfig) -> None:
57
+ tuner_1_sweep.main(capture_config)
58
+
59
+
60
+ def __tuner_1_fixed_validator(self, capture_config: CaptureConfig) -> None:
61
+ self._default_fixed_validator(capture_config)
62
+ self._sdrplay_validator(capture_config)
63
+
64
+
65
+ def __tuner_1_sweep_validator(self, capture_config: CaptureConfig) -> None:
66
+ self._default_sweep_validator(capture_config)
67
+ self._sdrplay_validator(capture_config)
68
+
File without changes
File without changes
@@ -0,0 +1,83 @@
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
+ import sys
16
+ import signal
17
+ from typing import Any
18
+
19
+ from gnuradio import analog
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 spectre
27
+
28
+ from spectre_core.cfg import CHUNKS_DIR_PATH
29
+ from spectre_core.file_handlers.configs import CaptureConfig
30
+
31
+ class cosine_signal_1(gr.top_block):
32
+
33
+ def __init__(self,
34
+ capture_config: CaptureConfig):
35
+ gr.top_block.__init__(self, "cosine-signal-1", catch_exceptions=True)
36
+
37
+ ##################################################
38
+ # Unpack capture config
39
+ ##################################################
40
+ samp_rate = capture_config['samp_rate']
41
+ tag = capture_config['tag']
42
+ chunk_size = capture_config['chunk_size']
43
+ frequency = capture_config['frequency']
44
+ amplitude = capture_config['amplitude']
45
+
46
+ ##################################################
47
+ # Blocks
48
+ ##################################################
49
+ self.spectre_batched_file_sink_0 = spectre.batched_file_sink(CHUNKS_DIR_PATH, tag, chunk_size, samp_rate)
50
+ self.blocks_throttle_0_1 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
51
+ self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
52
+ self.blocks_null_source_1 = blocks.null_source(gr.sizeof_float*1)
53
+ self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
54
+ self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, frequency, amplitude, 0, 0)
55
+
56
+
57
+ ##################################################
58
+ # Connections
59
+ ##################################################
60
+ self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
61
+ self.connect((self.blocks_float_to_complex_1, 0), (self.spectre_batched_file_sink_0, 0))
62
+ self.connect((self.blocks_null_source_1, 0), (self.blocks_throttle_0_1, 0))
63
+ self.connect((self.blocks_throttle_0, 0), (self.blocks_float_to_complex_1, 0))
64
+ self.connect((self.blocks_throttle_0_1, 0), (self.blocks_float_to_complex_1, 1))
65
+
66
+
67
+ def main(capture_config: CaptureConfig,
68
+ top_block_cls=cosine_signal_1,
69
+ options=None):
70
+ tb = top_block_cls(capture_config)
71
+
72
+ def sig_handler(sig=None, frame=None):
73
+ tb.stop()
74
+ tb.wait()
75
+
76
+ sys.exit(0)
77
+
78
+ signal.signal(signal.SIGINT, sig_handler)
79
+ signal.signal(signal.SIGTERM, sig_handler)
80
+
81
+ tb.start()
82
+
83
+ tb.wait()
@@ -0,0 +1,93 @@
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
+ 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 spectre
27
+
28
+ from spectre_core.cfg import CHUNKS_DIR_PATH
29
+ from spectre_core.file_handlers.configs import CaptureConfig
30
+
31
+ class tagged_staircase(gr.top_block):
32
+
33
+ def __init__(self,
34
+ capture_config: CaptureConfig):
35
+ gr.top_block.__init__(self, "tagged-staircase", catch_exceptions=True)
36
+
37
+ ##################################################
38
+ # Unpack capture config
39
+ ##################################################
40
+ tag = capture_config['tag']
41
+ step_increment = capture_config['step_increment']
42
+ samp_rate = capture_config['samp_rate']
43
+ min_samples_per_step = capture_config['min_samples_per_step']
44
+ max_samples_per_step = capture_config['max_samples_per_step']
45
+ freq_step = capture_config['freq_step']
46
+ chunk_size = capture_config['chunk_size']
47
+ is_sweeping = True
48
+
49
+ ##################################################
50
+ # Blocks
51
+ ##################################################
52
+ self.spectre_tagged_staircase_0 = spectre.tagged_staircase(min_samples_per_step,
53
+ max_samples_per_step,
54
+ freq_step,
55
+ step_increment,
56
+ samp_rate)
57
+ self.spectre_batched_file_sink_0 = spectre.batched_file_sink(CHUNKS_DIR_PATH,
58
+ tag,
59
+ chunk_size,
60
+ samp_rate,
61
+ is_sweeping,
62
+ 'rx_freq',
63
+ 0
64
+ )
65
+ self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate, True)
66
+
67
+
68
+ ##################################################
69
+ # Connections
70
+ ##################################################
71
+ self.connect((self.blocks_throttle_0, 0), (self.spectre_batched_file_sink_0, 0))
72
+ self.connect((self.spectre_tagged_staircase_0, 0), (self.blocks_throttle_0, 0))
73
+
74
+
75
+
76
+
77
+ def main(capture_config: CaptureConfig,
78
+ top_block_cls=tagged_staircase,
79
+ options=None):
80
+ tb = top_block_cls(capture_config)
81
+
82
+ def sig_handler(sig=None, frame=None):
83
+ tb.stop()
84
+ tb.wait()
85
+
86
+ sys.exit(0)
87
+
88
+ signal.signal(signal.SIGINT, sig_handler)
89
+ signal.signal(signal.SIGTERM, sig_handler)
90
+
91
+ tb.start()
92
+
93
+ tb.wait()