# HP 8560A / 8561B Spectrum Analyzer

Every unit is used in the base unit, so for time it is s (Seconds), frequency in Hz (Hertz) etc…

## Generic Specific Attributes & Methods

### General

HP856Xx.preset()

  Set the spectrum analyzer to a known, predefined state.

  ‘preset’ does not affect the contents of any data or trace registers or stored preselector data. ‘preset’ does not clear the input or output data buffers;

HP856Xx.attenuation

  Control the input attenuation in decade steps from 10 to 70 db (type ‘int’) or set to ‘AUTO’ and ‘MAN’(ual)

  Type: `str`, `int`

      instr.attenuation = 'AUTO'
      instr.attenuation = 60

HP856Xx.amplitude_unit

  Control the amplitude unit with a selection of the following parameters: string ‘DBM’, ‘DBMV’, ‘DBUV’, ‘V’, ‘W’, ‘AUTO’, ‘MAN’ or use the enum `AmplitudeUnits`

  Type: `str`

      instr.amplitude_unit = 'dBmV'
      instr.amplitude_unit = AmplitudeUnits.dBmV

HP856Xx.trigger_mode

  Control the trigger mode. Selected trigger conditions must be met in order for a sweep to occur. For the available modes refer to `TriggerMode`. When any trigger mode other than free run is selected, a “T” appears on the left edge of the display.

HP856Xx.detector_mode

  Control the IF detector used for acquiring measurement data. This is normally a coupled function, in which the spectrum analyzer selects the appropriate detector mode. Four modes are available: normal, positive, negative, and sample.

  Type: `str`

  Takes a representation of the detector mode, either from `DetectionModes` or use ‘NEG’, ‘NRM’, ‘POS’, ‘SMP’

      instr.detector_mode = DetectionModes.SMP
      instr.detector_mode = 'NEG'

      if instr.detector_mode == DetectionModes.SMP:
          pass

HP856Xx.coupling

  Control the input coupling of the spectrum analyzer. AC coupling protects the input of the analyzer from damaging dc signals, while limiting the lower frequency-range to 100 kHz (although the analyzer will tune down to 0 Hz with signal attenuation).

  Type: `str`

  Takes a representation of the coupling mode, either from `CouplingMode` or use ‘AC’ / ‘DC’

      instr.coupling = 'AC'
      instr.coupling = CouplingMode.DC

      if instr.coupling == CouplingMode.DC:
          pass

HP856Xx.set_auto_couple()

  Set the video bandwidth, resolution bandwidth, input attenuation, sweep time, and center frequency step-size to coupled mode.

  These functions can be recoupled individually or all at once. The spectrum analyzer chooses appropriate values for these functions. The video bandwidth and resolution bandwidth are set according to the coupled ratios stored under `resolution_bandwidth_to_span_ratio` and `video_bandwidth_to_resolution_bandwidth`. If no ratios are chosen, default ratios (1.0 and 0.011, respectively) are used instead.

HP856Xx.set_linear_scale()

  Set the spectrum analyzers display to linear amplitude scale.

  Measurements made on a linear scale can be read out in any units.

HP856Xx.logarithmic_scale

  Control the logarithmic amplitude scale. When in linear mode, querying ‘logarithmic_scale’ returns a “0”. Allowed values are 0, 1, 2, 5, 10

  Type: `int`

      if instr.logarithmic_scale:
          pass

      # set the scale to 10 db per division
      instr.logarithmic_scale = 10

HP856Xx.threshold

  Control the minimum amplitude level and clips data at this value. Default value is -90 dBm. See also - `marker_threshold` does not clip data below its threshold

  Type: `str, float` range -200 to 30

  Note

  When a trace is in max-hold mode, if the threshold is raised above any of the trace data, the data below the threshold will be permanently lost.

HP856Xx.set_title(string)

  Sets character data in the title area of the display, which is in the upper-right corner.

  A title can be up to two rows of sixteen characters each, Carriage return and line feed characters are not allowed.

HP856Xx.status

  Get the decimal equivalent of the bits set in the status byte (see the RQS and SRQ commands). STB is equivalent to a serial poll command. The RQS and associated bits are cleared in the same way that a serial poll command would clear them.

HP856Xx.check_done()

  Return when all commands in a command string entered before :meth:’check_done’ has been completed. Sending a `trigger_sweep()` command before ‘check_done’ ensures that the spectrum analyzer will complete a full sweep before continuing on in a program. Depending on the timeout a timeout error from the adapter will raise before the spectrum analyzer can finish due to an extreme long sweep time.

      instr.trigger_sweep()

      # wait for a full sweep and than 'do_something'
      instr.check_done()
      do_something()

HP856Xx.request_service(input)

  Triggers a service request. This command allows you to force a service request and test a program designed to handle service requests. However, the service request can be triggered only if it is first masked using the `request_service_conditions` command.

  Parameters:

    input (`StatusRegister`) – Bits to emulate a service request

HP856Xx.errors

  Get a list of errors present (of type `ErrorCode`). An empty list means there are no errors. Reading ‘errors’ clears all HP-IB errors. For best results, enter error data immediately after querying for errors.

  Type: `ErrorCode`

      errors = instr.errors
      if len(errors) > 0:
          print(errors[0].code)

      for error in errors:
          print(error)

      if ErrorCode(112) in errors:
          print("yeah")

  Example result of this python snippet:

      112
      ErrorCode("??CMD?? - Unrecognized command")
      ErrorCode("NOP NUM - Command cannot have numeric units")
      yeah

HP856Xx.save_state(inp)

  Saves the currently displayed instrument state in the specified state register.

  Parameters:

    - inp – State to be recalled: either storage slot 0 … 9 or ‘LAST’ or ‘PWRON’

    - inp – str, int

      instr.preset()
      instr.center_frequency = 300e6
      instr.span = 20e6
      instr.save_state("PWRON")

HP856Xx.recall_state(inp)

  Set to the display a previously saved instrument state. See `save_state()`.

  Parameters:

    - inp – State to be recalled: either storage slot 0 … 9 or ‘LAST’ or ‘PWRON’

    - inp – str, int

      instr.save_state(7)
      instr.preset()
      instr.recall_state(7)

HP856Xx.request_service_conditions

  Control a bit mask that specifies which service requests can interrupt a program sequence.

      instr.request_service_conditions = StatusRegister.ERROR_PRESENT | StatusRegister.TRIGGER

      print(instr.request_service_conditions)
      StatusRegister.ERROR_PRESENT|TRIGGER

HP856Xx.set_maximum_hold = <function HP856Xx.set_maximum_hold>

HP856Xx.set_minimum_hold = <function HP856Xx.set_minimum_hold>

HP856Xx.reference_level_calibration

  Control the calibration of the reference level remotely and retuns the current calibration. To calibrate the reference level, connect the 300 MHz calibration signal to the RF input. Set the center frequency to 300 MHz, the frequency span to 20 MHz, and the reference level to -10 dBm. Use the RLCAL command to move the input signal to the reference level. When the signal peak falls directly on the reference-level line, the reference level is calibrated. Storing this value in the analyzer in EEROM can be done only from the front panel. The RLCAL command, when queried, returns the current value.

  Type: `float`

      # connect cal signal to rf input
      instr.preset()
      instr.amplitude_unit = AmplitudeUnits.DBM
      instr.center_frequency = 300e6
      instr.span = 100e3
      instr.reference_level = 0
      instr.trigger_sweep()

      instr.peak_search(PeakSearchMode.High)
      level = instr.marker_amplitude
      rlcal = instr.reference_level_calibration - int((level + 10) / 0.17)
      instr.reference_level_calibration = rlcal

HP856Xx.reference_offset

  Control an offset applied to all amplitude readouts (for example, the reference level and marker amplitude). The offset is in dB, regardless of the selected scale and units. The offset can be useful to account for gains of losses in accessories connected to the input of the analyzer. When this function is active, an “R” appears on the left edge of the display.

  Type: `int`

HP856Xx.reference_level

  Control the reference level, or range level when in normalized mode. (Range level functions the same as reference level.) The reference level is the top horizontal line on the graticule. For best measurement accuracy, place the peak of a signal of interest on the reference-level line. The spectrum analyzer input attenuator is coupled to the reference level and automatically adjusts to avoid compression of the input signal. Refer also to `amplitude_unit`. Minimum reference level is -120.0 dBm or 2.2 uV

  Type: `float`

HP856Xx.display_line

  Control the horizontal display line for use as a visual aid or for computational purposes. The default value is 0 dBm.

  Type: `float`

  Takes a value with the unit of `amplitude_unit`

      instr.display_line = -10

      if instr.display_line == 0:
          pass

HP856Xx.protect_state_enabled

  Control the storing of any new data in the state or trace registers. If set to ‘True’, the registers are “locked”; the data in them cannot be erased or overwritten, although the data can be recalled. To “unlock” the registers, and store new data, set ‘protect_state_enabled’ to off by selecting ‘False’ as the parameter.

  Type: `bool`

HP856Xx.mixer_level

  Control the maximum signal level that is at the input mixer. The attenuator automatically adjusts to ensure that this level is not exceeded for signals less than the reference level. From -80 to -10 DB.

  Type: `int`

HP856Xx.frequency_counter_mode_enabled

  Set the device into a frequency counter mode that counts the frequency of the active marker or the difference in frequency between two markers. If no marker is active, ‘frequency_counter_mode_enabled’ places a marker at the center of the trace and counts that marker frequency. The frequency counter provides a more accurate frequency reading; it pauses at the marker, counts the value, then continues the sweep. To adjust the frequency counter resolution, use the ‘frequency_counter_resolution’ command. To return the counter value, use the ‘marker_frequency’ command.

      instr.frequency_counter_mode_enabled = True

HP856Xx.frequency_counter_resolution

  Control the resolution of the frequency counter. Refer to the ‘frequency_counter_mode’ command. The default value is 10 kHz.

  Type `int`

  >     # activate frequency counter mode
  >     instr.frequency_counter_mode = True

  >     # adjust resolution to 1 Hz
  >     instr.frequency_counter_resolution = 1

  >     if instr.frequency_counter_resolution:
  >         pass

HP856Xx.adjust_all()

  Activate the local oscillator (LO) and intermediate frequency (IF) alignment routines. These are the same routines that occur when is switched on. Commands following ‘adjust_all’ are not executed until after the analyzer has finished the alignment routines.

HP856Xx.adjust_if

  Control the automatic IF adjustment. This function is normally on. Because the IF is continuously adjusting, executing the IF alignment routine is seldom necessary. When the IF adjustment is not active, an “A” appears on the left side of the display.

  - “FULL” IF adjustment is done for all IF settings.

  - “CURR” IF adjustment is done only for the IF settings currently displayed.

  - False turns the continuous IF adjustment off.

  - True reactivates the continuous IF adjustment.

  Type: `bool, str`

HP856Xx.hold()

  Freeze the active function at its current value.

  If no function is active, no operation takes place.

HP856Xx.annotation_enabled

  Set the display annotation off or on.

  Type: `bool`

HP856Xx.set_crt_adjustment_pattern()

  Activate a CRT adjustment pattern, shown in Figure 5-3. Use the X POSN, Y POSN, and TRACE ALIGN adjustments (available from the rear panel) to align the display. Use X POSN and Y POSN to move the display horizontally and vertically, respectively. Use TRACE ALIGN to straighten a tilted display. To remove the pattern from the screen, execute the `preset()` command.

HP856Xx.display_parameters

  Get the location of the lower left (P1) and upper right (P2) vertices as a tuple of the display window.

  Type: `tuple`

      repr(instr.display_parameters)
      (72, 16, 712, 766)

HP856Xx.firmware_revision

  Get the revision date code of the spectrum analyzer firmware.

  Type: `datetime.date`

HP856Xx.graticule_enabled

  Control the display graticule. Switch it either on or off.

  Type: `bool`

      instr.graticule = True

      if instr.graticule:
          pass

HP856Xx.serial_number

  Get the spectrum analyzer serial number.

HP856Xx.id

  Get the identification of the device with software and hardware revision (e.g. HP8560A,002, H03)

  Type: `str`

      print(instr.id)
      HP8560A,002,H02

HP856Xx.elapsed_time

  Get the elapsed time (in hours) of analyzer operation. This value can be reset only by Hewlett-Packard.

  Type: `int`

      print(elapsed_time)
      1998

### Demodulation

HP856Xx.demodulation_mode

  Control the demodulation mode of the spectrum analyzer. Either AM or FM demodulation, or turns the demodulation — off. Place a marker on a desired signal and then set `demodulation_mode`; demodulation takes place on this signal. If no marker is on, `demodulation_mode` automatically places a marker at the center of the trace and demodulates the frequency at that marker position. Use the volume and squelch controls to adjust the speaker and listen.

  Type: `str`

  Takes a representation of the demodulation mode, either from `DemodulationMode` or use ‘OFF’, ‘AM’, ‘FM’

      instr.demodulation_mode = 'AC'
      instr.demodulation_mode = DemodulationMode.AM

      if instr.demodulation_mode == DemodulationMode.FM:
          instr.demodulation_mode = Demodulation.OFF

HP856Xx.demodulation_agc_enabled

  Control the demodulation automatic gain control (AGC). The AGC keeps the volume of the speaker relatively constant during AM demodulation. AGC is available only during AM demodulation and when the frequency span is greater than 0 Hz.

  Type: `bool`

      instr.demodulation_agc = True

      if instr.demodulation_agc:
          instr.demodulation_agc = False

HP856Xx.demodulation_time

  Control the amount of time that the sweep pauses at the marker to demodulate a signal. The default value is 1 second. When the frequency span equals 0 Hz, demodulation is continuous, except when between sweeps. For truly continuous demodulation, set the frequency span to 0 Hz and the trigger mode to single sweep (see TM). Minimum 100 ms to maximum 60 s

  Type: `float`

      # set the demodulation time to 1.2 seconds
      instr.demodulation_time = 1.2

      if instr.demodulation_time == 10:
          pass

HP856Xx.squelch

  Control the squelch level for demodulation. When this function is on, a dashed line indicating the squelch level appears on the display. A marker must be active and above the squelch line for demodulation to occur. Refer to the `demodulation_mode` command. The default value is -120 dBm.

  Type: `str,int`

      instr.preset()
      instr.start_frequency = 88e6
      instr.stop_frequency = 108e6

      instr.peak_search(PeakSearchMode.High)
      instr.demodulation_time = 10

      instr.squelch = -60
      instr.demodulation_mode = DemodulationMode.FM

### Frequency

HP856Xx.start_frequency

  Control the start frequency and set the spectrum analyzer to start-frequency/ stop-frequency mode. If the start frequency exceeds the stop frequency, the stop frequency increases to equal the start frequency plus 100 Hz. The center frequency and span change with changes in the start frequency.

  Type: `float`

      instr.start_frequency = 300.5e6
      if instr.start_frequency == 200e3:
          print("Correct frequency")

  (dynamic)

HP856Xx.stop_frequency

  Control the stop frequency and set the spectrum analyzer to start-frequency/ stop-frequency mode. If the stop frequency is less than the start frequency, the start frequency decreases to equal the stop frequency minus 100 Hz. The center frequency and span change with changes in the stop frequency.

  Type: `float`

      instr.stop_frequency = 300.5e6
      if instr.stop_frequency == 200e3:
          print("Correct frequency")

  (dynamic)

HP856Xx.center_frequency

  Control the center frequency in hertz and sets the spectrum analyzer to center frequency / span mode.

  The span remains constant; the start and stop frequencies change as the center frequency changes.

  Type: `float`

      instr.center_frequency = 300.5e6
      if instr.center_frequency == 200e3:
          print("Correct frequency")

  (dynamic)

HP856Xx.frequency_offset

  Control an offset added to the displayed absolute-frequency values, including marker-frequency values.

  It does not affect the frequency range of the sweep, nor does it affect relative frequency readouts. When this function is active, an “F” appears on the left side of the display. Changes all the following frequency measurements.

  Type: `float`

      instr.frequency_offset = 2e6
      if instr.frequency_offset == 2e6:
          print("Correct frequency")

  (dynamic)

HP856Xx.frequency_reference_source

  Control the frequency reference source. Select either the internal frequency reference (INT) or supply your own external reference (EXT). An external reference must be 10 MHz (+100 Hz) at a minimum amplitude of 0 dBm. Connect the external reference to J9 (10 MHz REF IN/OUT) on the rear panel. When the external mode is selected, an “X” appears on the left edge of the display.

  Type: `str`

  Takes element of `FrequencyReference` or use ‘INT’, ‘EXT’

      instr.frequency_reference_source = 'INT'
      instr.frequency_reference_source = FrequencyReference.EXT

      if instr.frequency_reference_source == FrequencyReference.INT:
          instr.frequency_reference_source = FrequencyReference.EXT

HP856Xx.span

  Control the frequency span. The center frequency does not change with changes in the frequency span; start and stop frequencies do change. Setting the frequency span to 0 Hz effectively allows an amplitude-versus-time mode in which to view signals. This is especially useful for viewing modulation. Querying SP will leave the analyzer in center frequency /span mode.

HP856Xx.set_full_span()

  Set the spectrum analyzer to the full frequency span as defined by the instrument.

  The full span is 2.9 GHz for the HP 8560A. For the HP 8561B, the full span is 6.5 GHz.

HP856Xx.frequency_display_enabled

  Get the state of all annotations that describes the spectrum analyzer frequency. returns ‘False’ if no annotations are shown and vice versa ‘True’. This includes the start and stop frequencies, the center frequency, the frequency span, marker readouts, the center frequency step-size, and signal identification to center frequency. To retrieve the frequency data, query the spectrum analyzer.

  Type: `bool`

      if instr.frequency_display:
          print("Frequencies get displayed")

### Resolution Bandwidth

HP856Xx.resolution_bandwidth

  Control the resolution bandwidth. This is normally a coupled function that is selected according to the ratio selected by the RBR command. If no ratio is selected, a default ratio (0.011) is used. The bandwidth, which ranges from 10 Hz to 2 MHz, may also be selected manually.

  Type: `str, dec`

HP856Xx.resolution_bandwidth_to_span_ratio

  Control the coupling ratio between the resolution bandwidth and the frequency span. When the frequency span is changed, the resolution bandwidth is changed to satisfy the selected ratio. The ratio ranges from 0.002 to 0.10. The “UP” and “DN” parameters adjust the ratio in a 1, 2, 5 sequence. The default ratio is 0.011.

### Video

HP856Xx.video_trigger_level

  Control the video trigger level when the trigger mode is set to VIDEO (refer to the `trigger_mode` command). A dashed line appears on the display to indicate the level. The default value is 0 dBm. Range -220 to 30.

  Type: `float`

HP856Xx.video_bandwidth_to_resolution_bandwidth

  Control the coupling ratio between the video bandwidth and the resolution bandwidth. Thus, when the resolution bandwidth is changed, the video bandwidth changes to satisfy the ratio. The ratio ranges from 0.003 to 3 in a 1, 3, 10 sequence. The default ratio is 1. When a new ratio is selected, the video bandwidth changes to satisfy the new ratio—the resolution bandwidth does not change value.

HP856Xx.video_bandwidth

  Control the video bandwidth. This is normally a coupled function that is selected according to the ratio selected by the VBR command. (If no ratio is selected, a default ratio, 1.0, is used instead.) Video bandwidth filters (or smooths) post-detected video information. The bandwidth, which ranges from 1 Hz to 3 MHz, may also be selected manually. If the specified video bandwidth is less than 300 Hz and the resolution bandwidth is greater than or equal to 300 Hz, the IF detector is set to sample mode. Reducing the video bandwidth or increasing the number of video averages will usually smooth the trace by about as much for the same total measurement time. Reducing the video bandwidth to one-third or less of the resolution bandwidth is desirable when the number of video averages is above 25. For the case where the number of video averages is very large, and the video bandwidth is equal to the resolution bandwidth, internal mathematical limitations allow about 0.4 dB overresponse to noise on the logarithmic scale. The overresponse is negligible (less than 0.1 dB) for narrower video bandwidths.

  Type: `int`

HP856Xx.video_average

  Control the video averaging function. Video averaging smooths the displayed trace without using a narrow bandwidth. ‘video_average’ sets the IF detector to sample mode (see the DET command) and smooths the trace by averaging successive traces with each other. If desired, you can change the detector mode during video averaging. Video averaging is available only for trace A, and trace A must be in clear-write mode for ‘video_average’ to operate. After ‘video_average’ is executed, the number of sweeps that have been averaged appears at the top of the analyzer screen. Using video averaging allows you to view changes to the entire trace much faster than using narrow video filters. Narrow video filters require long sweep times, which may not be desired. Video averaging, though requiring more sweeps, uses faster sweep times; in some cases, it can produce a smooth trace as fast as a video filter.

  Type: `str, int`

### FFT & Measurements

HP856Xx.create_fft_trace_window(trace, window_mode)

  Creates a window trace array for the fast Fourier transform (FFT) function.

  The trace-window function creates a trace array according to three built-in algorithms: UNIFORM, HANNING, and FLATTOP. When used with the FFT command, the three algorithms give resultant passband shapes that represent a compromise among amplitude uncertainty, sensitivity, and frequency resolution. Refer to the FFT command description for more information.

  Parameters:

    - trace (str) – A representation of the trace, either from `Trace` or use ‘TRA’ for Trace A or ‘TRB’ for Trace B

    - window_mode (str) – A representation of the window mode, either from `WindowType` or use ‘HANNING’, ‘FLATTOP’ or ‘UNIFORM’

HP856Xx.get_power_bandwidth(trace, percent)

  Measure the combined power of all signal responses contained in a trace array. The command then computes the bandwidth equal to a percentage of the total power. For example, if 100% is specified, the power bandwidth equals the current frequency span. If 50% is specified, trace elements are eliminated from either end of the array, until the combined power of the remaining trace elements equals half of the total power computed. The frequency span of these remaining trace elements is the power bandwidth output to the controller.

  Parameters:

    - trace (str) – A representation of the trace, either from `Trace` or use ‘TRA’ for Trace A or ‘TRB’ for Trace B

    - percent (float) – Percentage of total power 0 … 100 %

      # reset spectrum analyzer
      instr.preset()

      # set to single sweep mode
      instr.sweep_single()

      instr.center_frequency = 300e6
      instr.span = 1e6

      instr.maximum_hold()

      instr.trigger_sweep()

      if instr.done:
          pbw = instr.power_bandwidth(Trace.A, 99.0)
          print("The power bandwidth at 99 percent is %f kHz" % (pbw / 1e3))

HP856Xx.do_fft(source, destination, window)

  Calculate and show a discrete Fourier transform.

  The FFT command performs a discrete Fourier transform on the source trace array and stores the logarithms of the magnitudes of the results in the destination array. The maximum length of any of the traces is 601 points. FFT is designed to be used in transforming zero-span amplitude-modulation information into the frequency domain. Performing an FFT on a frequency sweep will not provide time-domain results. The FFT results are displayed on the spectrum analyzer in a logarithmic amplitude scale. For the horizontal dimension, the frequency at the left side of the graph is 0 Hz, and at the right side is Finax- Fmax is equal to 300 divided by sweep time. As an example, if the sweep time of the analyzer is 60 ms, Fmax equals 5 kHz. The FFT algorithm assumes that the sampled signal is periodic with an integral number of periods within the time-record length (that is, the sweep time of the analyzer). Given this assumption, the transform computed is that of a time waveform of infinite duration, formed of concatenated time records. In actual measurements, the number of periods of the sampled signal within the time record may not be integral. In this case, there is a step discontinuity at the intersections of the concatenated time records in the assumed time waveform of infinite duration. This step discontinuity causes measurement errors, both amplitude uncertainty (where the signal level appears to vary with small changes in frequency) and frequency resolution (due to filter shape factor and sidelobes). Windows are weighting functions that are applied to the input data to force the ends of that data smoothly to zero, thus reducing the step discontinuity and reducing measuremen errors.

  Parameters:

    - source (str) – A representation of the trace, either from `Trace` or use ‘TRA’ for Trace A or ‘TRB’ for Trace B

    - destination (str) – A representation of the trace, either from `Trace` or use ‘TRA’ for Trace A or ‘TRB’ for Trace B

    - window (str) – A representation of the trace, either from `Trace` or use ‘TRA’ for Trace A or ‘TRB’ for Trace B

### Trace

HP856Xx.view_trace(trace)

  Display the current contents of the selected trace, but does not update the contents. View mode may be executed before a sweep is complete when `sweep_single()` and `trigger_sweep()` are not used.

  Parameters:

    trace (str) – A representation of the trace, either from `Trace` or use ‘TRA’ for Trace A or ‘TRB’ for Trace B

  Raises:

    - TypeError – Type isn’t ‘string’

    - ValueError – Value is ‘TRA’ nor ‘TRB’

HP856Xx.get_trace_data_a()

  Get the data of trace A as a list.

  The function returns the 601 data points as a list in the amplitude format. Right now it doesn’t support the linear scaling due to the manual just being wrong.

HP856Xx.get_trace_data_b()

  Get the data of trace B as a list.

  The function returns the 601 data points as a list in the amplitude format. Right now it doesn’t support the linear scaling due to the manual just being wrong.

HP856Xx.set_trace_data_a

  Set the trace data of trace A.

  Warning

  The string based method this attribute is using takes its time. Something around 5000ms timeout at the adapter seems to work well.

HP856Xx.set_trace_data_b

  Set the trace data of trace B also allows to write the data.

  Warning

  The string based method this attribute is using takes its time. Something around 5000ms timeout at the adapter seems to work well.

HP856Xx.trace_data_format

  Control the format used to input and output trace data (see the TRA/TRB command, You must specify the desired format when transferring data from the spectrum analyzer to a computer; this is optional when transferring data to the analyzer.

  Type: `str` or `TraceDataFormat`

  Warning

  Only needed for manual read out of trace data. Don’t use this if you don’t know what You are doing.

HP856Xx.save_trace(trace, number)

  Saves the selected trace in the specified trace register.

  Parameters:

    - trace (str) – A representation of the trace, either from `Trace` or use ‘TRA’ for Trace A or ‘TRB’ for Trace B

    - number (int) – Storage location from 0 … 7 where to store the trace

      instr.preset()
      instr.center_frequency = 300e6
      instr.span = 20e6

      instr.save_trace(Trace.A, 7)
      instr.preset()

      # reload - at 7 stored trace - to Trace B
      instr.recall_trace(Trace.B, 7)

HP856Xx.recall_trace(trace, number)

  Recalls previously saved trace data to the display. See `save_trace()`. Either as Trace A or Trace B.

  Parameters:

    - trace (str) – A representation of the trace, either from `Trace` or use ‘TRA’ for Trace A or ‘TRB’ for Trace B

    - number (int) – Storage location from 0 … 7 where to store the trace

      instr.preset()
      instr.center_frequency = 300e6
      instr.span = 20e6

      instr.save_trace(Trace.A, 7)
      instr.preset()

      # reload - at 7 stored trace - to Trace B
      instr.recall_trace(Trace.B, 7)

HP856Xx.clear_write_trace(trace)

  Set the chosen trace to clear-write mode. This mode sets each element of the chosen trace to the bottom-screen value; then new data from the detector is put in the trace with each sweep.

      instr.clear_write_trace('TRA')
      instr.clear_write_trace(Trace.A)

  Parameters:

    trace (str) – A representation of the trace, either from `Trace` or use ‘TRA’ for Trace A or ‘TRB’ for Trace B

  Raises:

    - TypeError – Type isn’t ‘string’

    - ValueError – Value is ‘TRA’ nor ‘TRB’

HP856Xx.subtract_display_line_from_trace_b()

  Subtract the display line from trace B and places the result in dBm (when in log mode) in trace B, which is then set to view mode.

  In linear mode, the results are in volts.

HP856Xx.exchange_traces()

  Exchange the contents of trace A with those of trace B.

  If the traces are in clear-write or max-hold mode, the mode is changed to view. Otherwise, the traces remain in their initial mode.

HP856Xx.blank_trace(trace)

  Blank the chosen trace from the display. The current contents of the trace remain in the trace but are not updated.

      instr.blank_trace('TRA')
      instr.blank_trace(Trace.A)

  Parameters:

    trace (str) – A representation of the trace, either from `Trace` or use ‘TRA’ for Trace A or ‘TRB’ for Trace B

  Raises:

    - TypeError – Type isn’t ‘string’

    - ValueError – Value is ‘TRA’ nor ‘TRB’

HP856Xx.trace_a_minus_b_plus_dl_enabled

  Control subtraction of trace B from trace A and addition to the display line, and stores the result in dBm (when in log mode) in trace A. When in linear mode, the result is in volts. If trace A is in clear-write or max-hold mode, this function is continuous. When this function is active, an “M” appears on the left side of the display.

  Type: `bool`

  Warning

  The displayed amplitude of each trace element falls in one of 600 data points. There are 10 points of overrange, which corresponds to one-sixth of a division Kg of overrange. When adding or subtracting trace data, any results exceeding this limit are clipped at the limit.

HP856Xx.trace_a_minus_b_enabled

  Control subtraction of the contents of trace B from trace A. It places the result, in dBm (when in log mode), in trace A. When in linear mode, the result is in volts. If trace A is in clear-write or max-hold mode, this function is continuous. When AMB is active, an “M” appears on the left side of the display. `trace_a_minus_b_plus_dl` overrides AMB.

  Type: `bool`

  Warning

  The displayed amplitude of each trace element falls in one of 600 data points. There are 10 points of overrange, which corresponds to one-sixth of a division Kg of overrange. When adding or subtracting trace data, any results exceeding this limit are clipped at the limit.

### Marker

HP856Xx.search_peak(mode)

  Place a marker on the highest point on a trace, the next-highest point, the next-left peak, or the next-right peak. The default is ‘HI’ (highest point). The trace peaks must meet the criteria of the marker threshold and peak excursion functions in order for a peak to be found. See also the `peak_threshold` and `peak_excursion` commands.

  Parameters:

    mode (str) – Takes ‘HI’, ‘NH’, ‘NR’, ‘NL’ or the enumeration `PeakSearchMode`

      instr.search_peak('NL')
      instr.search_peak(PeakSearchMode.NextHigh)

HP856Xx.marker_amplitude

  Get the amplitude of the active marker. If no marker is active, MKA places a marker at the center of the trace and returns that amplitude value. In the `amplitude_unit()` unit.

  Type: `float`

      level = instr.marker_amplitude
      unit = instr.amplitude_unit
      print("Level: %f %s" % (level, unit))

HP856Xx.set_marker_to_center_frequency()

  Set the center frequency to the frequency value of an active marker.

HP856Xx.marker_delta

  Control a second marker on the trace. The parameter value specifies the distance in frequency or time (when in zero span) between the two markers. If queried - returns the frequency or time of the second marker.

  Type: `float`

      # place second marker 1 MHz apart from the first marker
      instr.marker_delta = 1e6

      # print frequency of second marker in case it got moved automatically
      print(instr.marker_delta)

HP856Xx.marker_frequency

  Control the frequency of the active marker. Default units are in Hertz.

  Type: `float`

      # place marker no. 1 at 100 MHz
      instr.marker_frequency = 100e6

      # print frequency of the marker in case it got moved automatically
      print(instr.marker_frequency)

  (dynamic)

HP856Xx.set_marker_minimum()

  Place an active marker on the minimum signal detected on a trace.

HP856Xx.marker_noise_mode_enabled

  Control the detector mode to sample and compute the average of 32 data points (16 points on one side of the marker, the marker itself, and 15 points on the other side of the marker). This average is corrected for effects of the log or linear amplifier, bandwidth shape factor, IF detector, and resolution bandwidth. If two markers are on (whether in ‘marker_delta’ mode or 1/marker delta mode), ‘marker_noise_mode_enabled’ works on the active marker and not on the anchor marker. This allows you to measure signal-to-noise density directly. To query the value, use the ‘marker_amplitude’ command.

  Type: `bool`

      # activate signal-to-noise density mode
      instr.marker_noise_mode_enabled = True

      # get noise density by `marker_amplitude`
      print("Signal-to-noise density: %d dbm / Hz" % instr.marker_amplitude)

HP856Xx.deactivate_marker(all_markers=False)

  Turn off the active marker or, if specified, turn off all markers.

  Parameters:

    all_markers (bool) – If True the call deactivates all markers, if false only the currently active marker (optional)

      # place first marker at 300 MHz
      instr.marker_frequency = 300e6

      # place second marker 2 MHz apart from first
      instr.marker_delta = 2e6

      # deactivate active marker (delta marker)
      instr.deactivate_marker()

      # deactivate all markers
      instr.deactivate_marker(all_markers=True)

HP856Xx.marker_threshold

  Control the minimum amplitude level from which a peak on the trace can be detected. The default value is -130 dBm. See also the `peak_excursion` command. Any portion of a peak that falls below the peak threshold is used to satisfy the peak excursion criteria. For example, a peak that is equal to 3 dB above the threshold when the peak excursion is equal to 6 dB will be found if the peak extends an additional 3 dB or more below the threshold level. Maximum 30 db to minimum -200 db.

  Type: `signed int`

      instr.marker_threshold = -70
      if instr.marker_threshold > -80:
          pass

HP856Xx.peak_excursion

  Control what constitutes a peak on a trace. The chosen value specifies the amount that a trace must increase monotonically, then decrease monotonically, in order to be a peak. For example, if the peak excursion is 10 dB, the amplitude of the sides of a candidate peak must descend at least 10 dB in order to be considered a peak (see Figure 5-4) The default value is 6 dB. In linear mode, enter the marker peak excursion as a unit-less number. Any portion of a peak that falls below the peak threshold is also used to satisfy the peak excursion criteria. For example, a peak that is equal to 3 dB above the threshold when the peak excursion is equal to 6 dB will be found if the peak extends an additional 3 dB or more below the threshold level.

  Type: `float`

      instr.peak_excursion = 2
      if instr.peak_excursion == 2:
          pass

HP856Xx.set_marker_to_reference_level()

  Set the reference level to the amplitude of an active marker.

  If no marker is active, ‘marker_to_reference_level’ places a marker at the center of the trace and uses that marker amplitude to set the reference level.

HP856Xx.set_marker_delta_to_span()

  Set the frequency span equal to the frequency difference between two markers on a trace.

  The start frequency is set equal to the frequency of the left- most marker and the stop frequency is set equal to the frequency of the right-most marker.

HP856Xx.set_marker_to_center_frequency_step_size()

  Set the center frequency step-size equal to the frequency value of the active marker.

HP856Xx.marker_time

  Control the marker’s time value. Default units are seconds.

  Type: `float`

      # set marker at sweep time corresponding second two
      instr.marker_time = 2

      if instr.marker_time == 2:
          pass

HP856Xx.marker_signal_tracking_enabled

  Control whether the center frequency follows the active marker.

  This is done after every sweep, thus maintaining the marker value at the center frequency. This allows you to “zoom in” quickly from a wide span to a narrow one, without losing the signal from the screen. Or, use ‘marker_signal_tracking_enabled’ to keep a slowly drifting signal centered on the display. When this function is active, a “K” appears on the left edge of the display.

  Type: `bool`

### Diagnostic Values

HP856Xx.sampling_frequency

  Get the sampling oscillator frequency corresponding to the current start frequency. Diagnostic Attribute

  Type: `float`

HP856Xx.lo_frequency

  Get the first local oscillator frequency corresponding to the current start frequency. Diagnostic Attribute

  Type: `float`

HP856Xx.mroll_frequency

  Get the main roller oscillator frequency corresponding to the current start frequency, except then the resolution bandwidth is less than or equal to 100 Hz.

  Diagnostic Attribute

  Type: `float`

HP856Xx.oroll_frequency

  Get the offset roller oscillator frequency corresponding to the current start frequency, except when the resolution bandwidth is less than or equal to 100 Hz.

  Diagnostic Attribute

  Type: `float`

HP856Xx.xroll_frequency

  Get the transfer roller oscillator frequency corresponding to the current start frequency, except when the resolution bandwidth is less than or equal to 100 Hz.

  Diagnostic Attribute

  Type: `float`

HP856Xx.sampler_harmonic_number

  Get the sampler harmonic number corresponding to the current start frequency.

  Diagnostic Attribute

  Type: `int`

### Sweep

HP856Xx.sweep_single = <function HP856Xx.sweep_single>

HP856Xx.sweep_time

  Control the sweep time. This is normally a coupled function which is automatically set to the optimum value allowed by the current instrument settings. Alternatively, you may specify the sweep time. Note that when the specified sweep time is too fast for the current instrument settings, the instrument is no longer calibrated and the message ‘MEAS UNCAL’ appears on the display. The sweep time cannot be adjusted when the resolution bandwidth is set to 10 Hz, 30 Hz, or 100 Hz.

  Type: `str, float`

  Real from 50E—3 to 100 when the span is greater than 0 Hz; 50E—6 to 60 when the span equals 0 Hz. When the resolution bandwidth is <100 Hz, the sweep time cannot be adjusted.

HP856Xx.sweep_couple

  Control the sweep couple mode which is either a stimulus-response or spectrum-analyzer auto-coupled sweep time. In stimulus-response mode, auto-coupled sweep times are usually much faster for swept-response measurements. Stimulus-response auto-coupled sweep times are typicallly valid in stimulus-response measurements when the system’s frequency span is less than 20 times the bandwidth of the device under test.

  Type: `str` or `SweepCoupleMode`

HP856Xx.sweep_output

  Control the sweep-related signal that is available from J8 on the rear panel. FAV provides a dc ramp of 0.5V/GHz. RAMP provides a 0—10 V ramp corresponding to the sweep ramp that tunes the first local oscillator (LO). For the HP 8561B, in multiband sweeps one ramp is provided for each frequency band.

  Type: `str` or `SweepOut`

HP856Xx.set_continuous_sweep = <function HP856Xx.set_continuous_sweep>

HP856Xx.trigger_sweep()

  Command the spectrum analyzer to take one full sweep across the trace display. Commands following TS are not executed until after the analyzer has finished the trace sweep. This ensures that the instrument is set to a known condition before subsequent commands are executed.

### Normalization

HP856Xx.normalize_trace_data_enabled

  Control the normalization routine for stimulus-response measurements. This function subtracts trace B from trace A, offsets the result by the value of the normalized reference position (`normalized_reference_level`), and displays the result in trace A. ‘normalize_trace_data_enabled’ is intended for use with the `store_open()` and `store_short()` or `store_thru()` commands. These functions are used to store a reference trace into trace B. Refer to the respective command descriptions for more information. Accurate normalization occurs only if the reference trace and the measured trace are on-screen. If any of these traces are off-screen, an error message will be displayed. If the error message ERR 903 A > DLMT is displayed, the range level (RL) can be adjusted to move the measured response within the displayed measurement range of the analyzer. If ERR 904 B > DLMT is displayed, the calibration is invalid and a thru or open/short calibration must be performed. If active (ON), the ‘normalize_trace_data’ command is automatically turned off with an instrument preset (IP) or at power on.

  Type: `bool`

HP856Xx.normalized_reference_level

  Control the normalized reference level. It is intended to be used with the `normalize_trace_data` command. When using ‘normalized_reference_level’, the input attenuator and IF step gains are not affected. This function is a trace-offset function enabling the user to offset the displayed trace without introducing hardware-switching errors into the stimulus-response measurement. The unit of measure for ‘normalized_reference_level’ is dB. In absolute power mode (dBm), reference level ( `reference_level`) affects the gain and RF attenuation settings of the instrument, which affects the measurement or dynamic range. In normalized mode (relative power or dB-measurement mode), NRL offsets the trace data on-screen and does not affect the instrument gain or attenuation settings. This allows the displayed normalized trace to be moved without decreasing the measurement accuracy due to changes in gain or RF attenuation. If the measurement range must be changed to bring trace data on-screen, then the range level should be adjusted. Adjusting the range-level normalized mode has the same effect on the instrument settings as does reference level in absolute power mode (normalize off).

  Type: `int`

      # reference level in case of normalization to -30 DB
      instr.normalized_reference_level = -30

      if instr.normalized_reference_level == -30:
          pass

HP856Xx.normalized_reference_position

  Control the normalized reference-position that corresponds to the position on the graticule where the difference between the measured and calibrated traces resides. The dB value of the normalized reference-position is equal to the normalized reference level. The normalized reference-position may be adjusted between 0.0 and 10.0, corresponding to the bottom and top graticule lines, respectively.

  Type: `float`

      instr.normalized_reference_position = 5.5

      if instr.normalized_reference_position == 5.5:
          pass

### Open/Short Calibration (Reflection)

HP856Xx.recall_open_short_average()

  Set the internally stored open/short average reference trace into trace B. The instrument state is also set to the stored open/short reference state.

      instr.preset()
      instr.sweep_single()
      instr.start_frequency = 300e3
      instr.stop_frequency = 1e9

      instr.source_power_enabled = True
      instr.sweep_couple = SweepCoupleMode.StimulusResponse
      instr.source_peak_tracking()

      input("CONNECT OPEN. PRESS CONTINUE WHEN READY TO STORE.")
      instr.trigger_sweep()
      instr.done()
      instr.store_open()

      input("CONNECT SHORT. PRESS CONTINUE WHEN READY TO STORE AND AVERAGE.")
      instr.trigger_sweep()
      instr.done()
      instr.store_short()

      input("RECONNECT DUT. PRESS CONTINUE WHEN READY.")
      instr.trigger_sweep()
      instr.done()

      instr.normalize = True

      instr.trigger_sweep()
      instr.done()

      instr.normalized_reference_position = 8
      instr.trigger_sweep()

      instr.preset()
      # demonstrate recall of open/short average trace
      instr.recall_open_short_average()
      instr.trigger_sweep()

HP856Xx.store_open()

  Save the current instrument state and trace A into nonvolatile memory.

  This command must be used in conjunction with the `store_short()` command and must precede the `store_short()` command. The data obtained during the store open procedure is averaged with the data obtained during the `store_short()` procedure to provide an open/short calibration. The instrument state (that is, instrument settings) must not change between the `store_open()` and `store_short()` operations in order for the open/short calibration to be valid. Refer to the `store_short()` command description for more information.

HP856Xx.store_short()

  Take currently displayed trace A data and averages this data with previously stored open data, and stores it in trace B.

  This command is used in conjunction with the `store_open()` command and must be preceded by it for proper operation. Refer to the `store_open()` command description for more information. The state of the open/short average trace is stored in state register #8.

### Thru Calibration

HP856Xx.store_thru()

  Store a thru-calibration trace into trace B and into the nonvolatile memory of the spectrum analyzer.

  The state of the thru information is stored in state register #9.

HP856Xx.recall_thru()

  Recalls the internally stored thru-reference trace into trace B.

  The instrument state is also set to the stored thru-reference state.

## HP8560A Specific Attributes & Methods

class pymeasure.instruments.hp.HP8560A(adapter, name='Hewlett-Packard HP8560A', **kwargs)

  Bases: `HP856Xx`

  Represents the HP 8560A Spectrum Analyzer and provides a high-level interface for interacting with the instrument.

      from pymeasure.instruments.hp import HP8560A
      from pymeasure.instruments.hp.hp856Xx import AmplitudeUnits

      sa = HP8560A("GPIB::1")

      sa.amplitude_unit = AmplitudeUnits.DBUV
      sa.start_frequency = 299.5e6
      sa.stop_frequency = 300.5e6

      print(sa.marker_amplitude)

  activate_source_peak_tracking()

    Activate a routine which automatically adjusts both the coarse and fine-tracking adjustments to obtain the peak response of the tracking generator on the spectrum-analyzer display. Tracking peak is not necessary for resolution bandwidths greater than or equal to 300 kHz. A thru connection should be made prior to peaking in order to ensure accuracy.

    Note

    Only available with an HP 8560A Option 002.

  property source_leveling_control

    Control if internal or external leveling is used with the built-in tracking generator. Takes either ‘INT’, ‘EXT’ or members of enumeration `SourceLevelingControlMode`

    Type: `str`

        instr.preset()
        instr.sweep_single()
        instr.center_frequency = 300e6
        instr.span = 1e6

        instr.source_power = -5

        instr.trigger_sweep()
        instr.source_leveling_control = SourceLevelingControlMode.External

        if ErrorCode(900) in instr.errors:
            print("UNLEVELED CONDITION. CHECK LEVELING LOOP.")

    Note

    Only available with an HP 8560A Option 002.

  property source_power

    Control the built-in tracking generator’s output power.

    Type: `str, float`

    Note

    Only available with an HP 8560A Option 002.

  property source_power_enabled

    Set the built-in tracking generator on or off. See `source_power`

  property source_power_offset

    Control the offset of the displayed power of the built-in tracking generator so that it is equal to the measured power at the input of the spectrum analyzer. This function may be used to take into account system losses (for example, cable loss) or gains (for example, preamplifier gain) reflecting the actual power delivered to the device under test.

    Type: `int`

    Note

    Only available with an HP 8560A Option 002.

  property source_power_step

    Control the step size of the source power level, source power offset, and power-sweep range functions. Range: 0.1 … 12.75 DB with 0.05 steps.

    Type: `float`

    Note

    Only available with an HP 8560A Option 002.

  property source_power_sweep

    Control the power-sweep function, where the output power of the tracking generator is swept over the power-sweep range chosen. The starting source power level is set using the `source_power` command. The output power of the tracking generator is swept according to the sweep rate of the spectrum analyzer.

    Type: `str, float`

    Note

    Only available with an HP 8560A Option 002.

  property source_power_sweep_enabled

    Set the power sweep active or inactive. See `source_power_sweep`.

  property tracking_adjust_coarse

    Control the coarse adjustment to the frequency of the built-in tracking-generator oscillator. Once enabled, this adjustment is made in digital-to-analogconverter (DAC) values from 0 to 255. For fine adjustment, refer to the `tracking_adjust_fine` command description.

    Type: `int`

    Note

    Only available with an HP 8560A Option 002.

  property tracking_adjust_fine

    Control the fine adjustment of the frequency of the built-in tracking-generator oscillator. Once enabled, this adjustment is made in digital-to-analogconverter (DAC) values from 0 to 255. For coarse adjustment, refer to the `tracking_adjust_coarse` command description.

    Type: `int`

    Note

    Only available with an HP 8560A Option 002.

## HP8561B Specific Attributes & Methods

class pymeasure.instruments.hp.HP8561B(adapter, name='Hewlett-Packard HP8561B', **kwargs)

  Bases: `HP856Xx`

  Represents the HP 8561B Spectrum Analyzer and provides a high-level interface for interacting with the instrument.

      from pymeasure.instruments.hp import 8561B
      from pymeasure.instruments.hp.hp856Xx import AmplitudeUnits

      sa = HP8560A("GPIB::1")

      sa.amplitude_unit = AmplitudeUnits.DBUV
      sa.start_frequency = 6.4e9
      sa.stop_frequency = 6.5e9

      print(sa.marker_amplitude)

  property conversion_loss

    Control the compensation for losses outside the instrument when in external mixer mode (such as losses within connector cables, external mixers, etc.). ‘conversion_loss’ specifies the mean conversion loss for the current harmonic band. In a full frequency band (such as band K), the mean conversion loss is defined as the minimum loss plus the maximum loss for that band divided by two. Adjusting for conversion loss allows the system to remain calibrated (that is, the displayed amplitude values have the conversion loss incorporated into them). The default value for any band is 30 dB. The spectrum analyzer must be in external-mixer mode in order for this command to work. When in internal-mixer mode, querying ‘conversion_loss’ returns a zero.

  property harmonic_number_lock

    Control the lock to a chosen harmonic so only that harmonic is used to sweep an external frequency band. To select a frequency band, use the ‘fullband’ command; it selects an appropriate harmonic for the desired band. To change the harmonic number, use ‘harmonic_number_lock’. Note that ‘harmonic_number_lock’ also works in internal-mixing modes. Once ‘fullband’ or ‘harmonic_number_lock’ are set, only center frequencies and spans that fall within the frequency band of the current harmonic may be entered. When the ‘set_full_span’ command is activated, the span is limited to the frequency band of the selected harmonic.

  property harmonic_number_lock_enabled

    Set the harmonic number locking active or inactive. See `harmonic_number_lock`.

  property mixer_bias

    Set the bias for an external mixer that requires diode bias for efficient mixer operation. The bias, which is provided on the center conductor of the IF input, is activated when MBIAS is executed. A “+” or “—” appears on the left edge of the spectrum analyzer display, indicating that positive or negative bias is on. When the bias is turned off, MBIAS is set to 0. Default units are in milliamps.

  property mixer_bias_enabled

    Control the bias for an external mixer. See `mixer_bias`.

  property mixer_mode

    Control the mixer mode. Select either the internal mixer or supply an external mixer. Takes enum ‘MixerMode’ or string ‘INT’, ‘EXT’

  peak_preselector()

    Peaks the preselector in the HP 8561B Spectrum Analyzer.

    Make sure the entire frequency span is in high band, set the desired trace to clear-write mode, place a marker on a desired signal, then execute PP. The peaking routine zooms to zero span, peaks the preselector tracking, then returns to the original position. To read the new preselector peaking number, use the PSDAC command. Commands following PP are not executed until after the analyzer has finished peaking the preselector.

  property preselector_dac_number

    Control the preselector peak DAC number. For use with an HP 8561B Spectrum Analyzer.

    Type: `int`

  set_fullband(band)

    Select a commonly-used, external-mixer frequency band, as shown in the table. The harmonic lock function `harmonic_number_lock` is also set; this locks the harmonic of the chosen band. External-mixing functions are not available with an HP 8560A Option 002. Takes frequency band letter as string.

    Title
    Frequency Band | Frequency Range (GHz) | Mixing Harmonic | Conversion Loss
    --- | --- | --- | ---
    K | 18.0 — 26.5 | 6 | 30 dB
    A | 26.5 — 40.0 | 8 | 30 dB
    Q | 33.0—50.0 | 10 | 30 dB
    U | 40.0—60.0 | 10 | 30 dB
    V | 50.0—75.0 | 14 | 30 dB
    E | 60.0—-90.0 | 16 | 30 dB
    W | 75.0—110.0 | 18 | 30 dB
    F | 90.0—140.0 | 24 | 30 dB
    D | 110.0—170.0 | 30 | 30 dB
    G | 140.0—220.0 | 36 | 30 dB
    Y | 170.0—260.0 | 44 | 30 dB
    J | 220.0—325.0 | 54 | 30 dB

  set_signal_identification_to_center_frequency()

    Set the center frequency to the frequency obtained from the command SIGID.

    SIGID must be in AUTO mode and have found a valid result for this command to execute properly. Use SIGID on signals greater than 18 GHz {i.e., in external mixing mode). SIGID and IDCF may also be used on signals less than 6.5 GHz in an HP 8561B.

  property signal_identification

    Control the signal identification for identifying signals for the external mixing frequency bands. Two signal identification methods are available. AUTO employs the image response method for locating correct mixer responses. Place a marker on the desired signal, then activate signal_identification = ‘AUTO’. The frequency of a correct response appears in the active function block. Use this mode before executing the `signal_identification_to_center_frequency()` command. The second method of signal identification, ‘MAN’, shifts responses both horizontally and vertically. A correct response is shifted horizontally by less than 80 kHz. To ensure accuracy in MAN mode, limit the frequency span to less than 20 MHz. Where True = manual mode is active and False = auto mode is active or ‘signal_identification’ is off.

  property signal_identification_frequency

    Measure the frequency of the last identified signal. After an instrument preset or an invalid signal identification, IDFREQ returns a “0”.

  unlock_harmonic_number()

    Unlock the harmonic number, allowing you to select frequencies and spans outside the range of the locked harmonic number.

    Also, when HNUNLK is executed, more than one harmonic can then be used to sweep across a desired span. For example, sweep a span from 18 GHz to 40 GHz. In this case, the analyzer will automatically sweep first using 6—, then using 8—.

## Enumerations

class pymeasure.instruments.hp.hp856Xx.AmplitudeUnits(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent the amplitude units.

  AUTO = 'AUTO'

    Automatic Unit (Usually derives to ‘DBM’)

  DBM = 'DBM'

    DB over millit Watt

  DBMV = 'DBMV'

    DB over milli Volt

  DBUV = 'DBUV'

    DB over micro Volt

  MANUAL = 'MAN'

    Manual Mode

  V = 'V'

    Volts

  W = 'W'

    Watt

class pymeasure.instruments.hp.hp856Xx.MixerMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent the Mixer Mode of the HP8561B.

  External = 'EXT'

    Mixer Mode External

  Internal = 'INT'

    Mixer Mode Internal

class pymeasure.instruments.hp.hp856Xx.Trace(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent either Trace A or Trace B.

  A = 'TRA'

    Trace A

  B = 'TRB'

    Trace B

class pymeasure.instruments.hp.hp856Xx.CouplingMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent the Coupling Mode.

  AC = 'AC'

    AC

  DC = 'DC'

    DC

class pymeasure.instruments.hp.hp856Xx.DemodulationMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent the Demodulation Mode.

  Amplitude = 'AM'

    Amplitude Modulation

  Frequency = 'FM'

    Frequency Modulation

  Off = 'OFF'

    Demodulation Off

class pymeasure.instruments.hp.hp856Xx.DetectionModes(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent the Detection Modes.

  NegativePeak = 'NEG'

    Negative Peak Detection

  Normal = 'NRM'

    Normal Peak Detection

  PositivePeak = 'POS'

    Positive Peak Detection

  Sample = 'SMP'

    Sampl Mode Detection

class pymeasure.instruments.hp.hp856Xx.ErrorCode(code)

  Bases: `object`

  Class to decode error codes from the spectrum analyzer.

class pymeasure.instruments.hp.hp856Xx.FrequencyReference(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent the frequency reference source.

  External = 'EXT'

    External Frequency Standard

  Internal = 'INT'

    Internal Frequency Reference

class pymeasure.instruments.hp.hp856Xx.PeakSearchMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent the Marker Peak Search Mode.

  High = 'HI'

    Place marker to the highest value on the trace

  NextHigh = 'NH'

    Place marker to the next highest value on the trace

  NextLeft = 'NL'

    Place marker to the next peak to the left

  NextRight = 'NR'

    Place marker to the next peak to the right

class pymeasure.instruments.hp.hp856Xx.SourceLevelingControlMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent the Source Leveling Control Mode of the HP8560A.

  External = 'EXT'

    Source Leveling Control Mode External

  Internal = 'INT'

    Source Leveling Control Mode Internal

class pymeasure.instruments.hp.hp856Xx.StatusRegister(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntFlag`

  Enumeration to represent the Status Register.

  COMMAND_COMPLETE = 16

    Any command is completed

  END_OF_SWEEP = 4

    Set when any sweep is completed

  ERROR_PRESENT = 32

    Set when error present

  MESSAGE = 2

    Set when display message appears

  NA = 8

    Unused but sometimes set

  NONE = 0

    No Interrupts can interrupt the program sequence

  RQS = 64

    Request Service

  TRIGGER = 1

    Trigger is activated

class pymeasure.instruments.hp.hp856Xx.SweepCoupleMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration.

  SpectrumAnalyzer = 'SA'

    Stimulus Response

  StimulusResponse = 'SR'

    Spectrum Analyeze

class pymeasure.instruments.hp.hp856Xx.SweepOut(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration.

  Fav = 'FAV'

    DC Ramp 0.5V / GHz

  Ramp = 'RAMP'

    0 - 10V Ramp

class pymeasure.instruments.hp.hp856Xx.TriggerMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent the different trigger modes

  External = 'EXT'

    External Mode

  Free = 'FREE'

    Free Running

  Line = 'LINE'

    Line Mode

  Video = 'VID'

    Video Mode

class pymeasure.instruments.hp.hp856Xx.WindowType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `StrEnum`

  Enumeration to represent the different window mode for FFT functions

  Flattop = 'FLATTOP'

    Flattop provides optimum amplitude accuracy

  Hanning = 'HANNING'

    Hanning provides an amplitude accuracy/frequency resolution compromise

  Uniform = 'UNIFORM'

    Uniform provides equal weighting of the time record for measuring transients.