# Stanford Research Systems¶

## SRS345 Function Generator¶

class instruments.srs.SRS345(filelike)[source]

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[source]

Enum containing valid output function modes for the SRS 345

arbitrary = 5
noise = 4
ramp = 3
sinusoid = 0
square = 1
triangle = 2
frequency

Gets/sets the output frequency.

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

Gets/sets the output function of the function generator.

Type: Function
offset

Gets/sets the offset voltage for the output waveform.

Units: As specified, or assumed to be $$\text{V}$$ otherwise. float or Quantity
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)[source]

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[source]

Enum for the SRS830 buffer modes.

loop = 1
one_shot = 0
class Coupling[source]

Enum for the SRS830 channel coupling settings.

ac = 0
dc = 1
class FreqSource[source]

Enum for the SRS830 frequency source settings.

external = 0
internal = 1
class Mode[source]

Enum containing valid modes for the SRS 830

aux1 = 'aux1'
aux2 = 'aux2'
aux3 = 'aux3'
aux4 = 'aux4'
ch1 = 'ch1'
ch2 = 'ch2'
none = 'none'
r = 'r'
ref = 'ref'
theta = 'theta'
x = 'x'
xnoise = 'xnoise'
y = 'y'
ynoise = 'ynoise'
auto_offset(mode)[source]

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}.
auto_phase()[source]

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.

clear_data_buffer()[source]

Clears the data buffer of the SRS830.

data_snap(mode1, mode2)[source]

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
init(sample_rate, buffer_mode)[source]

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.
pause()[source]

Has the instrument pause data capture.

read_data_buffer(channel)[source]

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
set_channel_display(channel, display, ratio)[source]

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}
set_offset_expand(mode, offset, expand)[source]

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}.
start_data_transfer()[source]

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.

start_scan()[source]

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.

take_measurement(sample_rate, num_samples)[source]

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

coupling

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

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
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.
frequency_source
Gets/sets the frequency source used. This is either an external source,
or uses the internal reference.
input_shield_ground

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

Type: bool
num_data_points

Gets the number of data sets in the SRS830 buffer.

Type: int
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.
phase_max
phase_min
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)[source]

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

class Channel(ctc, chan_name)[source]

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

get_log()[source]

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)[source]

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 SensorType[source]

Enum containing valid sensor types for the SRS CTC-100

diode = 'Diode'
rox = 'ROX'
rtd = 'RTD'
thermistor = 'Thermistor'
channel_units()[source]

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
clear_log()[source]

Clears the SRS CTC100 log

Not sure if this works.

errcheck()[source]

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
query(cmd, size=-1)[source]

Executes the given query.

Parameters: cmd (str) – String containing the query to execute. size (int) – Number of bytes to be read. Default is read until termination character is found. The result of the query as returned by the connected instrument. str
sendcmd(cmd)[source]

Sends a command without waiting for a response.

Parameters: cmd (str) – String containing the command to be sent.
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.

display_figures

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

Type: int
error_check_toggle

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

## SRSDG645 Digital Delay Generator¶

class instruments.srs.SRSDG645(filelike)[source]

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[source]

Enumeration of valid delay channels for the DDG.

A = 2
B = 3
C = 4
D = 5
E = 6
F = 7
G = 8
H = 9
T0 = 0
T1 = 1
class DisplayMode[source]

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

adv_triggering_enable = 4
burst_T0_config = 14
burst_count = 9
burst_delay = 8
burst_mode = 7
burst_period = 10
channel_delay = 11
channel_levels = 12
channel_polarity = 13
prescale_config = 6
trigger_holdoff = 5
trigger_line = 3
trigger_rate = 0
trigger_single_shot = 2
trigger_threshold = 1
class LevelPolarity[source]

Polarities for output levels.

negative = 0
positive = 1
class Output(parent, idx)[source]

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

Amplitude offset (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 Outputs[source]

Enumeration of valid outputs from the DDG.

AB = 1
CD = 2
EF = 3
GH = 4
T0 = 0
class TriggerSource[source]

Enumeration of the different allowed trigger sources and modes.

external_falling = 2
external_rising = 1
internal = 0
line = 6
single_shot = 5
ss_external_falling = 4
ss_external_rising = 3
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
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
enable_adv_triggering

Gets/sets whether advanced triggering is enabled.

Type: bool
holdoff

Gets/sets the trigger holdoff time.

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

Gets the specified output port.

trigger_rate

Gets/sets the rate of the internal trigger.

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

Gets/sets the source for the trigger.