Jump to content
  • 0

How to write script code setting Harmonics, Aias , Excursion of Measurements Option in Spectrum Analyzer?


AlexMark6

Question

I am writing Analog Discovery 2 script to develop semi automatic spectrum analyzing measurement.

To specialize measurement condition, I want to set Spectrum Analyzer's Measurement Option parameter such as "Harmonics", "Alias", "Excursion".

I checked the Help menu about it, but it seems there is no way to set these parameters by script.

Does anyone know the way to set these parameters by script?

AD2_Spectrum.jpg

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

try these script lines:

clear() // clear the output window

Spectrum.Measure.Harmonics.value = 15;

Spectrum.Measure.Alias.toggle();

print(Spectrum.Measure.Alias.preset);

print(Spectrum.Measure.Alias.text);

Spectrum.Measure.Alias.checked = "on";

Spectrum.Measure.Alias.setChecked();

Spectrum.Measure.Alias.setUnchecked();

print(Spectrum.Measure.Alias.text);

print( Spectrum.Measure.Excursion.text);

print( Spectrum.Measure.Excursion.value);

Spectrum.Measure.Excursion.value = 5;

Link to comment
Share on other sites

  • 0

click the Help tab, then script  on the left pane.
I think the setting (or getting) method in general is not eplicitely explained.
The scripting language is JavaScript, based on the ECMAScript, ECMA-262 standard.
In the "4. Code" section this Help tab many parameters are explained, but I think not all - and not your reqested ones:
... The instrument's object can be accessed from the script and has the most relevant child objects and parameters shown in the table below.
The instrument parameters are stored in objects with the following properties:
text: text representation of parameter.
value: index of discrete setting (like mode: None, Auto, Normal) or value expressed in units.
preset: list of discrete settings or nice value steps.
real: available for some parameters, returns the actual value regarding the capture like the full voltage range...
These objects seems to exist for all parameters and the manipulating methods are the same as already shown.
Use Ctrl+Space in the script editing pane to show possible parameters (or more and more parameters are explained by mouse hoovering on it)
and code with trial and error ! Print he preset object in this case is often a good idea and /or
also look for the examples section in the help tab or open examples in the script tool tab.

Link to comment
Share on other sites

  • 0

Hi Rolf

Thank you very much  for your answer.

I understand that not all command is described in help section.

I will try to get the right command as above samples you reply this time.

If I can not find the answer let me ask in this forum to you and other person.

Best regards.

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...