summaryrefslogtreecommitdiff
path: root/gr-blocks/python
Commit message (Collapse)AuthorAgeFilesLines
* blocks: document the supported operations in transcendentalMarcus Müller2022-01-031-1/+1
| | | | Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
* cmake: change how test files are build when cross compilingPhilip Balister2021-12-031-0/+3
| | | | | | | | | | | | | | | | | | | | * When cross compiling gnuradio, change how the test files are built. Normally, the gnuradio QA code expects to run in the build tree. For the cross compilng case, we cannot run the QA code during the build process. The changes here allow the creation of an additional package that can be installed on a target that will run the QA code against the installed libraries. Major changes are not using full paths to test files (since they include paths that only exist on the build machine) and not setting environment variables in the shell files to force the QA code to use code in the build tree. This patch disables the C++ only tests, these need some work and then they can be added back for the cross compile case. Signed-off-by: Philip Balister <philip@balister.org>
* qa: update tests to work with OpenEmbeddedPhilip Balister2021-12-034-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | * qa_nlog10.py: Update test to check for equal with one less decimal place. On the qemu machines built with OpenEmbedded, this test failed if the check was 5 decimal places. Relaxing to 4 lets the test pass. The volk routines used in the implementation pass QA already. Signed-off-by: Philip Balister <philip@balister.org> * Update QA tests to import helper routines from blocks. The file metadata QA installs a file in blocks, but imported it directly. Updated init.py to import via blocks. matrix interleaver imported some routines from a py file that was available via blocks. These cretaed issues when you install the qa tests in images to run them outside the build area. Signed-off-by: Philip Balister <philip@balister.org> * python formatting Signed-off-by: Josh Morman <jmorman@gnuradio.org> Co-authored-by: Josh Morman <jmorman@gnuradio.org>
* blocks: pep8 formattingJosh Morman2021-11-2418-110/+181
| | | | Signed-off-by: Josh Morman <jmorman@gnuradio.org>
* logging core: replace log4cpp by spdlogMarcus Müller2021-11-191-22/+22
| | | | | | | | also: enable formerly disabled qa_logger tests This replaces log4cpp with spdlog. Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
* blocks: message strobe - add unit testlenhart2021-10-222-0/+121
| | | | | | | * added unittest to the message strobe block (by testing against the message debug block). Taken test method from gr-zeromq message blocks as pointed out by Vasil. Signed-off-by: Lenhart <malte.lenhart@mailbox.org>
* runtime: fix pybind of get_tags_in_window mormj2021-09-291-1/+4
| | | | | | | | | | | | | * runtime: fix pybind of get_tags_in_window Fix issue where get_tags_in_window was bound to and consequently had the same behavior as get_tags_in_range Fixes #5005 Test recommended by ryanvolz fails to validate tag offset not just when nitems_read is 0 Signed-off-by: Josh Morman <jmorman@peratonlabs.com>
* digital: pack_k_bits propagate tags correctlyJason Uher2021-07-192-2/+76
| | | | | | fixes #1111 Signed-off-by: Jason Uher <jason.uher@jhuapl.edu>
* blocks: Throttle consume-only modeMarcus Müller2021-07-191-1/+1
| | | | | | | | | When throttling a sample flow, it's not necessary to produce items at the desired average rate - consuming them at a limited rate suffices to slow down the processing of the whole flow graph just as well, and avoids a copy. Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
* blocks: add matrix interleaver blockJaredD2021-07-194-0/+127
| | | | | | | | | | | | | | | | | | | | | | * blocks: add matrix interleaver block Matrix interleaver including qa test and example The matrix interleaver is a hierarchical block that pairs a base deinterleave block that effectively writes samples into "rows" (1 block of samples per output) and a base interleave block that outputs samples iteratively from each input like "columns". Signed-off-by: Jared Dulmage <jared.dulmage@caliola.com> Add grc file and update blocks.tree.yml. Fix module for matrix interleaver example Signed-off-by: Jared Dulmage <jared.dulmage@caliola.com> * Update py file docs and license block Co-authored-by: Jared Dulmage <jared.dulmage@caliola.com>
* blocks: zero-output, zero-copy Head modeMarcus Müller2021-06-281-1/+1
| | | | | | | | | If you don't want to test a stream with an exact number of input, but just want your flow graph to terminate after a given number of items, having a head block without an output enables you to do that without copying the data from Head's in- to its output. Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
* global: automatically remove unused boost includesMarcus Müller2021-06-221-1/+1
| | | | | | | | used command: sed -i '/^#include.*boost.*$/d' $(ag -L '(boost::|BOOST)' $(ag --cpp -l '#include <boost')) Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
* testing: rm dependencies from disabled components in blocks/runtime testsMarcus Müller2021-06-191-1/+5
| | | | | | | | | This included shifting of the PDU test from runtime to gr-pdu, and making the tests that actually require blocks conditional on whether there's going to be gr-blocks. Also, don't use gr-analog just because you need data. Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
* blocks: improvements to var/msg blocksJacob Gilbert2021-06-072-16/+31
| | | | | | | | | Fixes an issue where a user was feeding a dictionary into the msg_to_var block which was then setting the variable to 'None' causing unexpected behavior. This improves input sanitization for both blocks and adds some extra info to the docstrings. Signed-off-by: Jacob Gilbert <jacob.gilbert@protonmail.com>
* gr-blocks: Add missing pybind11 binding for Phase Shift block.Ron Economos2021-06-041-0/+1
| | | | Signed-off-by: Ron Economos <w6rz@comcast.net>
* blocks: use VOLK popcnt implementations for count_bitsNicholas Corgan2021-05-131-2/+2
| | | | | | * Changed count_bits64 input parameter type to uint64_t Signed-off-by: Nicholas Corgan <n.corgan@gmail.com>
* blocks: remove tcp/udp qaJosh Morman2021-04-212-232/+0
| | | | | | gr-network needs qa functionality on the tcp/udp blocks instead Signed-off-by: Josh Morman <jmorman@perspectalabs.com>
* blocks: remove deprecated network blocksJosh Morman2021-04-218-290/+0
| | | | Signed-off-by: Josh Morman <jmorman@perspectalabs.com>
* blocks: Add msg port to set rotator's phase incIgor Freire2021-04-172-2/+327
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Receivers commonly estimate the frequency offset on a block that is downstream relative to the frequency correction NCO. In such architectures, typically the frequency offset estimator feeds the estimation back to the NCO. Until now, this was not possible if using the rotator block as the NCO. This patch adds a message port to the rotator block such that the referred feedback architecture becomes feasible. A downstream block can estimate the frequency offset and send a message to the rotator block to update its rotating frequency (i.e., its phase increment). The requesting block can schedule the phase increment update to a specific absolute sample index. This feature is useful for receivers that rely on a frame structure and pilot-aided frequency offset estimation. If the true frequency offset is allowed to change at any random instant throughout the frame, the frame-averaged frequency offset estimation can become less reliable. Instead, it is often better to update the frequency correction right at the start of a new frame. With that, the true frequency offset is preserved in the course of a frame and only changes around the boundary between consecutive frames. For flexibility when using this feature, it is the responsibility of the downstream block to schedule the phase increment update properly. For example, if there is a decimator in between the rotator block and the frequency offset estimator, the latter will need to take the sample rate conversion into account when defining the absolute sample offset when the update should be applied. Besides, the rotator block can now place a tag on the sample where it updates the phase increment. This allows a downstream block to better calibrate and validate the scheduling of phase increment updates. Signed-off-by: Igor Freire <igor@blockstream.com>
* blocks: message_debug: vector indices are size_t, not signed intMarcus Müller2021-03-231-1/+1
| | | | Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
* gr-blocks: remove pdu blocksJacob Gilbert2021-03-1825-1023/+64
| | | | | | | | | | | | | | | | | | | | | | | | The following have been moved to the new gr::pdu module or to gr::network and are no longer needed in gr::blocks: - pdu (noblock) - pdu_filter block - pdu_remove block - pdu_set block - pdu_to_tagged_stream block - random_pdu block - socket_pdu block - stream_pdu_base (noblock) - tagged_stream_to_pdu block - tcp_connection (noblock) - tuntap_pdu block The digital and FEC modules had a large number of references to the PDU blocks that were moved from gr-blocks to gr-pdu, this updates these changes in example flowgraphs and a few python files. The usage-manual update will be propagated to the wiki so that future exports will remain up to date. Signed-off-by: Jacob Gilbert <jacob.gilbert@protonmail.com>
* gr-blocks: deprecate print_pdu port of message_debug blockJacob Gilbert2021-02-251-2/+2
| | | | | | | | | Having two print ports on this block has confused a number of people, most recently issue #4191, and combining them is straightforward and should make this block easier to use. The print_pdu formatting is now be applied on the print port if the message is a PDU. Signed-off-by: Jacob Gilbert <jacob.gilbert@protonmail.com>
* clang-tidy: run full .clang-tidy on C++17 codebaseMarcus Müller2021-01-194-4/+4
| | | | | | | | | | | | | | | | | | | | run /usr/share/clang/run-clang-tidy.py -checks=file '-header-filter=.*' -fix .. from build directory. Then, clang-format -i $(git diff --name-only origin/master) to clang-format changed files. Then, refresh all header hashes in pybind bindings (*/python/bindings/*.cc) Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
* gr-blocks qa for peak_detector2: fix result type in test5Jeff Long2021-01-121-2/+2
| | | | Signed-off-by: Jeff Long <willcode4@gmail.com>
* peak_detector2: Make the recently added test case failrear10192021-01-111-3/+3
|
* peak_detector2: bug fix and add a test caseCallyan2021-01-111-0/+26
|
* rotator: add getter rotator::phase()Jeff Long2020-11-251-1/+4
|
* modernization: `override` instead of virtual in all compilation unitsMarcus Müller2020-11-031-1/+1
|
* qa: run autopep8 formatting on qa python filesmormj2020-10-3077-1326/+1824
| | | | | | find ./ -iname qa*.py | xargs autopep8 --in-place -a -a mostly formats whitespace and gets rid of trailing semicolons
* qa: remove xml file parameter causing deprecation warningsmormj2020-10-3074-76/+73
|
* Fix typos throughout the codeluzpaz2020-10-294-7/+7
| | | | | | | * Fix various typos Found via `codespell v2.0.dev` `codespell -q 3 -L ans,fo,hist,inout,ist,ith,nd,sinc,uint -S ./volk`
* pybind: add implicit conversion from int to enummormj2020-10-284-0/+8
| | | | | | | | | | | | | * dtv: add implicit conversion from int to enum * analog: add implicit conversion from int to enum * blocks: add implicit conversion from int to enum * digital: add implicit conversion from int to enum * fec: add implicit conversion from int to enum * fft: add implicit conversion from int to enum * filter: add implicit conversion from int to enum * qtgui: add implicit conversion from int to enum * trellis: add implicit conversion from int to enum * vocoder: add implicit conversion from int to enum * bindtool: add implicitly_convertible to all enums
* blocks: improvements to the message_debug blockJacob Gilbert2020-10-242-2/+13
| | | | aggregates the data to be printed into a stringstream so that it is printed at the same time reducing debug information becoming muddled between competing cout statements. this change also provides an argument to this block to disable the printing of PDU uniform vectors which are often not needed for debug purposes
* blocks: prevent losing rx_time precision in gr_read_file_metadataDaniel Estévez2020-10-201-3/+12
| | | | | | | | | | | | | | | | | | The utility gr_read_file_metadata uses parse_file_metadata.parse_header() from gr-blocks to parse and print headers in a metadata file. Currently, the rx_time field is printed with us precision. However, the rx_time is stored as the integer seconds of the UNIX timestamp in an uint64_t plus a double storing the fraction of a second, so the rx_time has more precision. A precision on the order of 1ns is necessary for many ranging applications, since 1us is approximately 300m of range. This modifies parse_file_metadata.parse_header() to print rx_time with 16 decimal places, without losing precision. Aditionally, it adds "rx_time_secs" and "rx_time_fracs" fields to the dict() return value of parse_header(), in case they are ever needed. The "rx_time" field in this dict() is a double, and as such it is unable to store a UNIX timestamp with 1ns precision.
* blocks: comment fix, typo in complex_to_real.h, complex_to_imag.hPaul Boven2020-10-122-4/+4
|
* gr-blocks: Add missing methods to Add Const block pybind11 binding.Ron Economos2020-10-081-1/+3
|
* gr-blocks: Add missing methods to Multiply Const block pybind11 binding.Ron Economos2020-10-071-1/+3
|
* blocks: New block 'Stream Demux'David Pi2020-09-255-2/+367
| | | | | | | | | | | | | | | | Stream demuxing block to demultiplex one stream into N output streams. Demuxes a stream producing N outputs streams that contains n_0 items in the first stream, n_1 items in the second, etc. and repeats. Number of items of each output stream is specified using the 'lengths' parameter like so [n_0, n_1, ..., n_N-1]. Example: lengths = [2, 3, 4] input stream: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...] output_streams: [0, 1, 9, 10, ...] [2, 3, 4, 11, ...] [5, 6, 7, 8, ...]
* gr-blocks: More graceful error handling of missing sndfile dependency.Ron Economos2020-09-203-3/+17
|
* blocks/correctiq: Clean up member initializationThomas Habets2020-09-092-2/+2
|
* gr-blocks: Transition the WAV sink and source blocks to libsndfile.Ron Economos2020-09-017-55/+52
| | | | Compressed input and output with FLAC and Ogg Vorbis now supported.
* blocks: remove log2_constMarcus Müller2020-08-144-94/+0
| | | | | | | | | | | | Was not standards-compliant (assert(0) in constexpr) Only used in packed_to_unpacked to get the log2(number of bits(type)) in packed_to_unpacked<type>. Was not wrapped to python nor public API. To little surprise, a static method compiles faster, and gets compile-time-calculated by a modern compiler, too.
* python: Remove unnecessary 'from __future__ import'Oleksandr Kravchuk2020-08-0312-16/+0
| | | | | | | | | | | | | | | | All of the removed `from __future__ import` were needed in older versions of Python (mostly 2.5.x and below) but later became mandatory in most versions of Python 3 hence are not necessary anymore. More specifically, according to __future__.py[1]: - unicode_literals is part of Python since versions 2.6.0 and 3.0.0; - print_function is part of Python since versions 2.6.0 and 3.0.0; - absolute_import is part of Python since versions 2.5.0 and 3.0.0; - division is part of Python since versions 2.2.0 and 3.0.0; Get rid of those unnecessary imports to slightly clean up the codebase. [1] https://github.com/python/cpython/blob/master/Lib/__future__.py
* Move from SWIG to Pybind11Marcus Müller2020-06-19373-751/+14483
|\ | | | | | | | | | | Goodbye, and thanks for all the fish, SWIG. Please refer to docs/PYBIND11.md for details on how to deal with Pybind.
| * pybind: add hash check to binding file creation (#3472)mormj2020-06-04165-163/+1543
| |
| * pybind: run clang-formatJosh Morman2020-06-041-7/+6
| |
| * blocks: add pybind11 bindingsJosh Morman2020-06-04370-534/+13104
| |
| * blocks: remove bin_statistics_f block due to swig dependenceJosh Morman2020-06-041-217/+0
| | | | | | | | | | | | | | | | The bin_statistics_f block relies on the SWIG director functionality and therefore will need to be rewritten in the transition to pybind11. Additionally it does not appear documented in any way and there are no example flowgraphs, so it is questionable whether anyone is using it at this point
* | blocks: qa_moving_average used tuple eq. for lists in pybind11Marcus Müller2020-06-191-1/+1
| |
* | blocks/moving_average: use vector functionsThomas Habets2020-06-151-3/+32
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | This improves performance of moving average for me by about 4-5x. My test is [here](https://github.com/ThomasHabets/radiostuff/blob/master/amateur/listen_70cm.grc), which processes 10MHz to find the strongest signal. Without this PR I see `moving_average` in `top` taking about 89.4-94% CPU. With this patch it's ~20.4-23.7%. Since without this patch it's that high, I don't know that it's not even better. Test measured on a Libremv2 with Intel Core i7-6500U @ 2.5GHz. The memory access pattern is probably worse with this patch, but at least on my hardware on my workload this seems to be dwarfed by the gain of using volk. It can be hard to reason about memory access patterns, so benchmarks overrule theory. The test only actually uses float averaging. More benchmarking may be required. Possible improvements: * Add template specialization for `uint16` and `uint32`? * Refactor for non-volk fallback to use only one loop, with (presumably) better memory access pattern)