<jupyter_start><jupyter_text>QCoDeS example with SR830<jupyter_code># IMPORTS

%matplotlib notebook
import qcodes as qc
from time import sleep
from qcodes.instrument_drivers.stanford_research.SR830 import SR830
# CONNECT TO INSTRUMENT

sr = SR830('lockin', 'GPIfc00:e968:6179::de52:7100::INSTR')<jupyter_output>Connected to: Stanford_Research_Systems SR830 (serial:s/n48280, firmware:ver1.07) in 0.16s<jupyter_text>List of parameters<jupyter_code>sr.print_readable_snapshot()<jupyter_output>lockin:
	parameter       value
--------------------------------------------------------------------------------
IDN              :	{'vendor': 'Stanford_Research_Systems', 'firmware': 'ver1....
P                :	None (deg)
R                :	None (V)
R_offset         :	None 
X                :	None (V)
X_offset         :	None 
Y                :	None (V)
Y_offset         :	None 
amplitude        :	None (V)
aux_in1          :	None (V)
aux_in2          :	None (V)
aux_in3          :	None (V)
aux_in4          :	None (V)
aux_out1         :	None (V)
aux_out2         :	None (V)
aux_out3         :	None (V)
aux_out4         :	None (V)
buffer_SR        :	None (Hz)
buffer_acq_mode  :	None 
buffer_npts      :	None 
buffer_trig_mode :	None 
ch1_databuffer   :	None (V)
ch1_display      :	None 
ch1_ratio        :	None 
ch2_databuffer   :	None (V)
ch2_display      :	None 
ch2_ratio        :	None 
ext_trigger      :	None 
filter_slope     :	None (dB/oct)
frequency        :	None (Hz)
harmonic         :	[...]<jupyter_text>Buffered AcquisitionThe SR830 has two internal data buffers corresponding to the displays of channel 1 and channel 2.Here we present a simple way to measure one of these buffers.Each buffer can hold 16383 points. The buffers are filled simultaneously. The QCoDeS driver always polls the **entire** buffer, so make sure to reset (clear) the buffer of old data before starting and acquisition.<jupyter_code># Set up channel 1 
sr.ch1_display('X')
sr.ch1_ratio('none')
# Set up the buffer
sr.buffer_SR(512)  # Sample rate (Hz)
# Now measure for 1 second
sr.buffer_reset()
sr.buffer_start() # Start filling the buffers with 512 pts/s
sleep(1)
sr.buffer_pause()  # Stop filling buffers
# Then perform a measurement
sr.ch1_databuffer.prepare_buffer_readout()  # MANDATORY
meas = qc.Measure(sr.ch1_databuffer)
data = meas.run()
plot = qc.MatPlot()
plot.add(data.lockin_ch1_databuffer)<jupyter_output><empty_output><jupyter_text>Automatic sensitivity rangingWhy push the sensitivity up and down buttons yourself when QCoDeS can do it for you? Run something like this in your measurement loop to automatically adjust the sensitivity.<jupyter_code>def autorange(srs, max_changes=1):
    def autorange_once():
        r = srs.R.get()
        sens = srs.sensitivity.get()
        if r > 0.9 * sens:
            return srs.increment_sensitivity()
        elif r < 0.1 * sens:
            return srs.decrement_sensitivity()
        return False

    sets = 0
    while autorange_once() and sets < max_changes:
        sets += 1
        time.sleep(srs.time_constant.get())<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1123668065870197, 'fraction_numerical': 0.028091701646754924, 'mean_word_length': 2.7688564476885644, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '61143', 'license': 'MIT', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1025, 'n_words': 288, 'path': 'docs/examples/driver_examples/Qcodes example with Stanford SR830.ipynb', 'repo_name': 'jsaez8/Qcodes', 'size': '3077'}