Anritsu Vectro Analyzer MS4647B module

Created on Mon Dec 13 10:40:31 2021

@author: Martin.Mihaylov

class MS4647B.MS4647B(resource_str)[source]

Bases: object

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

Close()[source]
DeleteData(name, portNumb)[source]
Parameters:
  • name (str) – File Name

  • portNumb – The N(ports number) for the .sNp data output. Delete a disk, file, or directory. Use caution with this command as there is no recovery operation in case of a user mistake or error. No query

Return type:

None.

DeleteDataCSV(name)[source]
Parameters:
  • name (str) – File Name

  • portNumb – The N(ports number) for the .sNp data output. Delete a disk, file, or directory. Use caution with this command as there is no recovery operation in case of a user mistake or error. No query

Return type:

None.

RTL()[source]
Returns:

  • None.

  • Description (Send all devices to local operation. No query)

SaveData(name, portNumb)[source]
Parameters:
  • name (str) – File Name

  • portNumb – The N(ports number) for the .sNp data output. Description: Stores a data file of the type specified by the filename extension.No query.

Return type:

None.

SaveDataCSV(name)[source]
Parameters:
  • name (str) – File Name

  • portNumb – The N(ports number) for the .sNp data output. Description: Stores a data file of the type specified by the filename extension.No query.

Return type:

None.

SaveImage(name)[source]
Parameters:
  • name (str) – File Name

  • portNumb – The N(ports number) for the .sNp data output. Description: Stores a data file of the type specified by the filename extension.No query.

Return type:

None.

SaveTransferData(file, path, name, portNumb)[source]
Parameters:
  • file (str) – File data extracted from function ask_TransferData

  • path (str) – Where on the PC to save the data

  • name (str) – Name of the File

  • portNumb (int/str) –

    The N(ports number) for the .sNp data output.

    Write a text File with the transferred data

Return type:

None.

SaveTransferDataCSV(file, path, name)[source]
Parameters:
  • file (str) – File data extracted from function ask_TransferData

  • path (str) – Where on the PC to save the data

  • name (str) – Name of the File

  • portNumb (int/str) –

    The N(ports number) for the .sNp data output.

    Write a text File with the transferred data

Return type:

None.

ask_AssignetDataPort(value)[source]
Parameters:

value (int/float) – the N(ports number) for the .sNp data output.

Raises:

ValueError – Error message

Returns:

TYPE – Outputs the data port pair assigned to use when creating an sNp data file on the indicated channel.

Return type:

str

ask_AverageCount(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Raises:

ValueError – Error message

Returns:

TYPE – Outputs the averaging count for the indicated channel.

Return type:

float

ask_AverageFunctionType(ChanNumber)[source]

Parameters

Raises:

ValueError – Error message

Returns:

TYPE – Outputs the averaging function type of point-by-point or sweep-by-sweep.

Return type:

str

ask_CWFreq(ChanNumber)[source]

Parameters

Raises:

ValueError – Error message

Returns:

TYPE – Sets the CW frequency of the indicated channel. Outputs the CW frequency of the indicated channel.

The output parameter is in Hertz.

Return type:

float

ask_CenterFreq(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Raises:

ValueError – Error message

Returns:

TYPE – Optional query. Center frequency is automatically calculated using Stop Frequency and Start Frequency as:

Fc = ((Fstop - Fstart)/2) + Fstart

Return type:

float

ask_DataFreq(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Raises:

ValueError – Error message

Returns:

TYPE – Outputs the frequency list for the indicated channel

Return type:

str

ask_DisplayCount()[source]
Returns:

Query the number of displayed channels.

Return type:

TYPE

ask_DisplayTitle()[source]
Returns:

Outputs the user title for the channel indicated

Return type:

TYPE

ask_DisplayTrace()[source]
Returns:

Query only. Outputs the Active Channel number.

Return type:

TYPE

ask_FreqSpan(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Raises:

ValueError – Error message

Returns:

TYPE – Optional query. Span is automatically calculated as Stop Frequency minus Start Frequency. The query returns the resulting span in Hertz.

Return type:

float

ask_ParamFormInFile()[source]

Outputs the parameter format displayed in an SNP data file.

ask_PowerOnPort(segment, ChanNumber)[source]
Parameters:
  • segment (int) – Selected Source. Can be from 1-16

  • ChanNumber (int) – Channel Number 1,2,3…

Returns:

Value – Outputs the power level of the indicated port on the indicated channel.

Return type:

float

ask_RFState()[source]
Returns:

TYPE – Outputs the RF on/off state in Hold

Return type:

str

ask_ResolutionBW(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Returns:

TYPE – The command sets the IF bandwidth for the indicated channel. The query outputs the IF bandwidth for the indicated channel.

Return type:

float

ask_SelectParameter()[source]
Return type:

The query outputs only the selected parameter.

ask_SetAverageState(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Raises:

ValueError – Error message

Returns:

TYPE – Outputs the averaging function on/off status on the indicated channel.

Return type:

str

ask_SmoothingState(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Returns:

Query outputs the smoothing on/off status for the indicated channel and active trace. 1 = ON 2 = OFF

Return type:

TYPE

ask_StatOperation()[source]
Returns:

Description: Query only. Outputs the value of the operation status condition reg. Range: 0 to 32767 Default Value: 0

Return type:

TYPE

ask_StatOperationRegister()[source]
Returns:

Sets the value of the operation status enable register. Outputs the value of the operation status enable register.

Return type:

TYPE str

ask_SubSystem()[source]
Returns:

The :SENSe:HOLD subsystem command sets the hold function for all channels on a per-instrument basis

Return type:

TYPE str

ask_SweepChannelStatus()[source]
Returns:

TYPE – The query outputs the On/Off state of the option to sweep only the active channel

Return type:

str

ask_SweepCount(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Raises:

ValueError – Error message

Returns:

Description: Query only. Outputs the averaging sweep count for the

indicated channel.

Return type:

TYPE

ask_SweepDelay()[source]
Return type:

Outputs the sweep delay time of the indicated channel.

ask_SweepTime()[source]
Return type:

Outputs the Sweep Time of the indicated channel.

ask_SysErrors()[source]
Returns:

Description: Query only. Outputs the number of errors in the error queue.

Return type:

TYPE

ask_TestSet(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Raises:

ValueError – Error message

Returns:

Query State of TS3739.

Return type:

TYPE

ask_TransferData(name, portNumb)[source]
Parameters:
  • name (str) – File Name

  • portNumb (int) – the N(ports number) for the .sNp data output.

Returns:

TYPE – The query outputs the disk file data to the GPIB. The file must exist

Return type:

str

Hard coded path on the VNA = ‘C:/tmp/’

ask_TransferDataCSV(name)[source]
Parameters:

name (str) – File Name

Returns:

TYPE – The query outputs the disk file data to the GPIB. The file must exist

Return type:

str

Hard coded path on the VNA = ‘C:/tmp/’

getIdn()[source]
Returns:

Device Serial Number and Model

Return type:

TYPE str

query(message)[source]
set_AssignetDataPort(ChanNumber, value1, value2)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • value1 (int)

  • value2 (int) –

    The command assigns the data port pair to use when creating an sNp data file on the indicated channel. The use of Port 3 and/or Port 4 requires a 4-port VNA instrument

    PORT12 | PORT13 | PORT14 | PORT23 | PORT24 | PORT34

Raises:

ValueError – Error message

Return type:

None.

set_AverageCount(ChanNumber, value)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • value (int) – Sets the averaging count for the indicated channel. The channel must be turned on. The input parameter is a unitless number. Range: 1 to 1024 Default Value: 1

Raises:

ValueError – Error message

Return type:

None.

set_AverageFunctionType(ChanNumber, state)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • state (str) – Sets the averaging function type to point-by-point or sweep-by-sweep. POIN | SWE Default Value: POIN

Raises:

ValueError – Error message

Return type:

None.

set_CWFreq(ChanNumber, value)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • value (int/str in form - 10E+9) – Sets the CW frequency of the indicated channel. Outputs the CW frequency of the indicated channel.

Raises:

ValueError – Error message

Return type:

None.

set_CenterFreq(ChanNumber, value)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • value (int/str in form - 10E+9) – Sets the center value of the sweep range of the indicated channel. Outputs the center value of the sweep range of the indicated channel

Raises:

ValueError – Error message

Return type:

None.

set_ClearAverage(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3… Description: Clears and restarts the averaging sweep count of the indicated channel.

Raises:

ValueError – Error message

Return type:

None.

set_ClearError()[source]
Returns:

  • None.

  • Description (Clears the contents of the error queue.)

set_DisplayColorReset()[source]
Returns:

  • None.

  • Resets all colors and inverted colors to their normal default values.

set_DisplayCount(ChannelNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Raises:

ValueError – Error message

Returns:

  • None (Sets the number of displayed channels. When the VNA is in 25,000 point mode, the)

  • number of channels can only be 1 (one), 2, 3, 4, 6, 8, 9, 10, 12, or 16 channels. If the

  • channel display is set to a non-listed number (5, 7, 11, 13, 14, 15), the instrument is set to

  • the next higher channel number. If a number of greater than 16 is entered, the

  • instrument is set to 16 channels. If the instrument is set to 100,000 points, any input

  • results in 1 (one) channel. Outputs the number of displayed channels.

set_DisplayScale()[source]
Returns:

  • None.

  • Description (Auto scales all traces on all channels.)

set_DisplayTitle(ChannelName)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Raises:

ValueError – Error message

Returns:

None

Return type:

Sets the user title for the channel indicated.

set_DisplayTrace(ChanNumber)[source]
Parameters:

ChanNumber (int) – Channel Number 1,2,3…

Raises:

ValueError – Error message

Returns:

  • The command sets the active channel to the indicated number. When the VNA is set to

  • 100,000 point mode, the number of channels is

set_ParamFormInFile(unit)[source]
Parameters:

unit (str) –

Sets the parameter format displayed in an SNP data file. Where:

  • LINPH = Linear and Phase

  • LOGPH = Log and Phase

  • REIM = Real and Imaginary Numbers

Raises:

ValueError – Error message

Return type:

None.

set_PowerOnPort(segment, ChanNumber, value)[source]
Parameters:
  • segment (int) – Selected Source. Can be from 1-16

  • ChanNumber (int) – Channel Number 1,2,3…

  • value (int/floa/str) – Sets the power level of the indicated port on the indicated channel.

Raises:

ValueError – Error message

Return type:

None.

set_RFState(state)[source]
Parameters:

state (str/int) – Sets the RF on/off state in Hold.

Raises:

ValueError – Error message

Return type:

None.

set_ResolutionBW(ChanNumber, value)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • value (int/floa/str) – The command sets the IF bandwidth for the indicated channel. The query outputs the IF bandwidth for the indicated channel.

Raises:

ValueError – Error message

Return type:

None.

set_SelectParameter(S_Param)[source]
Parameters:

S_Param (str) – S-Parameter selected.

Raises:

ValueError – Error message

Returns:

None

Return type:

Select an S-Parameter. 16 S-Parameters for 4 Ports config can be selected.

set_SetAverageState(ChanNumber, state)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • state (int/str) – Turns averaging on/off for the indicated channel (Turns on and Off the averaging for all channels).

Raises:

ValueError – Error message

Return type:

None.

set_SmoothingAPERture(ChanNumber, value)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • value (int) – Percentage smoothing between 0 to 100

Raises:

ValueError – Error message

Return type:

The command sets the smoothing aperture for the indicated channel and active trace.

set_SmoothingState(ChanNumber, state)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • state (str/int) – can be int or str form the list [‘ON’,’OFF’,1,0]

Raises:

ValueError – Error message

Return type:

The command sets the smoothing aperture for the indicated channel and active trace.

set_StartFreq(ChanNumber, value)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • value (int/str in form - 10E+9) – Sets the start value of the sweep range of the indicated channel. The input parameter is in Hertz, Meters, or Seconds.

Raises:

ValueError – Error message

Return type:

None.

set_StatOperationRegister(value)[source]
Parameters:

value (TYPE) –

Sets the value of the operation status enable register. Outputs the value of the operation status enable register. The input parameter is a unitless number.

Range: 0 to 65535

Return type:

None.

set_StopFreq(ChanNumber, value)[source]
Parameters:
  • ChanNumber (int) – Channel Number 1,2,3…

  • value (int/str in form - 10E+9) – Sets the stop value of the sweep range of the indicated channel. The input parameter is in Hertz, Meters, or Seconds.

Raises:

ValueError – Error message

Return type:

None.

set_SubSystemCont()[source]
Returns:

  • None.

  • The sweep is sweeping continuously

set_SubSystemHold()[source]
Returns:

  • None.

  • Sets the hold function for all channels on a per-instrument basis.

  • The sweep is stopped.

set_SubSystemSing()[source]
Returns:

  • None.

  • The sweep restarts and sweeps until the end of the

  • sweep, at which point it sets the end of sweep status bit and

  • stops.

set_SweepChannelStatus(state)[source]
Parameters:

state (str/int) – The command turns On/Off the option to sweep only the active channel

Raises:

ValueError – Error message

Return type:

None.

set_SweepDelay(time)[source]
Parameters:

time (float) – Sets the sweep delay time of the indicated channel.

Return type:

None.

set_SweepTime(time)[source]
Parameters:

time (float) – Sets the Sweep Time of the indicated channel.

Return type:

None.

set_TS3739(ChanNumber, state)[source]
Parameters
ChanNumberint

Channel Number 1,2,3…

statestr/int

The :SENSe{1-16}:TS3739 subsystem commands are used to configure and control the VectorStar ME7838x Broadband/Millimeter-Wave 3738A Test Set.

ValueError

Error message

None.

write(message)[source]