# Signal Recovery DSP7265

Control the Signal Recovery DSP7265 lock-in amplifier from Python with the `DSP7265` driver.

**Driver:** [pymeasure](https://pymeasure.readthedocs.io)  
**Type:** [Lock-in amplifiers](https://dev.nominal.io/instro/instruments/type/lockin.md)  
**Manufacturer:** [Signal Recovery](https://dev.nominal.io/instro/instruments/manufacturer/signal-recovery.md)

Represents the Signal Recovery DSP 7265 lock-in amplifier.

## Publishing through instro

instro publishes the commands you send to a DSP7265 and the values you read from it, through any [publisher](https://dev.nominal.io/instro/library/publishers.md). It takes two forms, both described in the [pymeasure guide](https://dev.nominal.io/instro/library/pymeasure.md). Install with `uv add "instro[pymeasure]"`.

### With a PymeasureInstrument

[`PymeasureInstrument`](https://dev.nominal.io/instro/library/pymeasure.md#write-new-instro-code) wraps the driver in an instro instrument, with tags and background polling. The instrument is created inside the `with` block, and `.device` is the pymeasure instrument.

```python
from pymeasure.instruments.signalrecovery import DSP7265
from instro.pymeasure import PymeasureInstrument

with PymeasureInstrument(
    name="lockin7265",
    instrument=DSP7265("GPIB0::12::INSTR"),
    dataset_rid="<dataset rid>",
) as lockin7265:
    lockin7265.device.imode = "voltage mode"       # Set to measure voltages
    lockin7265.device.reference = "internal"       # Use internal oscillator
    lockin7265.device.fet = 1                      # Use FET pre-amp
    lockin7265.device.shield = 0                   # Ground shields
    lockin7265.device.coupling = 0                 # AC input coupling
    lockin7265.device.time_constant = 0.10         # Filter time set to 100 ms
    lockin7265.device.sensitivity = 2E-3           # Sensitivity set to 2 mV
    lockin7265.device.frequency = 100              # Set oscillator frequency to 100 Hz
    lockin7265.device.voltage = 1                  # Set oscillator amplitude to 1 V
    lockin7265.device.gain = 20                    # Set AC gain to 20 dB
    print(lockin7265.device.x)                     # Measure X channel voltage
    lockin7265.device.shutdown()                   # Instrument shutdown
```

### With existing pymeasure code (`attach()`)

[`attach()`](https://dev.nominal.io/instro/library/pymeasure.md#publish-from-existing-code) adds publishing to pymeasure code you already have. The imports, the `attach()` call after the instrument is created, and `recorder.close()` are all that instro adds.

```python
from pymeasure.instruments.signalrecovery import DSP7265
from instro.lib import NominalCorePublisher
from instro.pymeasure import attach

lockin7265 = DSP7265("GPIB0::12::INSTR")
recorder = attach(lockin7265, "lockin7265", [NominalCorePublisher(dataset_rid="<dataset rid>")])
lockin7265.imode = "voltage mode"       # Set to measure voltages
lockin7265.reference = "internal"       # Use internal oscillator
lockin7265.fet = 1                      # Use FET pre-amp
lockin7265.shield = 0                   # Ground shields
lockin7265.coupling = 0                 # AC input coupling
lockin7265.time_constant = 0.10         # Filter time set to 100 ms
lockin7265.sensitivity = 2E-3           # Sensitivity set to 2 mV
lockin7265.frequency = 100              # Set oscillator frequency to 100 Hz
lockin7265.voltage = 1                  # Set oscillator amplitude to 1 V
lockin7265.gain = 20                    # Set AC gain to 20 dB
print(lockin7265.x)                     # Measure X channel voltage
lockin7265.shutdown()                   # Instrument shutdown

recorder.close()  # flush and close the publishers
```

The examples are adapted from the [pymeasure documentation for `DSP7265`](https://pymeasure.readthedocs.io/en/latest/api/instruments/signalrecovery/dsp7265.html#pymeasure.instruments.signalrecovery.dsp7265.DSP7265), which lists every property and method.
