Skip to content

srs.sr7270

flex_drivers.srs.sr7270.SR7270

Bases: VISAInstrument

Driver for the 7270 DSP lock-in amplifier via its RAW USB VISA resource.

The instrument frames every USB response as <text>\x00<status><overload>: the payload is NULL-terminated and followed by a status byte and an overload byte. Every command — including sets — produces such a reply, so all traffic goes through :meth:query, which returns the (text, status, overload) tuple.

query(cmd)

Send a command and read the framed response.

Returns:

Name Type Description
tuple tuple[str, int, int]

(response_str, status_byte, overload_byte)

read()

Read chunks until the NULL + status + overload frame is complete.

Returns:

Name Type Description
tuple tuple[str, int, int]

(response_str, status_byte, overload_byte)

get_id()

Get instrument identification string.

get_ver()

Get instrument firmware version.

set_ref_frequency(freq_hz)

Set internal oscillator frequency in Hz.

get_ref_frequency()

Get internal oscillator frequency in Hz.

set_ref_amplitude(amp_volts)

Set oscillator amplitude in Volts.

get_ref_amplitude()

Get oscillator amplitude in Volts.

set_ref_phase(phase_deg)

Set reference phase shift in degrees.

get_ref_phase()

Get reference phase shift in degrees.

set_sensitivity(index)

Set full-scale sensitivity range (1-27, see manual).

get_sensitivity()

Get current sensitivity range index.

set_time_constant(index)

Set output time constant (0-29, see manual).

get_time_constant()

Get current time constant index.

auto_measure()

Perform Auto-Measure (ASM) operation.

get_x()

Get X channel output in Volts.

get_y()

Get Y channel output in Volts.

get_magnitude()

Get magnitude output in Volts.

get_phase()

Get phase output in degrees.

get_xy()

Get (X, Y) tuple in Volts.

get_rtheta()

Get (Magnitude, Phase) tuple.

setup_curve_buffer(buffer_size)

Set curve buffer length.

Parameters:

Name Type Description Default
buffer_size int

Number of points to store (max 100000).

required

configure_curve_quantity(cbd_value)

Configure what quantities to store in the curve buffer.

NOTE: For floating point readout (DC. command), bit 4 (Sensitivity=16) MUST be included when storing X, Y, Magnitude, or Noise.

Parameters:

Name Type Description Default
cbd_value int

Bit mask - combine with bitwise OR: 1=X, 2=Y, 4=Mag, 8=Phase, 16=Sensitivity, 32=ADC1, 64=ADC2, 128=ADC3

required

Examples:

17 (1+16): X + Sensitivity (floating point) 19 (1+2+16): X + Y + Sensitivity (floating point)

set_storage_interval(interval_us)

Set time interval between data points.

Parameters:

Name Type Description Default
interval_us float

Interval in microseconds (min 1000 us = 1 ms).

required

start_continuous_acquisition(mode=0)

Start continuous data acquisition.

Parameters:

Name Type Description Default
mode int

0=start immediately, 1=start on trigger, 2=triggered start/stop.

0

halt_acquisition()

Stop curve acquisition.

get_acquisition_status()

Get curve acquisition status.

Returns:

Name Type Description
tuple tuple[int, ...]

(status, num_sweeps, status_byte, num_points) status: 0=idle, 2=running, 6=halted num_points: Number of points acquired

get_num_stored_points()

Get number of points stored in buffer.

read_curve_buffer(bit_number)

Read data from the curve buffer.

Parameters:

Name Type Description Default
bit_number int

Bit position from CBD (0=X, 1=Y, 2=Mag, 3=Phase, etc.)

required

Returns:

Type Description
list[float]

list of float values

clear_curve_buffer()

Clear the curve buffer.

acquire_continuous(duration_s, sample_rate_hz, channel='X')

Perform continuous data acquisition and return time-series data.

Parameters:

Name Type Description Default
duration_s float

Acquisition duration in seconds.

required
sample_rate_hz float

Sample rate in Hz (max 1000 Hz).

required
channel str

Channel to acquire ('X', 'Y', 'Mag', or 'Phase').

'X'

Returns:

Name Type Description
tuple tuple[ndarray, ndarray]

(timestamps, values) as numpy arrays. timestamps: Time array in seconds. values: Measured values in Volts (or degrees for Phase).

Example

times, x_vals = sr.acquire_continuous(duration_s=10.0, sample_rate_hz=100)