Skip to content

Commit 55559cc

Browse files
authored
Merge branch 'develop' into feature/dwyban/curvestream-example-complete-code
2 parents cb322b7 + 3ba579f commit 55559cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3555
-16
lines changed

.travis.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1+
---
12
language: go
23
go:
3-
- "1.12.x"
4+
- "1.13.x"
45

56
git:
6-
depth: 1
7+
depth: 1
78

89
branches:
9-
only:
10-
- master
10+
only:
11+
- master
1112

1213
notifications:
13-
slack: tek-oso:tBStikUyvah8EOPb8QY7VWvS
14+
slack: tek-oso:tBStikUyvah8EOPb8QY7VWvS
1415

1516
before_install:
16-
- go get -u github.com/raviqqe/liche
17+
- GO111MODULE=on GOPROXY=direct go get github.com/nlynchjo/liche
1718

1819
script:
1920
- liche -v -t 60 -r .
20-
Loading

Spectrum_Analyzers/README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
# Spectrum Analyzers
2-
RSA300/500/600 & RSA5000/6000 Series
2+
RSA300/500/600 & RSA5000/6000 Series
33

44
## Directory
55
### RSA300/500/600/5000/6000 examples
6-
* **[DPX Plot Example](./src/DPXPlotExample)** [![MATLAB](https://img.shields.io/badge/-MATLAB-&?labelColor=3E434A&colorB=F05A22&logo=Mathworks)](https://www.mathworks.com/products/matlab.html?s_tid=hp_products_matlab)
6+
* **[DPX Plot Example](./DPXPlotExample)** [![MATLAB](https://img.shields.io/badge/-MATLAB-&?labelColor=3E434A&colorB=F05A22&logo=Mathworks)](https://www.mathworks.com/products/matlab.html?s_tid=hp_products_matlab)
77

88
### RSA3000B examples
9-
* **[Basic get spectrum data example](./src/GetSpectrumDataExample)** [![Python 3.6](https://img.shields.io/badge/python-3.6-&?labelColor=006281&colorB=3E434A&logo=python)](https://www.python.org/downloads/release/python-360/)
9+
10+
* **[Basic get spectrum data example](./GetSpectrumDataExample)** [![Python 3.6](https://img.shields.io/badge/python-3.6-&?labelColor=006281&colorB=3E434A&logo=python)](https://www.python.org/downloads/release/python-360/)
1011

1112

1213
### RSA5100/6100 examples
13-
* **[SignalVu Example C++](./src/SignalVuExamples/C++)** [![CPlusPlus](https://img.shields.io/badge/C-C++-&?labelColor=3E434A&colorB=006281&logo=cplusplus)](https://isocpp.org/)
14+
* **[SignalVu Example C++](./SignalVuExamples/C++)** [![CPlusPlus](https://img.shields.io/badge/C-C++-&?labelColor=3E434A&colorB=006281&logo=cplusplus)](https://isocpp.org/)
1415

15-
* **[SignalVu Example MATLAB](./src/SignalVuExamples/MATLAB)** [![MATLAB](https://img.shields.io/badge/-MATLAB-&?labelColor=3E434A&colorB=F05A22&logo=Mathworks)](https://www.mathworks.com/products/matlab.html?s_tid=hp_products_matlab)
16+
* **[SignalVu Example MATLAB](./SignalVuExamples/MATLAB)** [![MATLAB](https://img.shields.io/badge/-MATLAB-&?labelColor=3E434A&colorB=F05A22&logo=Mathworks)](https://www.mathworks.com/products/matlab.html?s_tid=hp_products_matlab)
1617

17-
* **[SignalVu Example Python](./src/SignalVuExamples/python)** [![Python 3.6](https://img.shields.io/badge/python-3.6-&?labelColor=006281&colorB=3E434A&logo=python)](https://www.python.org/downloads/release/python-360/)
18+
* **[SignalVu Example Python](./SignalVuExamples/python)** [![Python 3.6](https://img.shields.io/badge/python-3.6-&?labelColor=006281&colorB=3E434A&logo=python)](https://www.python.org/downloads/release/python-360/)
1819

19-
* **[SignalVu Example .NET](./src/SignalVuExamples/dotNet)** [![dotNet](https://img.shields.io/badge/Microsoft-.Net-&?labelColor=73BF44&colorB=3E434A&logo=.net)](https://dotnet.microsoft.com/)
20+
* **[SignalVu Example .NET](./SignalVuExamples/dotNet)** [![dotNet](https://img.shields.io/badge/Microsoft-.Net-&?labelColor=73BF44&colorB=3E434A&logo=.net)](https://dotnet.microsoft.com/)
2021

2122
----
2223
* **[Back to Home Page](./../README.md)**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<PropertyGroup Label="Globals">
14+
<ProjectGuid>{5E359A04-BC91-4B62-9A67-CAFA5123FAA5}</ProjectGuid>
15+
<RootNamespace>RSASVPCVISAControl</RootNamespace>
16+
</PropertyGroup>
17+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
18+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
19+
<ConfigurationType>Application</ConfigurationType>
20+
<UseDebugLibraries>true</UseDebugLibraries>
21+
<PlatformToolset>v120</PlatformToolset>
22+
<CharacterSet>MultiByte</CharacterSet>
23+
</PropertyGroup>
24+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
25+
<ConfigurationType>Application</ConfigurationType>
26+
<UseDebugLibraries>false</UseDebugLibraries>
27+
<PlatformToolset>v120</PlatformToolset>
28+
<WholeProgramOptimization>true</WholeProgramOptimization>
29+
<CharacterSet>MultiByte</CharacterSet>
30+
</PropertyGroup>
31+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
32+
<ImportGroup Label="ExtensionSettings">
33+
</ImportGroup>
34+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
35+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
36+
</ImportGroup>
37+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
38+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
39+
</ImportGroup>
40+
<PropertyGroup Label="UserMacros" />
41+
<PropertyGroup />
42+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
43+
<ClCompile>
44+
<WarningLevel>Level3</WarningLevel>
45+
<Optimization>Disabled</Optimization>
46+
<SDLCheck>true</SDLCheck>
47+
<AdditionalIncludeDirectories>C:\Program Files (x86)\IVI Foundation\VISA\WinNT\include</AdditionalIncludeDirectories>
48+
</ClCompile>
49+
<Link>
50+
<GenerateDebugInformation>true</GenerateDebugInformation>
51+
<AdditionalLibraryDirectories>"C:\Program Files (x86)\IVI Foundation\VISA\WInNT\lib\msc"</AdditionalLibraryDirectories>
52+
<AdditionalDependencies>visa32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
53+
</Link>
54+
</ItemDefinitionGroup>
55+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
56+
<ClCompile>
57+
<WarningLevel>Level3</WarningLevel>
58+
<Optimization>MaxSpeed</Optimization>
59+
<FunctionLevelLinking>true</FunctionLevelLinking>
60+
<IntrinsicFunctions>true</IntrinsicFunctions>
61+
<SDLCheck>true</SDLCheck>
62+
</ClCompile>
63+
<Link>
64+
<GenerateDebugInformation>true</GenerateDebugInformation>
65+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
66+
<OptimizeReferences>true</OptimizeReferences>
67+
</Link>
68+
</ItemDefinitionGroup>
69+
<ItemGroup>
70+
<ClCompile Include="main.cpp" />
71+
</ItemGroup>
72+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
73+
<ImportGroup Label="ExtensionTargets">
74+
</ImportGroup>
75+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="main.cpp">
19+
<Filter>Source Files</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#include <stdio.h>
2+
#include <Windows.h>
3+
#include "visa.h"
4+
5+
#define _CRT_SECURE_NO_WARNINGS
6+
#define BUFFER 255
7+
8+
static ViSession defaultRM, vi;
9+
static ViStatus status;
10+
static unsigned char strCmd[256], strReply[256];
11+
static ViUInt32 retCnt;
12+
13+
int main()
14+
{
15+
//VISA Session Setup
16+
status = viOpenDefaultRM(&defaultRM);
17+
if (status < VI_SUCCESS) goto Error;
18+
19+
status = viOpen(defaultRM, "GPIB8::1::INSTR", VI_NULL, 100000, &vi);
20+
if (status < VI_SUCCESS) goto Error;
21+
22+
//Sending Reset and Identification Commands
23+
sprintf_s((char*)strCmd, 6, "*RST\n");
24+
status = viWrite(vi, strCmd, strlen((char*)strCmd), &retCnt);
25+
if (status < VI_SUCCESS) goto Error;
26+
27+
sprintf_s((char*)strCmd, 7, "*IDN?\n");
28+
status = viWrite(vi, strCmd, strlen((char*)strCmd), &retCnt);
29+
if (status < VI_SUCCESS) goto Error;
30+
status = viRead(vi, strReply, 255, &retCnt);
31+
if (status < VI_SUCCESS) goto Error;
32+
33+
// viRead() writes into the string only the data read from the instrument
34+
// therefore you need to NULL terminate the strings manually.
35+
strReply[retCnt] = 0;
36+
puts((char*)strReply);
37+
38+
//General Setup
39+
sprintf_s((char*)strCmd, BUFFER, "display:general:measview:new toverview\n");
40+
status = viWrite(vi, strCmd, strlen((char*)strCmd), &retCnt);
41+
if (status < VI_SUCCESS) goto Error;
42+
43+
sprintf_s((char*)strCmd, BUFFER, "display:general:measview:new avtime\n");
44+
status = viWrite(vi, strCmd, strlen((char*)strCmd), &retCnt);
45+
if (status < VI_SUCCESS) goto Error;
46+
47+
double cf = 2.4453e9;
48+
sprintf_s((char*)strCmd, BUFFER, "spectrum:frequency:center %f\n", cf);
49+
status = viWrite(vi, strCmd, strlen((char*)strCmd), &retCnt);
50+
if (status < VI_SUCCESS) goto Error;
51+
52+
double refLevel = 0;
53+
sprintf_s((char*)strCmd, BUFFER, "input:rlevel %f\n", refLevel);
54+
status = viWrite(vi, strCmd, strlen((char*)strCmd), &retCnt);
55+
if (status < VI_SUCCESS) goto Error;
56+
57+
double aLength = 100e-6;
58+
sprintf_s((char*)strCmd, BUFFER, "sense:analysis:length %f\n", aLength);
59+
status = viWrite(vi, strCmd, strlen((char*)strCmd), &retCnt);
60+
if (status < VI_SUCCESS) goto Error;
61+
62+
//Start Acquisition
63+
sprintf_s((char*)strCmd, BUFFER, "initiate:continuous off\n");
64+
status = viWrite(vi, strCmd, strlen((char*)strCmd), &retCnt);
65+
if (status < VI_SUCCESS) goto Error;
66+
67+
sprintf_s((char*)strCmd, BUFFER, "initiate:immediate\n");
68+
status = viWrite(vi, strCmd, strlen((char*)strCmd), &retCnt);
69+
if (status < VI_SUCCESS) goto Error;
70+
71+
72+
Error:
73+
if (status < VI_SUCCESS)
74+
{
75+
viStatusDesc(vi, status, (char*)strReply);
76+
printf("VISA Error Occured:\r\n%s", strReply);
77+
}
78+
if (vi != VI_NULL) viClose(vi);
79+
if (defaultRM != VI_NULL) viClose(defaultRM);
80+
81+
printf("\r\nPress any key to continue ...");
82+
getchar();
83+
return 0;
84+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function findpeakslider2(n,h)
2+
% Changes AmpThreshold when the AmpThreshold slider is moved.
3+
global x
4+
global y
5+
global SlopeThreshold
6+
global AmpThreshold
7+
global SmoothWidth
8+
global FitWidth
9+
global P
10+
global PeakNumber
11+
AmpThreshold=n;
12+
if PeakNumber==0,
13+
P=findpeakslidersRedraw(x,y,SlopeThreshold,AmpThreshold,SmoothWidth,FitWidth);
14+
else
15+
RedrawPeak
16+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function findpeakslider6(n,h)
2+
% Called when the BG slider is clicked.
3+
4+
global x
5+
global y
6+
global SlopeThreshold
7+
global AmpThreshold
8+
global SmoothWidth
9+
global FitWidth
10+
global P
11+
global PeakNumber
12+
13+
warning off MATLAB:divideByZero
14+
15+
BaselinePoints=5; % Change as you wish
16+
17+
% Acquire background points from user mouse clicks
18+
title(['Click on ' num2str(BaselinePoints) ' points on the baseline between the peaks.'])
19+
X=[];Y=[];
20+
for g=1:BaselinePoints;
21+
[clickX,clickY] = GINPUT(1);
22+
X(g)=clickX;
23+
Y(g)=clickY;
24+
xlabel(['Baseline point ' num2str(g) ])
25+
end
26+
yy=y;
27+
for k=1:length(X)-1,
28+
fp=val2ind(x,X(k));
29+
lp=val2ind(x,X(k+1));
30+
yy(fp:lp)=y(fp:lp)-((Y(k+1)-Y(k))/(X(k+1)-X(k))*(x(fp:lp)-X(k))+Y(k));
31+
end
32+
y=yy;
33+
if PeakNumber==0,
34+
P=findpeakslidersRedraw(x,y,SlopeThreshold,AmpThreshold,SmoothWidth,FitWidth);
35+
else
36+
RedrawPeak
37+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
% A simple self-contained demonstration of the findpeak function (line 48)
2+
% applied to noisy synthetic data set consisting of a random number of narrow
3+
% peaks. Each time you run this, a different set of peaks is generated.
4+
% The 4 adjustable parameters (in lines 40 - 43) are:
5+
% SlopeThreshold - Slope of the smoothed third-derivative that is taken
6+
% to indicate a peak. Larger values will neglect small features.
7+
% AmpThreshold - Any peaks with height less than AmpThreshold are ignored.
8+
% SmoothWidth - Width of smooth functions applied to data before slope is
9+
% measured. Larger values will neglect small features. A reasonable value is
10+
% about equal to 1/2 the width of the peaks.
11+
% FitWidth - The number of points around the "top part" of the (unsmoothed)
12+
% peak that are taken to determine the peak height, positions, and width.
13+
% A reasonable value is about equal to 1/2 the width of the peaks.
14+
% Tom O'Haver ([email protected]). Version 1.6 October 26, 2006
15+
16+
format compact
17+
figure(1);clf
18+
19+
% Generate synthetic signal
20+
increment=.2; % Increment between adjacent values of x.
21+
x=[1:increment:400];
22+
% For each simulated peak, enter the amplitude, position, and width below
23+
amp=randn(1,38); % Amplitudes of the peaks
24+
pos=[10:10:380]; % Positions of the peaks
25+
wid=5.*ones(size(pos)); % Widths of the peaks
26+
Noise=.01;
27+
% A = matrix containing one of the unit-amplidude peak in each of its srow
28+
A = zeros(length(pos),length(x));
29+
for k=1:length(pos)
30+
if amp(k)>0, A(k,:)=gaussian(x,pos(k),wid(k)); end; % Or you can use any other peak function
31+
end
32+
z=amp*A; % Multiplies each row by the corresponding amplitude and adds them up
33+
y=z+Noise.*randn(size(z)); % Add random noise
34+
35+
figure(1);plot(x,y,'r') % Graph the signal in red
36+
title('Detected peaks are numbered. Peak table is printed in Command Window')
37+
38+
% Initial values of variable parameters
39+
WidthPoints=mean(wid)/increment; % Average number of points in half-width of peaks
40+
SlopeThreshold=0.5*WidthPoints^-2; % Formula for estimating value of SlopeThreshold
41+
AmpThreshold=0.05*max(y);
42+
SmoothWidth=round(WidthPoints/2); % SmoothWidth should be roughly equal to 1/2 the peak width (in points)
43+
FitWidth=round(WidthPoints/2); % FitWidth should be roughly equal to 1/2 the peak widths(in points)
44+
45+
% Lavel the x-axis with the parameter values
46+
xlabel(['SlopeThresh. = ' num2str(SlopeThreshold) ' AmpThresh. = ' num2str(AmpThreshold) ' SmoothWidth = ' num2str(SmoothWidth) ' FitWidth = ' num2str(FitWidth) ])
47+
48+
% Find the peaks
49+
start=cputime;
50+
P=findpeaks(x,y,SlopeThreshold,AmpThreshold,SmoothWidth,FitWidth);
51+
ElapsedTime=cputime-start
52+
53+
% Display results
54+
' Peak # Position Height Width'
55+
P % Display table of peaks
56+
figure(1);text(P(:, 2),P(:, 3),num2str(P(:,1))) % Number the peaks found on the graph

0 commit comments

Comments
 (0)