GNU Radio + HackRF: RuntimeError: firdes check failed: 0 < fa <= sampling_freq / 2 - radio

I just started using GNU Radio, I must say I am quite a noob but I have some background on RF related stuff.
Here's the thing:
I recorded a file that I now want to repeat through my HackRF and GNU Radio.
This is the exact settings for the filter:
The settings you see are casual (since I cannot get it working I started testing with random values).
This is the error I get:
Executing: /usr/bin/python3 -u /home/scare/LAB/RadioFrequencies/GNU Radio/reply_433.py
gr-osmosdr 0.2.0.0 (0.2.0) gnuradio 3.8.2.0
built-in sink types: uhd hackrf bladerf soapy redpitaya file
[INFO] [UHD] linux; GNU C++ version 11.1.0; Boost_107600; UHD_4.0.0.0-0-unknown
Using HackRF One with firmware 2017.02.1
Traceback (most recent call last):
File "/home/scare/LAB/RadioFrequencies/GNU Radio/reply_433.py", line 211, in <module>
main()
File "/home/scare/LAB/RadioFrequencies/GNU Radio/reply_433.py", line 187, in main
tb = top_block_cls()
File "/home/scare/LAB/RadioFrequencies/GNU Radio/reply_433.py", line 137, in __init__
firdes.high_pass(
File "/usr/lib/python3.9/site-packages/gnuradio/filter/filter_swig.py", line 124, in high_pass
return _filter_swig.firdes_high_pass(*args, **kwargs)
RuntimeError: firdes check failed: 0 < fa <= sampling_freq / 2
Done (return code 1)
Where obviously the interesting part is the RuntimeError: firdes check failed: 0 < fa <= sampling_freq / 2
Unfortunately, I don't get what that 'fa' stands for.
Any idea?
Cheers

I just got done solving this same error. The error is caused by a filter's Cut-off and transition parameters being set incorrectly (in my case far too large). GNU radio handles the variable 'samp_rate' differently for each block and filters seem to interpret it was a point to center the filter on (that's my take on it so don't quote me).
I also looked in the source code and can't find anything helpful on 'fa'
So try adjusting your cutoff to be something below samp_rate and make your transition width something to the tune of 250e3. I used GUI sliders to set the filter how I liked and I will make these permanent in the final version.
Screen Cap of Settings Here
Slider Settings For Both Sliders
Mike Ossmann's "SDR with HackRF One, Lesson 10 - Filters helped" me out here. Also just a great SDR lecture series for GNU radio if you haven't come across them yet. (just make sure to use the QT GUI).
I hope this helped. I am pretty new to GNU so sorry if the explanation is a little half-baked.

fa is the cutoff_frequency in the function that is throwing the error message. The cutoff frequency has to be greater than 0 and no more than the Nyquist limit. There are some functions called sanity_check_xxx (xxx being whether one cutoff or 2, i.e. bandpass, and optionally c for complex) around line 750 in gr_filter/lib/firdes.cc in the GNU Radio repository on GitHub.
In the question the samp_rate would need to be at least 800MHz to support a high pass cutoff of 400Mhz. As far as I can tell sample rate is used the same way in these filter functions as anywhere else in GNU Radio.
I ran into the same error message because I used 'firdes.band_passinstead offirdes.complex_band_pass` and the low cutoff was negative, which it should be for the complex band pass filter.

Related

Octave error filename undefined near line 1 column 1

I tried to run a function with octave-GUI.
I first write a function in 'testFunc.rtf'(in WordPad).
function y = testFunc(x)
y = x^2 + x^3
The path to this file is 'C:\Users\username\Desktop'.
Then on octave-GUI, I wrote such code:
cd 'C:\C:\Users\username\Desktop';
testFunc(4);
The result of this was just an error below:
error: 'testFunc' undefined near line 1, column 1
How can I solve this problem?
Just in case someone like me finds this page, and the above suggestion still doesn't help, some advice. This is running on a Win10 machine:
The error text itself means nothing. It's very poor. It just means "oops, something went wrong and we can't tell you why".
In my case, the file existed, and had the correct name. And was in the "current directory". Using the octave command "what" showed it was there.
But try as I might, it always gave me the error above. I tried so many things I saw suggested in other search results, like making sure the function def was at the first line of the file, etc. Even tried changing DOS -> unix line endings (cr/lf to lf). Nothing.
Then it occurred to me that I was trying to run off of a "samba share" from a linux drive. Even though it had read/write/execute privileges, it just would not actually run.
Moved the file(s) to a windows drive and it started working!
Sheesh. Good luck, all.
Avner

Octave Psychtoolbox crashing when the screen is called to be displayed

I am still new in Octave with some experience in Python and I was requested to do a test in a stimulus application in order to find if there are errors in the code (not developed by me) and try to fix them and run the application. The issue in the code is at the time to open the screen as follows the implementation (these ones where I commented (%) are what already did before, and these ones below the comments are my correction) the code is large with 825 lines:
%% Get subject name from the user
prompt = {'Enter Subject Number:','Enter Subject Name:','Enter Todays Date:','Left or Right:'};
dlgtitle = 'Information Input';
%dims = [1 50];
dims = [1 50;1 50;1 50;1 50];
opts = 'on';
answer = inputdlg(prompt,dlgtitle,dims);
%waitfor(answer);
waitfor(dims);
%% TO Excel
% Get the name of the file that the user wants to save.
%startingFolder = userpath;
startingFolder = 'C:\Users\Vtr\Downloads\Final-task-981203\Final-task-981203\Task-981203';
defaultFileName = fullfile(startingFolder, '*.xlsx');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a filename ');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
% Combine the folder and base file name into the full file name.
fullFileName = fullfile(folder, baseFileName);
%% LOAD text initial setting
%% Create 1st screen : (Loading and Wait)text screen
% Open an on screen window - purple screen
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, [0.5 0.5 1]);
% Set up alpha-blending for smooth (anti-aliased) lines
Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
After that, in the first part is created a form to insert subject nÂș, subject name, today's date and left or right, and after that to specify a filename. Made these two parts it appears a purple screen with the mouse's cursor rotating non-stop and if I try to click with the mouse an error alert box "octave-gui.exe has stopped working" appears on. I already tried to run this code on my Virtualbox-VM (Ubuntu 16.04 LTS), firstly, it notifies that my screen is being tested and calibrated and after, it appears another error screen on the terminal:
PTB-INFO: OS support status: Linux 4.15.0-55-generic Supported.
PTB-INFO: Type 'PsychtoolboxVersion' for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file 'License.txt' in the Psychtoolbox root folder for the exact licensing conditions.
PTB-WARNING: FAILED to enable synchronization to vertical retrace!
PTB-WARNING: FAILED to enable synchronization to vertical retrace (System ignored setting [Req 1 != Actual 0])!
PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-INFO: You need to run Matlab or Octave with root-privileges, or run the script PsychLinuxConfiguration once for this to work.
PTB-INFO: See /usr/share/doc/psychtoolbox-3-common/README.Debian to make this work.
PTB-WARNING: Couldn't even collect one single valid flip interval sample! Sanity range checks failed!
PTB-WARNING: Could be a system bug or a temporary timing problem. Retrying the procedure might help if
PTB-WARNING: the latter is the culprit.
WARNING: VBL Calibration run No. 1 failed. Retrying...
PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-INFO: You need to run Matlab or Octave with root-privileges, or run the script PsychLinuxConfiguration once for this to work.
PTB-INFO: See /usr/share/doc/psychtoolbox-3-common/README.Debian to make this work.
PTB-WARNING: Couldn't even collect one single valid flip interval sample! Sanity range checks failed!
PTB-WARNING: Could be a system bug or a temporary timing problem. Retrying the procedure might help if
PTB-WARNING: the latter is the culprit.
WARNING: VBL Calibration run No. 2 failed. Retrying...
WARNING: Will enable VBL busy wait-workaround before trying final VBL Calibration run No. 3.
WARNING: This will hopefully work-around graphics driver bugs of the GPU sync-to-retrace mechanism. Cross your fingers!
PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-INFO: You need to run Matlab or Octave with root-privileges, or run the script PsychLinuxConfiguration once for this to work.
PTB-INFO: See /usr/share/doc/psychtoolbox-3-common/README.Debian to make this work.
PTB-WARNING: Couldn't even collect one single valid flip interval sample! Sanity range checks failed!
PTB-WARNING: Could be a system bug or a temporary timing problem. Retrying the procedure might help if
PTB-WARNING: the latter is the culprit.
PTB-INFO: OpenGL-Renderer is VMware, Inc. :: SVGA3D; build: RELEASE; LLVM; :: 2.1 Mesa 18.0.5
PTB-INFO: VBL startline = 664 , VBL Endline = -1
PTB-INFO: Beamposition queries unsupported or defective on this system. Using basic timestamping as fallback.
PTB-INFO: Timestamps returned by Screen('Flip') will be therefore less robust and accurate.
PTB-INFO: Measured monitor refresh interval from VBLsync = 0.000000 ms [inf Hz]. (0 valid samples taken, stddev=10000000.000000 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 16.667222 ms [59.998001 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
WARNING: Couldn't compute a reliable estimate of monitor refresh interval! The trouble with VBL syncing?!?
WARNING: Mismatch between measured monitor refresh interval and interval reported by the operating system.
This indicates massive problems with VBL sync.
----- ! PTB - ERROR: SYNCHRONIZATION FAILURE ! -----
One or more internal checks (see Warnings above) indicate that synchronization
of Psychtoolbox to the vertical retrace (VBL) is not working on your setup.
This will seriously impair proper stimulus presentation and stimulus presentation timing!
Please read 'help SyncTrouble' for information about how to solve or work-around the problem.
You can force Psychtoolbox to continue, despite the severe problems, by adding the command
Screen('Preference', 'SkipSyncTests', 1); at the top of your script, if you really know what you are doing.
error: Screen: See error message printed above.
error: Called from
PsychImaging at line 2240 column 26
Naderi_test_task_v_main_1203_v_2 at line 110 column 20
I would like to know if the issue is in my computer configurations that don't support Psychtoolbox resources or any configuration that I need to change.

Setting Octave interpreter to 'tex'

Such a simple question to have wasted an hour or two of my time. The Octave docs allude to setting the interpreter to tex and never say how to do it. I've looked on line and through stackoverflow and haven't found how to do this. I've also looked at the .octaverc files and have seen nothing that would indicate how to turn on the tex edit function. I am using Debian GNUOctave version 4.0.0. Please help.
Gary Roach
The interpreter property is set to "tex" per default for axes, line, text, patch and surface. So changing interpreter makes only sense if you want to switch to "none":
set (findobj (gcf, "-property", "interpreter"), "interpreter", "none")
This sets "interpreter"="none" for al children of the current figure.
If you want to have some fancy latex stuff in your plots and not only simple tex commands you can render it with latex:
close all
graphics_toolkit fltk
sombrero ();
title ("The sombrero function:")
fcn = "$z = \\frac{\\sin\\left(\\sqrt{x^2 + y^2}\\right)}{\\sqrt{x^2 + y^2}}$";
text (0.5, -10, 1.8, fcn, "fontsize", 20);
print -depslatexstandalone sombrero
## process generated files with pdflatex
system ("latex sombrero.tex");
## dvi to ps
system ("dvips sombrero.dvi");
## convert to png
system ("gs -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r100x100 -dEPSCrop -sOutputFile=sombrero.png sombrero.ps")
which gives:

How do I get want anything to work with xlswrite in octave?

I want anything to work with xlswrite in octave. Eventually I want to be able to put a cell array containing but really anything working at all would be a start.
I've put in the following lines as this is the simplest case I could think of:
array1 = [0 9 10]
cellarray1 = num2cell(array1)
xlswrite ('/home/willubuntu/acpimrepo/bob.xlsx', cellarray1)
Then I get this error:
error: `xlswrite' undefined near line 9 column 1
I've tried this:
xlswrite ('/home/willubuntu/acpimrepo/bob.xlsx','cellarray1')
And get the same error:
error: `xlswrite' undefined near line 9 column 1
I've tried removing the space between xlswrite and the opening parenthesis - same error.
I've tried using array1 and not cellarray1 and got the same error (with both parenthesis options).
I've tried removing the directory from the file name and get a very slightly different error:
error: `xlswrite' undefined near line 10 column 1
What is going on? Why doesn't xlswrite work? What piece of pedantry am I missing?
Please remember that if you say anything too sophisticated, it will go over my head. Remember I am clueless and at the end of my tether.
If you would use a recent Octave version you would see
octave:1> xlswrite
warning: Functions for spreadsheet style I/O
(.xls .xlsx .sxc .ods .dbf .wk1 etc.)
are provided in the io package. See <http://octave.sf.net/io/>.
which guides you to the right direction.
Even a quick search on http://wiki.octave.org/Main_Page would solve this. Perhaps you should spend some minutes with a search machine or the manual and the wiki instead of moaning how annoying and boring GNU Octave is.

SciTe and Python 3 - problems with configuration [UBUNTU]

I have big problem(s) with configuration of SciTE in context of Python 3. I do not know if details have any meaning, so:
[DETAILS]
I downloaded and executed gen_python_3_api.py.
I created folder "api" in usr/share/scite and copy-pasted there python3.api
I edited SciTEUser.properties as written in documentation of gen_python_3_api.py. It did not help a bit, so:
I used more general way found on website of SciTE. I edited python.properties and added a line:
api.$(file.patterns.py)=$(SciteDefaultHome)\api\python.api.
Still no effect.
I just edited another line of python.properties:
if PLAT_GTK
command.go.*.py=python3 -u "$(FileNameExt)"
It finally worked (or I though so).
[/DETAILS]
Now I want to run simple Fibbonaci program that worked well with IDLE.
def Fib(n):
a = 0
b = 1
FibL = []
for i in range (n):
FibL.append(a)
z = a
a = b
b = b+z
return FibL
n = int(input("Number? "))
print(Fib(n))
And I get:
>python3 -u "test.py"
Number? Traceback (most recent call last):
File "test.py", line 38, in <module>
n = int(input("Number? "))
EOFError: EOF when reading a line
>Exit code: 1
I am completely confused. Do somebody know why this things happen and how to fix it?
First of all, the generation of api is for editing only, not running your code.
Resolve the ambiguity with versions by adding full path to command lines (Hope, you do so in the 5th point of the question details)
The problem is in the line:
n = int(input("Number? "))
Here you want input from user, i.e. interactive running, but editor runs commands inside its process and can output simply.
Change your code by adding variable instead of the input command
n=5
or use parameters http://www.scintilla.org/SciTEDoc.html#property-if
Good luck!