Jump to content
  • 0

Measurement script


KIS

Question

5 answers to this question

Recommended Posts

  • 0

Hi @KIS

It is easier to write and print multiple measurements in Script tool. 
This code is working only for one pulse. You may need to use a bit higher value than low... 

image.png.dfe99aa7dc5ded4381a4d64dac0c5ed4.png

Channel = Scope.Channel1
Time = Scope.Time

data = Channel.visibledata
cnt = data.length
imax1 = 0
imax2 = 0
max = -1e6
for(var i = 0; i < cnt; i++){
    v = data[i]
    if(max==v){
        imax2 = i
    }else if(max<v){
        max = v
        imax1 = imax2 = i
    }
}
low = Channel.measure("Low")
imax = (imax1+imax2)/2

istart = imax;
while(istart>0 && data[istart]>low) istart--

iend = imax
while(iend<cnt && data[iend]>low) iend++

print("low:",low, "max:",max, "istart:",istart, "imax:",imax, "iend",iend)
print("max at:",Channel.TimeOfVisibleIndex(imax), "dRise:",(imax-istart)/Time.Rate.real, "dFall:",(iend-imax)/Time.Rate.real)

 

You could split it in different measurement(s) like this:

image.png.4f217bc4977d9f9ed6bea9dd6f7692e2.png

data = Channel.visibledata
cnt = data.length
imax1 = 0
imax2 = 0
max = -1e6
for(var i = 0; i < cnt; i++){
    v = data[i]
    if(max==v){
        imax2 = i
    }else if(max<v){
        max = v
        imax1 = imax2 = i
    }
}
low = Channel.measure("Low")
imax = (imax1+imax2)/2

istart = imax;
while(istart>0 && data[istart]>low) istart--

iend = imax
while(iend<cnt && data[iend]>low) iend++

100.0*(imax-istart)/(iend-istart)

 

 

 

Edited by attila
Link to comment
Share on other sites

  • 0

Measurement has to be done very accurately as its values and results are responsible for major decision making activities. While writing any measurement script it is very important to understand what is the process and goal of the measurement.

A particular measurement tool is a scientific instrument that is used to monitor and observe the different attribution of the object. 

Before start creating any measurement script it will be a great idea to understand the few basics of measurement.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...