Instrument for the function generator¶
This class (fun_gen.py) is the model to control the function generator agilent33522A It ads the use of units with pint.
copyright: | by Hyperion Authors, see AUTHORS for more details. |
---|---|
license: | BSD, see LICENSE for more details. |
-
class
hyperion.instrument.function_generator.fun_gen.
FunGen
(settings)¶ This class is to control the function generator.
Parameters: settings (dict) – to parse the settings needed. Some keys are needed: ‘controller’ and ‘instrument_id’ -
enable_output
(ch, state)¶ Enables the output to the device
Parameters: - ch (int) – channel to use
- state (logical) – type to set the output on and off (True and False, respectively)
-
enable_voltage_limits
(channel, state)¶ This function enables the limits for the maximum and minimum voltage output that can be generated by each channel. Those values are set with the method set_voltage_limits(channel, high, low).
This function enables this setting by putting state = true and disables it by putting state = false. When enable, setting a voltage outside the permitted values will give an error (not in python)
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- state (logical) – True to turn on, False to turn of
-
finalize
(state=True)¶ Closes the connection to the device
-
get_frequency
(channel)¶ This functions gets the frequency output for the channel
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: frequency in the channel Return type: pint quantity
-
get_system_error
()¶ This functions returns the error message
Returns: error message Return type: string
-
get_voltage_high
(channel)¶ Gets the high voltage value of the channel.
Parameters: channel (int) – Channel number. Range depends on device Returns: current high voltage for the channel Return type: pint quantity
-
get_voltage_limits
(channel)¶ Gets the set values for the voltage limits, high and low.
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: array with [high_value, low_value] Return type: pint quantity array
-
get_voltage_limits_state
(channel)¶ This function gets the state of the voltage limits for the required channel
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: current state of the channel voltage limits Return type: logical
-
get_voltage_low
(channel)¶ Gets the low voltage value of the channel.
Parameters: channel (int) – Channel number. Range depends on device Returns: current low voltage for the channel Return type: pint quantity
-
get_voltage_offset
(channel)¶ Gets the peak-to-peak voltage of the channel.
Parameters: channel (int) – Channel number. Range depends on device Returns: current offset for the channel Return type: pint quantity
-
get_voltage_vpp
(channel)¶ Gets the peak-to-peak voltage of the channel.
Parameters: channel (int) – Channel number. Range depends on device Returns: current peak to peak voltage Return type: pint quantity
-
get_waveform
(channel)¶ Sets the waveform to be generated. The functions available are FUNCTIONS = [‘SIN’,’SQU’,’TRI’,’RAMP’,’PULS’,’PRBS’,’NOIS’,’ARB’,’DC’]
Parameters: channel (int) – Channel number Returns: One of the FUNCTIONS
-
idn
()¶ Ask for the identification
Returns: message with identification from the device Return type: string
-
load_defaults
(apply, filename=None)¶ - This loads the default configuration and applies it, depending on the
- apply parameter. The information is kept in the variable self.DEFAULTS
Parameters: - apply (logical) – decides weather to apply this settings or not
- filename – location for the config_agilent33522A.yml to use. If not given uses
the default config file in the model/function_generator folder
-
output_state
()¶ Gets the current state of the output
Returns: A list of with the state of all channels. Return type: list of logical
-
set_frequency
(channel, freq)¶ This functions sets the frequency output for the channel
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- freq (pint quantity) – Frequency to set
-
set_voltage_high
(channel, value)¶ Sets the high voltage value for the channel.
Parameters: - channel (int) – Channel number. (list in self.CHANNELS)
- value (pint quantity) – The input value in Volts
Returns: current high voltage for the channel
Return type: pint quantity
-
set_voltage_limits
(channel, high, low)¶ This function generator can set a minimum and maximum voltage value that will not be exceeded to protect the device that is being feed. This function sets the values high and low as voltage limits. If this option is activated then the output will not exceed the given values. NOTE: setting the values does not activate this feature. To enable/disable it use the function
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- high (pint quantity) – upper voltage limit
- low (pint quantity) – lower voltage limit
-
set_voltage_low
(channel, value)¶ Sets the low voltage value for the channel.
Parameters: - channel (int) – Channel number. (list in self.CHANNELS)
- value (pint quantity) – voltage low to set to channel
Returns: voltage set
Return type: pint quantity
-
set_voltage_offset
(channel, value)¶ Sets the DC offset voltage of the channel.
Parameters: - channel (int) – Channel number. Range depends on device
- value – The input value in Volts
:type pint quantity :return: current offset for the channel :rtype: pint quantity
-
set_voltage_vpp
(channel, value)¶ Sets the peak-to-peak voltage of the channel.
Parameters: - channel (int) – Port number. Range depends on device
- value (pint quantity) – peak to peak voltage to set
Returns: current peak to peak voltage
Return type: pint quantity
-
set_waveform
(channel, fun)¶ Sets the waveform to be generated. The functions available are FUNCTIONS = [‘SIN’,’SQU’,’TRI’,’RAMP’,’PULS’,’PRBS’,’NOIS’,’ARB’,’DC’]
Parameters: - channel (int) – channel to use
- fun (string) – function to generate
-