# Agilent 4155/4156 Semiconductor Parameter Analyzer

class pymeasure.instruments.agilent.agilent4156.Agilent4156(resourceName, **kwargs)

  Bases: `Instrument`

  Represents the Agilent 4155/4156 Semiconductor Parameter Analyzer and provides a high-level interface for taking current-voltage (I-V) measurements.

      from pymeasure.instruments.agilent import Agilent4156

      # explicitly define r/w terminations; set sufficiently large timeout or None.
      smu = Agilent4156("GPIB0::25", read_termination = '\n', write_termination = '\n', timeout=None)

      # reset the instrument
      smu.reset()

      # define configuration file for instrument and load config
      smu.configure("configuration_file.json")

      # save data variables, some or all of which are defined in the json config file.
      smu.save(['VC', 'IC', 'VB', 'IB'])

      # take measurements
      status = smu.measure()

      # measured data is a pandas dataframe and can be exported to csv.
      data = smu.get_data(path='./t1.csv')

  The JSON file is an ascii text configuration file that defines the settings of each channel on the instrument. The JSON file is used to configure the instrument using the convenience function `configure()` as shown in the example above. For example, the instrument setup for a bipolar transistor measurement is shown below.

      {
             "SMU1": {
                 "voltage_name" : "VC",
                 "current_name" : "IC",
                 "channel_function" : "VAR1",
                 "channel_mode" : "V",
                 "series_resistance" : "0OHM"
             },

             "SMU2": {
                 "voltage_name" : "VB",
                 "current_name" : "IB",
                 "channel_function" : "VAR2",
                 "channel_mode" : "I",
                 "series_resistance" : "0OHM"
             },

             "SMU3": {
                 "voltage_name" : "VE",
                 "current_name" : "IE",
                 "channel_function" : "CONS",
                 "channel_mode" : "V",
                 "constant_value" : 0,
                 "compliance" : 0.1
             },

              "SMU4": {
                 "voltage_name" : "VS",
                 "current_name" : "IS",
                 "channel_function" : "CONS",
                 "channel_mode" : "V",
                 "constant_value" : 0,
                 "compliance" : 0.1
             },

             "VAR1": {
                 "start" : 1,
                 "stop" : 2,
                 "step" : 0.1,
                 "spacing" : "LINEAR",
                 "compliance" : 0.1
             },

             "VAR2": {
                 "start" : 0,
                 "step" : 10e-6,
                 "points" : 3,
                 "compliance" : 2

             }
         }

  property analyzer_mode

    A string property that controls the instrument operating mode.

    - Values: `SWEEP`, `SAMPLING`

        smu.analyzer_mode = "SWEEP"

  configure(config_file)

    Convenience function to configure the channel setup and sweep using a JSON (JavaScript Object Notation) configuration file.

    Parameters:

      config_file – JSON file to configure instrument channels.

        instr.configure('config.json')

  property data_variables

    Gets a string list of data variables for which measured data is available. This looks for all the variables saved by the `save()` and `save_var()` methods and returns it. This is useful for creation of dataframe headers.

    Returns:

      List

        header = instr.data_variables

  property delay_time

    A floating point property that measurement delay time in seconds, which can take the values from 0 to 65s in 0.1s steps.

        instr.delay_time = 1 # delay time of 1-sec

  disable_all()

    Disables all channels in the instrument.

        instr.disable_all()

  get_data(path=None)

    Gets the measurement data from the instrument after completion. If the measurement period is set to `INF` in the `measure()` method, then the measurement must be stopped using `stop()` before getting valid data.

    Parameters:

      path – Path for optional data export to CSV.

    Returns:

      Pandas Dataframe

        df = instr.get_data(path='./datafolder/data1.csv')

  property hold_time

    A floating point property that measurement hold time in seconds, which can take the values from 0 to 655s in 1s steps.

        instr.hold_time = 2 # hold time of 2-secs.

  property integration_time

    A string property that controls the integration time.

    - Values: `SHORT`, `MEDIUM`, `LONG`

        instr.integration_time = "MEDIUM"

  measure(period='INF', points=100)

    Performs a single measurement and waits for completion in sweep mode. In sampling mode, the measurement period and number of points can be specified.

    Parameters:

      - period – Period of sampling measurement from 6E-6 to 1E11 seconds. Default setting is `INF`.

      - points – Number of samples to be measured, from 1 to 10001. Default setting is `100`.

  save(trace_list)

    Save the voltage or current in the instrument display list

    Parameters:

      trace_list – A list of channel variables whose measured data should be saved. A maximum of 8 variables are allowed. If only one variable is being saved, a string can be specified.

        instr.save(['IC', 'IB', 'VC', 'VB']) #for list of variables
        instr.save('IC')    #for single variable

  save_var(trace_list)

    Save the voltage or current in the instrument variable list. This is useful if one or two more variables need to be saved in addition to the 8 variables allowed by `save()`.

    Parameters:

      trace_list – A list of channel variables whose measured data should be saved. A maximum of 2 variables are allowed. If only one variable is being saved, a string can be specified.

        instr.save_var(['VA', 'VB'])

  stop()

    Stops the ongoing measurement

        instr.stop()

class pymeasure.instruments.agilent.agilent4156.SMU(resourceName, channel, **kwargs)

  Bases: `Instrument`

  property channel_function

    A string property that controls the SMU<n> channel function.

    - Values: `VAR1`, `VAR2`, `VARD` or `CONS`.

        instr.smu1.channel_function = "VAR1"

  property channel_mode

    A string property that controls the SMU<n> channel mode.

    - Values: `V`, `I` or `COMM`

    VPULSE AND IPULSE are not yet supported.

        instr.smu1.channel_mode = "V"

  property compliance

    This command sets the constant compliance value of SMU<n>. If the SMU channel is setup as a variable (VAR1, VAR2, VARD) then compliance limits are set by the variable definition.

    - Value: Voltage in (-200V, 200V) and current in (-1A, 1A) based on `channel_mode()`.

        instr.smu1.compliance = 0.1

  property constant_value

    This command sets the constant source value of SMU<n>. You use this command only if `channel_function()` is `CONS` and also `channel_mode()` should not be `COMM`.

    Parameters:

      const_value – Voltage in (-200V, 200V) and current in (-1A, 1A). Voltage or current depends on if `channel_mode()` is set to `V` or `I`.

        instr.smu1.constant_value = 1

  property current_name

    Define the current name of the channel.

    If input is greater than 6 characters long or starts with a number, the name is autocorrected and prepended with ‘a’. Event is logged.

        instr.smu1.current_name = "Ibase"

  property disable

    This command deletes the settings of SMU<n>.

        instr.smu1.disable()

  property series_resistance

    This command controls the series resistance of SMU<n>.

    - Values: `0OHM`, `10KOHM`, `100KOHM`, or `1MOHM`

        instr.smu1.series_resistance = "10KOHM"

  property voltage_name

    Define the voltage name of the channel.

    If input is greater than 6 characters long or starts with a number, the name is autocorrected and prepended with ‘a’. Event is logged.

        instr.smu1.voltage_name = "Vbase"

class pymeasure.instruments.agilent.agilent4156.VAR1(resourceName, **kwargs)

  Bases: `VARX`

  Class to handle all the specific definitions needed for VAR1. Most common methods are inherited from base class.

  property spacing

    This command selects the sweep type of VAR1.

    - Values: `LINEAR`, `LOG10`, `LOG25`, `LOG50`.

class pymeasure.instruments.agilent.agilent4156.VAR2(resourceName, **kwargs)

  Bases: `VARX`

  Class to handle all the specific definitions needed for VAR2. Common methods are imported from base class.

  property points

    This command sets the number of sweep steps of VAR2. You use this command only if there is an SMU or VSU whose function (FCTN) is VAR2.

        instr.var2.points = 10

class pymeasure.instruments.agilent.agilent4156.VARD(resourceName, **kwargs)

  Bases: `Instrument`

  Class to handle all the definitions needed for VARD. VARD is always defined in relation to VAR1.

  property compliance

    This command sets the sweep COMPLIANCE value of VARD.

        instr.vard.compliance = 0.1

  property offset

    This command sets the OFFSET value of VARD. For each step of sweep, the output values of VAR1’ are determined by the following equation: VARD = VAR1 X RATio + OFFSet You use this command only if there is an SMU or VSU whose function is VARD.

        instr.vard.offset = 1

  property ratio

    This command sets the RATIO of VAR1’. For each step of sweep, the output values of VAR1’ are determined by the following equation: VAR1’ = VAR1 * RATio + OFFSet You use this command only if there is an SMU or VSU whose function (FCTN) is VAR1’.

        instr.vard.ratio = 1

class pymeasure.instruments.agilent.agilent4156.VARX(resourceName, var_name, **kwargs)

  Bases: `Instrument`

  Base class to define sweep variable settings

  property compliance

    Sets the sweep COMPLIANCE value.

        instr.var1.compliance = 0.1

  property start

    Sets the sweep START value.

        instr.var1.start = 0

  property step

    Sets the sweep STEP value.

        instr.var1.step = 0.1

  property stop

    Sets the sweep STOP value.

        instr.var1.stop = 3

class pymeasure.instruments.agilent.agilent4156.VMU(resourceName, channel, **kwargs)

  Bases: `Instrument`

  property channel_mode

    A string property that controls the VMU<n> channel mode.

    - Values: `V`, `DVOL`

  property disable

    This command disables the settings of VMU<n>.

        instr.vmu1.disable()

  property voltage_name

    Define the voltage name of the VMU channel.

    If input is greater than 6 characters long or starts with a number, the name is autocorrected and prepended with ‘a’. Event is logged.

        instr.vmu1.voltage_name = "Vanode"

class pymeasure.instruments.agilent.agilent4156.VSU(resourceName, channel, **kwargs)

  Bases: `Instrument`

  property channel_function

    A string property that controls the VSU channel function.

    - Value: `VAR1`, `VAR2`, `VARD` or `CONS`.

  property channel_mode

    Get channel mode of VSU<n>.

  property constant_value

    This command sets the constant source value of VSU<n>.

        instr.vsu1.constant_value = 0

  property disable

    This command deletes the settings of VSU<n>.

        instr.vsu1.disable()

  property voltage_name

    Define the voltage name of the VSU channel

    If input is greater than 6 characters long or starts with a number, the name is autocorrected and prepended with ‘a’. Event is logged.

        instr.vsu1.voltage_name = "Ve"