Stanford Research Systems

SRS345 Function Generator

class instruments.srs.SRS345(filelike)

The SRS DS345 is a 30MHz function generator.

Example usage:

>>> import instruments as ik
>>> import quantities as pq
>>> srs = ik.srs.SRS345.open_gpib('/dev/ttyUSB0', 1)
>>> srs.frequency = 1 * pq.MHz
>>> print(srs.offset)
>>> srs.function = srs.Function.triangle
class Function

Enum containing valid output function modes for the SRS 345

arbitrary = <Function.arbitrary: 5>
noise = <Function.noise: 4>
ramp = <Function.ramp: 3>
sinusoid = <Function.sinusoid: 0>
square = <Function.square: 1>
triangle = <Function.triangle: 2>

Gets/sets the output frequency.

Units:As specified, or assumed to be \(\text{Hz}\) otherwise.
Type:float or Quantity

Gets/sets the output function of the function generator.


Gets/sets the offset voltage for the output waveform.

Units:As specified, or assumed to be \(\text{V}\) otherwise.
Type:float or Quantity

Gets/sets the phase for the output waveform.

Units:As specified, or assumed to be degrees (\({}^{\circ}\)) otherwise.
Type:float or Quantity

SRS830 Lock-In Amplifier

class instruments.srs.SRS830(filelike, outx_mode=None)

Communicates with a Stanford Research Systems 830 Lock-In Amplifier.

Example usage:

>>> import instruments as ik
>>> import quantities as pq
>>> srs = ik.srs.SRS830.open_gpibusb('/dev/ttyUSB0', 1)
>>> srs.frequency = 1000 * pq.hertz # Lock-In frequency
>>> data = srs.take_measurement(1, 10) # 1Hz sample rate, 10 samples total
class BufferMode

Enum for the SRS830 buffer modes.

loop = <BufferMode.loop: 1>
one_shot = <BufferMode.one_shot: 0>
class SRS830.Coupling

Enum for the SRS830 channel coupling settings.

ac = < 0>
dc = <Coupling.dc: 1>
class SRS830.FreqSource

Enum for the SRS830 frequency source settings.

external = <FreqSource.external: 0>
internal = <FreqSource.internal: 1>
class SRS830.Mode

Enum containing valid modes for the SRS 830

aux1 = <Mode.aux1: 'aux1'>
aux2 = <Mode.aux2: 'aux2'>
aux3 = <Mode.aux3: 'aux3'>
aux4 = <Mode.aux4: 'aux4'>
ch1 = <Mode.ch1: 'ch1'>
ch2 = <Mode.ch2: 'ch2'>
none = <Mode.none: 'none'>
r = <Mode.r: 'r'>
ref = <Mode.ref: 'ref'>
theta = <Mode.theta: 'theta'>
x = <Mode.x: 'x'>
xnoise = <Mode.xnoise: 'xnoise'>
y = <Mode.y: 'y'>
ynoise = <Mode.ynoise: 'ynoise'>

Sets a specific channel mode to auto offset. This is the same as pressing the auto offset key on the display.

It sets the offset of the mode specified to zero.

Parameters:mode (Mode or str) – Target mode of auto_offset function. Valid inputs are {X|Y|R}.

Sets the lock-in to auto phase. This does the same thing as pushing the auto phase button.

Do not send this message again without waiting the correct amount of time for the lock-in to finish.


Clears the data buffer of the SRS830.

SRS830.data_snap(mode1, mode2)

Takes a snapshot of the current parameters are defined by variables mode1 and mode2.

For combinations (X,Y) and (R,THETA), they are taken at the same instant. All other combinations are done sequentially, and may not represent values taken from the same timestamp.

Returns a list of floats, arranged in the order that they are given in the function input parameters.

  • mode1 (Mode or str) – Mode to take data snap for channel 1. Valid inputs are given by: {X|Y|R|THETA|AUX1|AUX2|AUX3|AUX4|REF|CH1|CH2}
  • mode2 (Mode or str) – Mode to take data snap for channel 2. Valid inputs are given by: {X|Y|R|THETA|AUX1|AUX2|AUX3|AUX4|REF|CH1|CH2}
Return type:


SRS830.init(sample_rate, buffer_mode)

Wrapper function to prepare the SRS830 for measurement. Sets both the data sampling rate and the end of buffer mode

  • sample_rate (Quantity or str) – The desired sampling rate. Acceptable set values are \(2^n\) where \(n \in \{-4...+9\}\) in units Hertz or the string trigger.
  • buffer_mode (SRS830.BufferMode) – This sets the behaviour of the instrument when the data storage buffer is full. Setting to one_shot will stop acquisition, while loop will repeat from the start.

Has the instrument pause data capture.


Reads the entire data buffer for a specific channel. Transfer is done in ASCII mode. Although binary would be faster, this is not currently implemented.

Returns a list of floats containing instrument’s measurements.

Parameters:channel (SRS830.Mode or str) – Channel data buffer to read from. Valid channels are given by {CH1|CH2}.
Return type:list
SRS830.set_channel_display(channel, display, ratio)

Sets the display of the two channels. Channel 1 can display X, R, X Noise, Aux In 1, Aux In 2 Channel 2 can display Y, Theta, Y Noise, Aux In 3, Aux In 4

Channel 1 can have ratio of None, Aux In 1, Aux In 2 Channel 2 can have ratio of None, Aux In 3, Aux In 4

  • channel (Mode or str) – Channel you wish to set the display of. Valid input is one of {CH1|CH2}.
  • display (Mode or str) – Setting the channel will be changed to. Valid input is one of {X|Y|R|THETA|XNOISE|YNOISE|AUX1|AUX2|AUX3|AUX4}
  • ratio (Mode or str) – Desired ratio setting for this channel. Valid input is one of {NONE|AUX1|AUX2|AUX3|AUX4}
SRS830.set_offset_expand(mode, offset, expand)

Sets the channel offset and expand parameters. Offset is a percentage, and expand is given as a multiplication factor of 1, 10, or 100.

  • mode (SRS830.Mode or str) – The channel mode that you wish to change the offset and/or the expand of. Valid modes are X, Y, and R.
  • offset (float) – Offset of the mode, given as a percent. offset = <-105...+105>.
  • expand (int) – Expansion factor for the measurement. Valid input is {1|10|100}.

Wrapper function to start the actual data transfer. Sets the transfer mode to FAST2, and triggers the data transfer to start after a delay of 0.5 seconds.


After setting the data transfer on via the dataTransfer function, this is used to start the scan. The scan starts after a delay of 0.5 seconds.

SRS830.take_measurement(sample_rate, num_samples)

Wrapper function that allows you to easily take measurements with a specified sample rate and number of desired samples.

Function will call time.sleep() for the required amount of time it will take the instrument to complete this sampling operation.

Returns a list containing two items, each of which are lists containing the channel data. The order is [[Ch1 data], [Ch2 data]].

  • sample_rate (int) – Set the desired sample rate of the measurement. See sample_rate for more information.
  • num_samples (int) – Number of samples to take.
Return type:



Gets/set the amplitude of the internal reference signal.

Set value should be 0.004 <= newval <= 5.000

Units:As specified (if a Quantity) or assumed to be of units volts. Value should be specified as peak-to-peak.
Type:Quantity with units volts peak-to-peak.

Gets/sets the end of buffer mode.

This sets the behaviour of the instrument when the data storage buffer is full. Setting to one_shot will stop acquisition, while loop will repeat from the start.


Gets/sets the input coupling to either ‘ac’ or ‘dc’.


Gets/sets the data transfer status.

Note that this function only makes use of 2 of the 3 data transfer modes supported by the SRS830. The supported modes are FAST0 and FAST2. The other, FAST1, is for legacy systems which this package does not support.


Gets/sets the lock-in amplifier reference frequency.

Units:As specified (if a Quantity) or assumed to be of units Hertz.
Type:Quantity with units Hertz.
Gets/sets the frequency source used. This is either an external source,
or uses the internal reference.

Function sets the input shield grounding to either ‘float’ or ‘ground’.


Gets the number of data sets in the SRS830 buffer.


Gets/set the phase of the internal reference signal.

Set value should be -360deg <= newval < +730deg.

Units:As specified (if a Quantity) or assumed to be of units degrees.
Type:Quantity with units degrees.

Gets/sets the data sampling rate of the lock-in.

Acceptable set values are \(2^n\) where \(n \in \{-4...+9\}\) or the string trigger.

Type:Quantity with units Hertz.

SRSCTC100 Cryogenic Temperature Controller

class instruments.srs.SRSCTC100(filelike)

Communicates with a Stanford Research Systems CTC-100 cryogenic temperature controller.

class Channel(ctc, chan_name)

Represents an input or output channel on an SRS CTC-100 cryogenic temperature controller.


Gets all of the log data points currently saved in the instrument memory.

Returns:Tuple of all the log data points. First value is time, second is the measurement value.
Return type:Tuple of 2x Quantity, each comprised of a numpy array (numpy.dnarray).
get_log_point(which='next', units=None)

Get a log data point from the instrument.

  • which (str) – Which data point you want. Valid examples include first, and next. Consult the instrument manual for the complete list
  • units (UnitQuantity) – Units to attach to the returned data point. If left with the value of None then the instrument will be queried for the current units setting.

The log data point with units

Return type:



Gets the average measurement for the specified channel as determined by the statistics gathering.


Gets/sets the name of the channel that will be used by the instrument to identify the channel in programming and on the display.


Gets the type of sensor attached to the specified channel.


Gets/sets enabling the statistics for the specified channel.


Gets/sets the number of sample points to use for the channel statistics.


Gets the standard deviation for the specified channel as determined by the statistics gathering.


Gets the appropriate units for the specified channel.

Units can be one of celsius, watt, volt, ohm, or dimensionless.


Gets the measurement value of the channel. Units depend on what kind of sensor and/or channel you have specified. Units can be one of celsius, watt, volt, ohm, or dimensionless.

class SRSCTC100.SensorType

Enum containing valid sensor types for the SRS CTC-100

diode = <SensorType.diode: 'Diode'>
rox = <SensorType.rox: 'ROX'>
rtd = <SensorType.rtd: 'RTD'>
thermistor = <SensorType.thermistor: 'Thermistor'>

Returns a dictionary from channel names to channel units, using the getOutput.units command. Unknown units and dimensionless quantities are presented the same way by the instrument, and so both are reported using pq.dimensionless.

Return type:dict with channel names as keys and units as values

Clears the SRS CTC100 log

Not sure if this works.


Performs an error check query against the CTC100. This function does not return anything, but will raise an IOError if the error code received by the instrument is not zero.

SRSCTC100.query(cmd, size=-1)

Gets a specific measurement channel on the SRS CTC100. This is accessed like one would access a dict. Here you must use the actual channel names to address a specific channel. This is different from most other instruments in InstrumentKit because the CRC100 channel names can change by the user.

The list of current valid channel names can be accessed by the SRSCTC100._channel_names() function.


Gets/sets the number of significant figures to display. Valid range is 0-6 inclusive.


Gets/sets if errors should be checked for after every command.


SRSDG645 Digital Delay Generator

class instruments.srs.SRSDG645(filelike)

Communicates with a Stanford Research Systems DG645 digital delay generator, using the SCPI commands documented in the user’s guide.

Example usage:

>>> import instruments as ik
>>> import quantities as pq
>>> srs = ik.srs.SRSDG645.open_gpibusb('/dev/ttyUSB0', 1)
>>>["B"].delay = (["A"], pq.Quantity(10, 'ns'))
>>> srs.output["AB"].level_amplitude = pq.Quantity(4.0, "V")
class Channels

Enumeration of valid delay channels for the DDG.

A = <Channels.A: 2>
B = <Channels.B: 3>
C = <Channels.C: 4>
D = <Channels.D: 5>
E = <Channels.E: 6>
F = <Channels.F: 7>
G = <Channels.G: 8>
H = <Channels.H: 9>
T0 = <Channels.T0: 0>
T1 = <Channels.T1: 1>
class SRSDG645.DisplayMode

Enumeration of possible modes for the physical front-panel display.

adv_triggering_enable = <DisplayMode.adv_triggering_enable: 4>
burst_T0_config = <DisplayMode.burst_T0_config: 14>
burst_count = <DisplayMode.burst_count: 9>
burst_delay = <DisplayMode.burst_delay: 8>
burst_mode = <DisplayMode.burst_mode: 7>
burst_period = <DisplayMode.burst_period: 10>
channel_delay = <DisplayMode.channel_delay: 11>
channel_levels = <DisplayMode.channel_levels: 12>
channel_polarity = <DisplayMode.channel_polarity: 13>
prescale_config = <DisplayMode.prescale_config: 6>
trigger_holdoff = <DisplayMode.trigger_holdoff: 5>
trigger_line = <DisplayMode.trigger_line: 3>
trigger_rate = <DisplayMode.trigger_rate: 0>
trigger_single_shot = <DisplayMode.trigger_single_shot: 2>
trigger_threshold = <DisplayMode.trigger_threshold: 1>
class SRSDG645.LevelPolarity

Polarities for output levels.

negative = <LevelPolarity.negative: 0>
positive = <LevelPolarity.positive: 1>
class SRSDG645.Output(parent, idx)

An output from the DDG.


Amplitude (in voltage) of the output level for this output.

Type:float or Quantity
Units:As specified, or \(\text{V}\) by default.

Polarity of this output.

class SRSDG645.Outputs

Enumeration of valid outputs from the DDG.

AB = <Outputs.AB: 1>
CD = <Outputs.CD: 2>
EF = <Outputs.EF: 3>
GH = <Outputs.GH: 4>
T0 = <Outputs.T0: 0>
class SRSDG645.TriggerSource

Enumeration of the different allowed trigger sources and modes.

external_falling = <TriggerSource.external_falling: 2>
external_rising = <TriggerSource.external_rising: 1>
internal = <TriggerSource.internal: 0>
line = <TriggerSource.line: 6>
single_shot = <TriggerSource.single_shot: 5>
ss_external_falling = <TriggerSource.ss_external_falling: 4>
ss_external_rising = <TriggerSource.ss_external_rising: 3>

Gets a specific channel object.

The desired channel is accessed by passing an EnumValue from Channels. For example, to access channel A:

>>> import instruments as ik
>>> inst = ik.srs.SRSDG645.open_gpibusb('/dev/ttyUSB0', 1)

See the example in SRSDG645 for a more complete example.

Return type:_SRSDG645Channel

Gets/sets the front-panel display mode for the connected DDG. The mode is a tuple of the display mode and the channel.

Type:tuple of an SRSDG645.DisplayMode and an SRSDG645.Channels

Gets/sets whether advanced triggering is enabled.


Gets/sets the trigger holdoff time.

Type:Quantity or float
Units:As passed, or s if not specified.

Gets the specified output port.


Gets/sets the rate of the internal trigger.

Type:Quantity or float
Units:As passed or Hz if not specified.

Gets/sets the source for the trigger.