Anritsu Vector Network Analyzer MS2760A module

Created on Wed Dec 1 13:11:32 2021

@author: Martin.Mihaylov

class MS2760A.MS2760A(resource_str)[source]

Bases: object

This function is using pyvisa to connect to Instruments. Please install PyVisa before using it.

Close()[source]
ExtractTtraceData(value)[source]
Parameters:
  • value (int)

  • function (!!!!!USE IT AT YOUR OWN RISK is not an official) –

    Trace Number from which the data is taken:

    Can be set to [1,2,3,4,5,6].

    1 - This Function will set the continues Measurement to ‘OFF’. 2 - Will set the Data Format to ASCii. This is needed since :TREACE:DATA? <num> is defect!! 3 - Will write TRACE:DATA? <num>. Will return only 3 bits. The rest will be packed in the next command asked. 4 - Will ask for the Data Format. This is dummy command that will have the data and the Data Format. 5 - Make manupulations to separate the actual data from the rest and return the data in Output np.array() form.

  • workaround!!!!! (but a) –

    Trace Number from which the data is taken:

    Can be set to [1,2,3,4,5,6].

    1 - This Function will set the continues Measurement to ‘OFF’. 2 - Will set the Data Format to ASCii. This is needed since :TREACE:DATA? <num> is defect!! 3 - Will write TRACE:DATA? <num>. Will return only 3 bits. The rest will be packed in the next command asked. 4 - Will ask for the Data Format. This is dummy command that will have the data and the Data Format. 5 - Make manupulations to separate the actual data from the rest and return the data in Output np.array() form.

Returns:

Output – DESCRIPTION.

Return type:

TYPE

Init()[source]
Returns:

Initialize meas

Return type:

None.

OPC()[source]
Returns:

Places a “1” into the output queue when all device operations have been completed

Return type:

TYPE str

abort()[source]

Description: Resets the trigger system. This has the effect of aborting the sweep or any measurement that is currently in progress. Additionally, any pending operation flags that were set by initiation of the trigger system will be set to false. If :INITiate:CONTinuous is OFF (i.e. the instrument is in single sweep mode), send the command :INITiate[:IMMediate] to trigger the next sweep. If :INITiate:CONTinuous is ON (i.e. the instrument is in continuous sweep mode) a new sweep will start immediately

ask_CHPowerState(state)[source]
Parameters:

state (str/int) – Channel Power State Sets the state of the channel power measurement, ON or OFF. When using :CONFigure:CHPower,the state is automatically set to ON state = [‘ON’,’OFF’,1,0]

Returns:

State ON or OFF

Return type:

str

ask_CenterFreq()[source]
Returns:

Query the Central Frequency Numeric (Hz)

Return type:

TYPE float

ask_Configuration()[source]
Returns:

Title: Option Configuration Description: This command returns a quoted string of characters readable only by Anritsu Customer Service. Only instrument configuration information is returned. No setup information is included.

Return type:

TYPE str

ask_DataFormat()[source]
Returns:

Query the data format

Return type:

TYPE str

ask_DataPointCount()[source]
Returns:

Query the data point count. Title: Display Point Count Query Return: Numeric

Return type:

TYPE str

ask_FreqSpan()[source]
Returns:

Query the Frequency Span Numeric (Hz)

Return type:

TYPE float

ask_MarkerExcursion()[source]
Returns:

Query the excursion for a marker. The excursion is the vertical distance from the peak to the next highest valley which must be exceeded for a peak to be considered a peak in marker max commands

Return type:

TYPE str

ask_MarkerExcursionState()[source]
Returns:

Turn on/off excursion checking for marker max commands

Return type:

str

ask_ResBwidth()[source]
Returns:

Ask the resolution bandwidth. Query Return: Numeric (Hz)

Return type:

TYPE str

ask_ResBwidthAuto()[source]
Returns:

val – Query the resolution bandwidth. Defaoulf: ON

Return type:

str

ask_SingleOrContinuesMeas()[source]
Returns:

data – The query version of the command returns a 1 if the instrument is continuously sweeping/measuring and returns a 0 if the instrument is in single sweep/measurement mode.

Return type:

str

ask_TraceData(traceNumber)[source]

!!!!!DONT USE IT!!!!!

Parameters:

traceNumber (int) – Description: This command transfers trace data from the instrument to the controller. Data are transferred from the instrument as an IEEE definite length arbitrary block response, which has the form <header><block>.

Returns:

Trace Data

Return type:

TYPE str

ask_TraceSelected()[source]
Returns:

Query selected trace will be used by operations that use a single trace. The max number of traces available to select is model specific

Return type:

TYPE str

ask_TraceState(number)[source]
Parameters:

number (int) –

Description: The trace visibility state. If it is OFF, the :TRAC:DATA? command will return nan. Trace Number:

int. [1,2,3,4,5,6]

Raises:

ValueError – Error message

Returns:

State ON or OFF

Return type:

str

ask_TraceType(number)[source]
Parameters:

number (int) – Specifies how successive sweeps are combined to produce the resulting display value. Setting the TYPE to NORMal will cause the displayed value for a point to be the current measured value for that point. Setting the TYPE to AVERage will cause the displayed value for a point to be the average of the last <integer> measured values where <integer> is set by [:SENSe]:AVERage:COUNt. Setting the TYPE to MAXimum will cause the displayed value for a point is the maximum measured value for that point over sweeps. Setting the TYPE to MINimum will cause the displayed value for a point is the minimum measured value for that point over sweeps.Setting the TYPE to RMAXimum will cause the displayed value for a point to be the maximum of the last <integer> measured values where <integer> is set by [:SENSe]:AVERage:COUNt.Setting the TYPE to RMINimum will cause the displayed value for a point to be the minimum of the last <integer> measured values where <integer> is set by [:SENSe]:AVERage:COUNt. This command will be ignored when spectrogram is disabled by DISPlay:VIEW.

Raises:

ValueError – Error message

Returns:

Query Return: NORM|MIN|MAX|AVER|RMAX|RMIN|RAV

Return type:

TYPE str

ask_freq_Start()[source]
Returns:

Query return set start Frequency. Numeric (Hz)

Return type:

TYPE str

ask_freq_Stop()[source]
Returns:

Query return set stop Frequency. Numeric (Hz)

Return type:

TYPE str

ask_sweepTime()[source]
Returns:

Title: Measured Sweep Time Description: This command queries the measured sweep time, in number of milliseconds. This command will return “nan” if no measured sweep time is available, which happens if the sweep was reset and the instrument has not yet swept enough to measure a full sweep.

Return type:

TYPE str

get_Data()[source]

This function will stop temporally set Continuous Measurement to OFF, extract the max. peak value and frequency and restore the Continuous Measurement to ON. :returns: OutPut – Return a dictionary with the measured voltage and current. :rtype: dict

query(message)[source]
set_CHPowerState(state)[source]
Parameters:

state (str) – Sets the state of the channel power measurement, ON or OFF. When using :CONFigure:CHPower,the state is automatically set to ON state = [‘ON’,’OFF’,1,0]

Raises:

ValueError – Error message

Return type:

None.

set_CenterFreq(value, unit)[source]
Parameters:
  • value (float) – Sets the center frequency. Note that changing the value of the center frequency will change the value of the coupled parameters Start Frequency and Stop Frequency. It might also change the value of the span.

  • unit (str) – Unit value. Can be [‘HZ’,’KHZ’,’MHZ’,’GHZ’]

Raises:

ValueError – Error message

Return type:

None.

set_Continuous(status)[source]
Parameters:

status (str/int) – Stop/start Sweep. Can be [‘ON’, ‘OFF’, 1, 0]

Raises:

ValueError – Error message

Return type:

None.

set_ContinuousMeas(state)[source]
Parameters:

state (str/int) – Title: Sweep Type Description: Specifies whether the sweep/measurement is triggered continuously. If the value is set to ON or 1, another sweep/measurement is triggered as soon as the current one completes. If continuous is set to OFF or 0, the instrument remains initiated until the current sweep/measurement completes, then enters the ‘idle’ state and waits for the :INITiate[:IMMediate] command or for :INITiate:CONTinuous ON.

Raises:

ValueError – Error message

Return type:

None.

set_DataFormat(status)[source]
Parameters:

status (str) – Set Data Format status = [‘ASCii’,’INTeger’,’REAL’]

Raises:

ValueError – Error message

Return type:

None.

set_DataPointCount(value)[source]
Parameters:

value (int) –

Title: Display Point Count

Description: Changes the number of display points the instrument currently measures. Increasing the number of display points can improve the resolution of measurements but will also increase sweep time.

Default Value: 501 Range: 10 to 10001

Raises:

ValueError – Error message

Return type:

None.

set_FreqSpan(value, unit)[source]
Parameters:
  • value (float) – Sets the frequency span. Setting the value of <freq> to 0 Hz is the equivalent of setting the span mode to zero span. Note that changing the value of the frequency span will change the value of the coupled parameters Start Frequency and Stop Frequency and might change the Center Frequency.

  • unit (str) – Unit value. Can be [‘HZ’,’KHZ’,’MHZ’,’GHZ’]

Raises:

ValueError – Error message

Return type:

None.

set_MarkerExcursion(value)[source]
Parameters:

value (float) – Sets the excursion for a marker. The excursion is the vertical distance from the peak to the next highest valley which must be exceeded for a peak to be considered a peak in marker max commands

Return type:

None.

set_MarkerExcursionState(state)[source]
Parameters:

state (str/int) – Turn on/off excursion checking for marker max commands. Can be state = [‘ON’,’OFF’,1,0]

Raises:

ValueError – Error message

Return type:

None.

set_MarkerPreset()[source]
Returns:

Presets all markers to their preset values.

Return type:

None.

set_MaxPeak()[source]
Returns:

Moves the marker X value to the point in the marker’s assigned trace that has the highest peak.

Return type:

None.

set_NextPeak()[source]
Returns:

Moves the marker X value to the point in the marker’s assigned trace that is the next highest peak

Return type:

None.

set_ResBwidth(value, unit)[source]
Parameters:
  • value (int/float) – Description: Sets the resolution bandwidth. Note that using this command turns the automatic resolution bandwidth setting OFF. In Zero Span, the range will change to allow a minimum of 5 KHz to the maximum of 20 MHz.

  • unit (str) – Parameters: <numeric_value> {HZ | KHZ | MHZ | GHZ} Default Unit: Hz

Raises:

ValueError – Error message

Return type:

None.

set_ResBwidthAuto(state)[source]
Parameters:

state (int/str) – Title:RBW AutoDescription:Sets the state of the coupling of the resolution bandwidth to the frequency span. Setting the value to ON or 1 will result in the resolution bandwidth being coupled to the span. That is, when the span changes, the resolution bandwidth changes. Setting the value to OFF or 0 will result in the resolution bandwidth being decoupled from the span. That is, changing the span will not change the resolution bandwidth. When this command is issued, the resolution bandwidth setting itself will not change. Parameters:<1 | 0 | ON | OFF> Default Value:ON

Raises:

ValueError – Error message

Return type:

None.

set_TraceSelected(number)[source]
Parameters:

number (int) –

The selected trace will be used by operations that use a single trace. The max number of traces available to select is model specific. Trace number:

Can be set to [1,2,3,4,5,6]

Raises:

ValueError – Error message

Return type:

None.

set_TraceState(state, number)[source]
Parameters:
  • state (str) – The trace visibility state status. If it is OFF, the :TRAC:DATA? command will return NaN. [‘ON’,’OFF’,0,1]

  • number (int) –

    Trace Number:

    Can be set to [1,2,3,4,5,6]

Raises:

ValueError – Error message

Return type:

None.

set_TraceType(state, number)[source]
Parameters:
  • state (str) –

    Sets Trace Type:

    Normal - NORM Hold the Minimum - MIN Hold the Maximum - MAX Average - AVER Rolling Max Hold - RMAX Rolling Min Hold - RMIN Rolling Average - RAV

  • number (int) –

    Trace number:

    Can be set to [1,2,3,4,5,6]

Raises:

ValueError – Error message

Return type:

None.

set_freq_Start(value, unit)[source]
Parameters:
  • value (int/float) – Description: Sets the start frequency. Note that in the spectrum analyzer, changing the value of the start frequency will change the value of the coupled parameters, Center Frequency and Span.

  • unit (str) – Parameters: <numeric_value> {HZ | KHZ | MHZ | GHZ}

Raises:

ValueError – Error message

Return type:

None.

set_freq_Stop(value, unit)[source]
Parameters:
  • value (int/float) – Description: Sets the start frequency. Note that in the spectrum analyzer, changing the value of the start frequency will change the value of the coupled parameters, Center Frequency and Span.

  • unit (str) – Parameters: <numeric_value> {HZ | KHZ | MHZ | GHZ}

Raises:

ValueError – Error message

Return type:

None.

write(message)[source]