Passing taps to the filter using file in gnuradio - gnuradio

I'm trying to pass 2000 taps to the fft filter in gnuradio. How can i read file and pass it to the fft filter tap filed?

This cannot be done. However you can use the Filter Taps variables available in the GRC to produce the desired taps at the initialization of your flowgraph. Pass the ID of the variable at the taps field of your FFT filter block and you are done.
If your taps are very specific and cannot be constructed from the available filter taps variable, you could possibly edit the generated python file and use a python array to store them.
EDIT: As #Marcus noted you can use numpy to load taps from a file. Just use the Import element from the GRC to import numpy and then using a Variable element, use numpy.fromfile('filename') to load the desired taps.

I had good luck with this:
in Matlab create your vector of taps
if h is your vector with the taps, print them to a file with these instructions:
fileID = fopen('filter_taps.txt', 'w');`
fprintf(fileID, '[%5.3f]+', h);
fclose(fileID);
open the text file with a simple text editor and remove the last "+"
Now, go over to the gnuradio-companion and open an Interpolating FIR filter block
highlight and copy the taps from your text file [0.00]+[0.01]+... etc (I used control+c)
in the "taps" field of the GRC FIR block, paste the taps (I used control+v)
Disclosure: I run Matlab on my Windows laptop, and I run GRC on my Linux (Ubuntu) laptop.

Related

LabVIEW - can you use a numeric control as an indicator

I've written LabView code for a locking system.
The lock has a motion timer that relies on input from a numeric control. I've added a script file reader that needs to be able to change that timer value. Using a selector, I can switch between values, but I'd like it to update the value in the control, rather than override it, so that I can see it on the screen.
How can this be accomplished?
This is currently how I switch between the scripted version and the direct numeric input from the control:
So how can I get the script value to update the control box or is that not possible...?
Do you mean something like this? I created a little vi to demonstrate how the control is updated.
In most cases "property nodes" are the way to go. Every control has a lot of different options to chose from and usually if you look through the properties you will find what you're looking for :)
A little hint:
If you want to add "code" to your question so that other users can test it, you can create a .png file. To do this, you need to select the parts of the vi that you want to share, and click on "Edit > Create VI Snippet from Selection". Then you save that generated .png and upload it here as a picture. Then others can drag&drop it into their block diagram.
Important: Check the .png before uploading and make sure that you're not accidentally posting sensitive data of your company.

Is there a method for script file loading control in labview?

first, I cannot attach my vi files, sorry. I'm not allowed, but I can attach snippets.
I've got a vi that opens and executes functions from a script file, and I'd like to be able to continuously click a button to reload the script file without having to restart the program. Currently the script file commands sit outside my main while loop and and uses a case statement to put the system in idle mode (manual control) when the button is not depressed before launching the program, or if it is, it will instantly open a dialog box looking for a script file upon program launch. I'd like to be able to open a script file numerous times during the execution of my program, but don't fully understand how, and this may be my own misunderstanding of what's going on with the code if I move it inside the main while loop. how is this best accomplished?
If you put your code outside of the loop, it is only executed once (very important: "dataflow"). You need to put the code into a loop to execute it multiple times.
You can insert the vi-snippet into your vi by drag&drop.
My vi contains two different options. You can change the vi as you need it, my vi is incomplete. I inserted a simple 2D-Array because I'm not sure if the vi you use after building the path is selfmade or given by LabVIEW.
For both options you should let the code run in some kind of state machine and use an Event Structure (I think you already implemented your program this way since you wrote about a main loop).
Version 1:
Everytime you click the button, the event is triggered and the code inside the event structure is executed.
Version 2:
Here you set a boolean if the button is pressed and handle the event with that value.
Since you wrote that you already have a main while loop, this option might be better four you. The first loop would be your main-loop, second one would be the loop in Version 2. You just need to add another case for the script to be loaded in.
VI:
I hope this is helpful for your problem.
Feel free to ask if you need more help or if you have any questions :)

Objective C: Pass Result from Popup Window Back To Calling Class

I'm writing a very simple Mac OS app to parse a text only video EDL (edit decision list) and pull out locators (or 'markers' if you're familiar with Apple's FCP nomenclature) and add them to a new NSMutableArray to be displayed in an NSTableView.
All of this works perfectly, resulting in something similar to the following image for my test EDL:
My ultimate goal is to further process this list and reduce it to only those markers which contain a video effect (VFX) name. Those are the RED markers in my sample. I want to be able to open a very simple pop-up window asking which color represents the VFX (again, RED in this case) so I can simply iterate thru the array and print those locators only.
I've created a new window and window controller to open the following window:
This works great, and I can use an NSLog within my new window controller class to display my typed responses.
The question then is: how do I pass my typed response back to my calling class, and then execute a new method to use this response for further processing of my array?
As it is now, when I hit the 'OK' button, it executes a method (in my new window controller class) which assigns the text in my NSTextField to a new NSString. But how can I then ALSO pass that variable back AND execute another method in the original calling class which holds my EDL array?
I'm sorry for the newbie question, and I'm not asking somebody to actually write code for me, but I don't even know what to look for in the manuals to study up on this. I'm a video editor first and a coder only as a hobby, so go easy on me please.
Thank you, btw, to Phillip Mills for helping me get as far as I have with the TableView.

How can i automate my computer?

On windows 10.
I need to automate the repeated process of these steps.
1. Open up an image in GIMP. Scale it to 110%.
2. Export as somefile name(for example input001.jpg).
3. Go to http://deepdreamgenerator.com/ in a browser. click on button, browse to the exported file.
4. Wait for it to generate result, save image as result file (for example dream001.jpg).
then repeat from step 1 with the result file from step 4...but keep increasing the filename number so export it as input002.jpg...
What software would allow me to do this?
the only software i know of that * MIGHT * be able to automate that process is AutoHotKey
You would need to keep the windows which you're automating static (ie. make sure they don't move) and then write keyboard and mouse macros in autohotkey to press the buttons and do the things you want.
I tried AutoHotKey but didn't feel like learning a whole new scripting language so I found something simpler called GhostMouse.
It just has record,play,stop buttons.
after recording and closing out of program it asks if i want to save script. clicked yes gave it a name, and then edited the script file..and copied and pasted as many times as i wanted the script to run (before copying and pasting i deleted the last 3 lines which has to do with clicking the stop button which i didn't want the script to do).
You can also try Sikuli for same. It's an image comparator
http://www.sikuli.org/
Reference :-
http://doc.sikuli.org/tutorials/

Obtain mouse position in OCTAVE

I am using OCTAVE on my PC for image processing and display. I am reading in a .pgl file and converting it from rgb to gray to obtain a simple 2D array. I then display this using imagesc(). What I'd like to do is use the mouse to click on a particular part of the image and return where the mouse was clicked in the array ((x,y) coordinates). I've tried using ginput() which I think should work if I understand the documentation correctly. But I can't get it to work. Usually I have to control C out once I type in [x,y] = ginput(1), for example, because the prompt never returns in my input window no matter how many mouse clicks I do in the display (or returns in the input window - I have to control C out). First is this do-able? or am I attempting something OCTAVE just can't do? If so, how?
This should work with ginput and the FLTK toolkit. What version of Octave are you using on which OS? To make sure you are using FLTK toolkit use
close all
graphics_toolkit fltk
at the beginning of your script.
The thing to remember with ginput() is that after clicking with the mouse in the plot window, you have to hit return key on the keyboard if the n parameter is not stated. After the return, the coordinates will be returned in the x,y vars. Also the button used to click will be returned when called with [x,y,buttons]=ginput(n). The 'n' argument controls the number of clicks to watch for before recording the coords. Works well in Octave 4.0.1.