|
libSDRForge
|
Convert incoming IQ blocks to FFT frames at a bounded output rate. More...
Public Member Functions | |
| None | __init__ (self, *, int fft_size=2048, float max_fps=15.0) |
| Initialize the instance. | |
| SpectrumFrame|None | latest_frame (self) |
| Read a shared snapshot without consuming any subscriber queue. | |
| SpectrumSubscription | subscribe (self, *, int max_frames=3) |
| Subscribe the component. | |
| None | unsubscribe (self, SpectrumSubscription subscription) |
| Unsubscribe the component. | |
| None | reset (self) |
| Allow immediate publication after retuning or stream restart. | |
| SpectrumFrame|None | publish_iq (self, np.ndarray iq, *, int center_frequency_hz, int sample_rate_hz, int timestamp_ns) |
| Publish a frame if its timestamp passes the frame-rate gate. | |
Public Attributes | |
| fft_size = fft_size | |
Protected Attributes | |
| _period_ns = max(1, int(1_000_000_000 / max_fps)) | |
| _lock = RLock() | |
| int|None | _last_timestamp_ns = None |
| SpectrumFrame|None | _latest_frame = None |
| set[SpectrumSubscription] | _subscribers = set() |
Convert incoming IQ blocks to FFT frames at a bounded output rate.
Timestamps are monotonic nanoseconds supplied by the caller. The IQ producer owns sampling and hardware; this publisher owns no device.
| None spectrum_publisher.SpectrumPublisher.__init__ | ( | self, | |
| * | , | ||
| int | fft_size = 2048, | ||
| float | max_fps = 15.0 ) |
Initialize the instance.
| self | The current instance. |
| fft_size | The fft_size value. |
| max_fps | The max_fps value. |
| SpectrumFrame | None spectrum_publisher.SpectrumPublisher.latest_frame | ( | self | ) |
Read a shared snapshot without consuming any subscriber queue.
| self | The current instance. |
| SpectrumFrame | None spectrum_publisher.SpectrumPublisher.publish_iq | ( | self, | |
| np.ndarray | iq, | ||
| * | , | ||
| int | center_frequency_hz, | ||
| int | sample_rate_hz, | ||
| int | timestamp_ns ) |
Publish a frame if its timestamp passes the frame-rate gate.
Returns None when throttled. No callback executes on the IQ thread.
| self | The current instance. |
| iq | The complex IQ samples to process. |
| center_frequency_hz | The center_frequency_hz value. |
| sample_rate_hz | The sample rate in hertz. |
| timestamp_ns | The timestamp_ns value. |
| None spectrum_publisher.SpectrumPublisher.reset | ( | self | ) |
Allow immediate publication after retuning or stream restart.
| self | The current instance. |
| SpectrumSubscription spectrum_publisher.SpectrumPublisher.subscribe | ( | self, | |
| * | , | ||
| int | max_frames = 3 ) |
Subscribe the component.
| self | The current instance. |
| max_frames | The max_frames value. |
| None spectrum_publisher.SpectrumPublisher.unsubscribe | ( | self, | |
| SpectrumSubscription | subscription ) |
Unsubscribe the component.
| self | The current instance. |
| subscription | The subscription value. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| spectrum_publisher.SpectrumPublisher.fft_size = fft_size |