# 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>
SRS345.frequency

Gets/sets the output frequency.

Units: As specified, or assumed to be $$\text{Hz}$$ otherwise. float or Quantity
SRS345.function

Gets/sets the output function of the function generator.

Type: Function
SRS345.offset

Gets/sets the offset voltage for the output waveform.

Units: As specified, or assumed to be $$\text{V}$$ otherwise. float or Quantity
SRS345.phase

Gets/sets the phase for the output waveform.

Units: As specified, or assumed to be degrees ($${}^{\circ}$$) otherwise. 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 = <Coupling.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'>
SRS830.auto_offset(mode)

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}.
SRS830.auto_phase()

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.

SRS830.clear_data_buffer()

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.

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} list
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

Parameters: 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.
SRS830.pause()

Has the instrument pause data capture.

SRS830.read_data_buffer(channel)

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}. 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

Parameters: 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.

Parameters: 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}.
SRS830.start_data_transfer()

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.

SRS830.start_scan()

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]].

Parameters: 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. list
SRS830.amplitude

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. Quantity with units volts peak-to-peak.
SRS830.amplitude_max
SRS830.amplitude_min
SRS830.buffer_mode

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.

SRS830.coupling

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

SRS830.data_transfer

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.

Type: bool
SRS830.frequency

Gets/sets the lock-in amplifier reference frequency.

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

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

Type: bool
SRS830.num_data_points

Gets the number of data sets in the SRS830 buffer.

Type: int
SRS830.phase

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. Quantity with units degrees.
SRS830.phase_max
SRS830.phase_min
SRS830.sample_rate

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.

get_log()

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. 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.

Parameters: 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 Quantity
average

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

Type: Quantity
name

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

Type: str
sensor_type

Gets the type of sensor attached to the specified channel.

stats_enabled

Gets/sets enabling the statistics for the specified channel.

Type: bool
stats_points

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

Type: int
std_dev

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

Type: Quantity
units

Gets the appropriate units for the specified channel.

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

Type: UnitQuantity
value

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.

Type: Quantity
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'>
SRSCTC100.channel_units()

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
SRSCTC100.clear_log()

Clears the SRS CTC100 log

Not sure if this works.

SRSCTC100.errcheck()

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.

Returns: Nothing
SRSCTC100.query(cmd, size=-1)
SRSCTC100.sendcmd(cmd)
SRSCTC100.channel

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.

SRSCTC100.display_figures

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

Type: int
SRSCTC100.error_check_toggle

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)
>>> srs.channel["B"].delay = (srs.channel["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.

level_amplitude

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

Type: float or Quantity As specified, or $$\text{V}$$ by default.
polarity

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>
SRSDG645.channel

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)
>>> inst.channel[inst.Channels.A]


See the example in SRSDG645 for a more complete example.

Return type: _SRSDG645Channel
SRSDG645.display

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
SRSDG645.enable_adv_triggering

Gets/sets whether advanced triggering is enabled.

Type: bool
SRSDG645.holdoff

Gets/sets the trigger holdoff time.

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

Gets the specified output port.

SRSDG645.trigger_rate

Gets/sets the rate of the internal trigger.

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

Gets/sets the source for the trigger.