# Signal Recovery DSP7225

Control the Signal Recovery DSP7225 lock-in amplifier from Python with the `DSP7225` 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 7225 lock-in amplifier.

## Publishing through instro

instro publishes the commands you send to a DSP7225 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 DSP7225
from instro.pymeasure import PymeasureInstrument

with PymeasureInstrument(
    name="lockin7225",
    instrument=DSP7225("GPIB0::12::INSTR"),
    dataset_rid="<dataset rid>",
) as lockin7225:
    lockin7225.device.imode = "voltage mode"       # Set to measure voltages
    lockin7225.device.reference = "internal"       # Use internal oscillator
    lockin7225.device.fet = 1                      # Use FET pre-amp
    lockin7225.device.shield = 0                   # Ground shields
    lockin7225.device.coupling = 0                 # AC input coupling
    lockin7225.device.time_constant = 0.10         # Filter time set to 100 ms
    lockin7225.device.sensitivity = 2E-3           # Sensitivity set to 2 mV
    lockin7225.device.frequency = 100              # Set oscillator frequency to 100 Hz
    lockin7225.device.voltage = 1                  # Set oscillator amplitude to 1 V
    lockin7225.device.gain = 20                    # Set AC gain to 20 dB
    print(lockin7225.device.x)                     # Measure X channel voltage
    lockin7225.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 DSP7225
from instro.lib import NominalCorePublisher
from instro.pymeasure import attach

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

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

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