07-21-2020 12:14 PM
Hello I'm using Labview 2020 to collect data from an STS Ocean Insight Spectrometer and I could use some help applying some filters to the result spectra. The spectrometer outputs two arrays, one for the wavelengths detected and one for the intensity of those wavelengths, these I can then bundle and display on an XY Graph.
There are two things I would like to be able to do:
I know how to write these parameters in C++ but I don't know how I would apply it to Labview. In C++ it would look something like this:
int i;
int min_wave, max_wave, min_int; //Wavelength Ranges and Intensity Threshold
double i_int[1025]; //Array with initial intensity values
double f_int[1025]; //Array with final intensity values
double wavelengths[1025]; //Array with detected wavelengths
int main
{
for (i = 0; i < 1025; i++) //Loop through wavelength and intensity arrays, these have a max size of 1025 elements
{
if (i_int[i] < min_int || wavelengths[i] < min_wave || wavelengths[i] > max_wave) //If intensity is less than min. intensity or wavelength is outside the range of wavelengths chosen, intensity is set to 0
{
f_int[i] = 0;
}
else //Keep intesnity value if it passes both filters
{
f_int[i] = i_int[i];
}
}
}
I would like to put it into the formula node in the vi I attached but I'm not familiar enough with the syntax for it. Also if it's easier to do without a formula node I'd welcome any suggestion with regards to that too.
Solved! Go to Solution.
07-21-2020 01:08 PM
This is all you need:
In general, it's better practice to simply not graph points you don't want to see, rather than set their y value to 0. So that's how I coded it, take the full set of data and filter out any data that is 1) outside the wavelength limits, and 2) beneath the minimum intensity threshold.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
07-22-2020 12:55 AM
Hi,
@FireFist-Redhawk wrote:
In general, it's better practice to simply not graph points you don't want to see, rather than set their y value to 0.
Replace those "don't want to see" points by NaN (instead of zero)!
07-22-2020 11:48 AM - edited 07-22-2020 11:53 AM
Hi thanks for the reply, I understand your what you're saying about not plotting the points I want ignored and normally thats what I would do. But since this is a graph of a spectrum of light I would prefer to zero the unwanted signals as opposed to not plotting them, both from a practical sense as well as an aesthetic one. I won't lie, I find the zeroed out graph much nicer to look at than the one with most of the points missing.
Original
Points not Plotted
Replaced with 0