aboutsummaryrefslogtreecommitdiff
path: root/qolab/hardware/lockin/srs_sr865a.py
blob: 56f76e6f3ff050a42821afb9e2429d7f07a92d3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
from ._basic import LockinSCPI
from qolab.hardware.scpi import SCPI_PROPERTY


class SRS_SR865A(LockinSCPI):
    """SRS SR865A lockin"""

    def __init__(self, resource, *args, **kwds):
        super().__init__(resource, *args, **kwds)
        self.config["Device model"] = "SRS SR865A"
        self.resource.read_termination = "\n"
        self.deviceProperties.update(
            {"TimeBaseMode", "AuxOut1", "AuxOut2", "AuxOut3", "AuxOut4"}
        )

    FreqInt = SCPI_PROPERTY(
        scpi_prfx="FreqInt", ptype=float, doc="Internal LO frequency"
    )
    FreqExt = SCPI_PROPERTY(
        scpi_prfx="FreqExt", ptype=float, doc="External LO frequency", no_setter=True
    )
    Harm = SCPI_PROPERTY(scpi_prfx="Harm", ptype=float, doc="Harmonic of the LO")
    SinAmpl = SCPI_PROPERTY(scpi_prfx="SLVL", ptype=float, doc="Modulation amplitude")
    SinOffset = SCPI_PROPERTY(scpi_prfx="SOFF", ptype=float, doc="Modulation offset")
    EquivalentNoiseBW = SCPI_PROPERTY(
        scpi_prfx="ENBW",
        ptype=float,
        doc="Equivalent Noise BandWidth (it is not 3dB BW, see the manual)",
        no_setter=True,
    )
    TimeBaseMode = SCPI_PROPERTY(
        scpi_prfx="TBMODE",
        ptype=int,
        doc="10 MHz reference mode: 0 - Auto, 1 - Internal",
    )
    RefPhase = SCPI_PROPERTY(scpi_prfx="PHAS", ptype=float, doc="LO/reference phase")

    Sensitivity = SCPI_PROPERTY(
        scpi_prfx="SCAL",
        ptype=int,
        doc="""
    Sensitivity:
        0:   1  V (uA),  6:  10 mV (nA),  ... 27: 1 nV (fA)
        1: 500 mV (nA),  7:   5 mV (nA),
        2: 200 mV (nA),  8:   2 mV (nA),
        3: 100 mV (nA),  9:   1 mV (nA),
        4:  50 mV (nA), 10: 500 uV (pA),
        5:  20 mV (nA), 11: 200 uV (pA),
    """,
    )
    TimeConstan = SCPI_PROPERTY(
        scpi_prfx="OFLT",
        ptype=int,
        doc="""
    Time constant:
        0:   1 uS,    6:   1 mS, ..... , 21: 30 kS
        1:   3 uS,    7:   3 mS,
        2:  10 uS,    8:  10 mS,
        3:  30 uS,    9:  30 mS,
        4: 100 uS,   10: 100 mS,
        5: 300 uS,   11: 300 mS,
    """,
    )
    FilterSlope = SCPI_PROPERTY(
        scpi_prfx="OFSL",
        ptype=int,
        doc="""
    Output Filter slope:
        0:  6dB/Oct
        1: 12dB/Oct
        2: 18dB/Oct
        3: 24dB/Oct
    """,
    )

    AuxOut1 = SCPI_PROPERTY(
        scpi_prfx=["AUXV? 0", "AUXV 0,{}"],
        ptype=float,
        doc="Voltage at Auxilarly output 1",
    )
    AuxOut2 = SCPI_PROPERTY(
        scpi_prfx=["AUXV? 1", "AUXV 1,{}"],
        ptype=float,
        doc="Voltage at Auxilarly output 2",
    )
    AuxOut3 = SCPI_PROPERTY(
        scpi_prfx=["AUXV? 2", "AUXV 2,{}"],
        ptype=float,
        doc="Voltage at Auxilarly output 3",
    )
    AuxOut4 = SCPI_PROPERTY(
        scpi_prfx=["AUXV? 3", "AUXV 3,{}"],
        ptype=float,
        doc="Voltage at Auxilarly output 4",
    )

    AuxIn1 = SCPI_PROPERTY(
        scpi_prfx=["OAUX? 0", ""],
        ptype=float,
        doc="Voltage at Auxilarly input 1",
        no_setter=True,
    )
    AuxIn2 = SCPI_PROPERTY(
        scpi_prfx=["OAUX? 1", ""],
        ptype=float,
        doc="Voltage at Auxilarly input 2",
        no_setter=True,
    )
    AuxIn3 = SCPI_PROPERTY(
        scpi_prfx=["OAUX? 2", ""],
        ptype=float,
        doc="Voltage at Auxilarly input 3",
        no_setter=True,
    )
    AuxIn4 = SCPI_PROPERTY(
        scpi_prfx=["OAUX? 3", ""],
        ptype=float,
        doc="Voltage at Auxilarly input 4",
        no_setter=True,
    )


if __name__ == "__main__":
    import pyvisa

    print("testing")
    rm = pyvisa.ResourceManager()
    print(rm.list_resources())
    instr = rm.open_resource("TCPIP::192.168.0.51::INSTR")
    lockin = SRS_SR865A(instr)
    print("------ Header start -------------")
    print(str.join("\n", lockin.getHeader()))
    print("------ Header ends  -------------")