Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to modify X axis units and start point on graphs #190

Open
kawalkQCWski opened this issue Jul 15, 2022 · 3 comments
Open

Unable to modify X axis units and start point on graphs #190

kawalkQCWski opened this issue Jul 15, 2022 · 3 comments
Assignees
Labels
Instruments Instruments section task
Milestone

Comments

@kawalkQCWski
Copy link

Current graph only allow for the x units to be in time units (s). Some instruments like spectrum analyzers, Vector network analyzers , frequency generators operate in Hz units . It would be very nice to have an option to switch between units on the X axis of graphs. This function will only be useful if additionally one can specify the start point. For example a vector network analyzer will never start at 0Hz but might start for example at 5MHz and provide data at fixed frequency points. The number of points vary : 51, 101, 201 , 401, 801, 1601 ..... preferred input would be Start frequency (Hz) , frequency step(Hz), Y values
Here is an example of a frequency response of a device measured by such a unit:

Screen capture

Here is what a graph of that data looks like in the current graphing application

graph working

here is Y data (401 points ) Start is 5MHz and End is 55MHz therefore the step size is (55-5)/(401-1)=0.125Mhz

Y values .txt

@kawalkQCWski
Copy link
Author

I was able to use the current graphing by padding my data to move it and my using ps=Hz ns=kHz us=MHz ms=GHz
Just changing the units would be 75% of the work

image

@kawalkQCWski
Copy link
Author

Current script to read data from 8714 and display it:
connection.acquire();

connection.command("FORMat ASCII, 6");

var StartF = await connection.query("SENSe1:FREQuency:STARt?");
var StopF = await connection.query("SENSe1:FREQuency:STOP?");
var PointsF = await connection.query("SENSe1:SWEep:POINts?");
var StepF = ((StopF-StartF)/(PointsF-1));
var dB_Char = ("CALCulate1:FORMat?");
var freq = []; 
var level = await connection.query("TRAC? CH1FDATA");
var level_array = level.split(',');
var pad = StartF/StepF;
let data = "";       
for (var k=0; k < pad; ++k){
    data += "-80" + "\n"; 
}
for (var i =0; i < PointsF; ++i){
    freq.push(StartF + i * StepF);
    data += level_array[i] + "\n";
}

 const description = "Frequency response";

const samplingRate = (1/StepF*1000000000000); // graph units of time seconds per division)

const offset = 0;//Y offset
const scale = 1;//Y muliplier

const unit = "decibel"; // voltage, current, power, decibel

const color = "yellow"; //color of trend
const colorInverse = "red";

const label = "Watchout ! 1us=1Mhz, 1ms = 1GHz";

const timeScale =StopF/10000000000000; //number s on screen
const channelScale = 10
session.addChart({
description,
data,
samplingRate,
offset,
scale,
format: 4, // CSV string
unit,
color,
colorInverse,
label,
viewOptions: {
axesLines: {
type: "fixed",
majorSubdivision: {
horizontal:10,
vertical: 10
},
minorSubdivision: {
horizontal: 5,
vertical: 5
}
}
},
horizontalScale: timeScale,
verticalScale: channelScale
});

connection.release();

@kawalkQCWski
Copy link
Author

Is there a way to get to display Hz in the X axis and can the axis start from the first data point instead of 0?

@mvladic mvladic added this to the M15 milestone Jun 12, 2023
@mvladic mvladic modified the milestones: M15, M16 Jun 30, 2023
@mvladic mvladic modified the milestones: M16, M17 Jul 27, 2023
@mvladic mvladic modified the milestones: M17, v1.0 Sep 3, 2023
@prasimix prasimix added the Instruments Instruments section label Sep 5, 2023
@prasimix prasimix modified the milestones: v1.0, M23 Sep 6, 2024
@mvladic mvladic modified the milestones: M23, v1.0 Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Instruments Instruments section task
Projects
None yet
Development

No branches or pull requests

3 participants