| 1 |
# |
| 2 |
# This file is part of the PyMeasure package. |
| 3 |
# |
| 4 |
# Copyright (c) 2013-2024 PyMeasure Developers |
| 5 |
# |
| 6 |
# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 |
# of this software and associated documentation files (the "Software"), to deal |
| 8 |
# in the Software without restriction, including without limitation the rights |
| 9 |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 |
# copies of the Software, and to permit persons to whom the Software is |
| 11 |
# furnished to do so, subject to the following conditions: |
| 12 |
# |
| 13 |
# The above copyright notice and this permission notice shall be included in |
| 14 |
# all copies or substantial portions of the Software. |
| 15 |
# |
| 16 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 |
# THE SOFTWARE. |
| 23 |
# |
| 24 |
|
| 25 |
from pymeasure.instruments import Instrument, SCPIUnknownMixin |
| 26 |
from pymeasure.instruments.validators import strict_discrete_set |
| 27 |
|
| 28 |
|
| 29 |
class ThorlabsPro8000(SCPIUnknownMixin, Instrument): |
| 30 |
"""Represents Thorlabs Pro 8000 modular laser driver""" |
| 31 |
SLOTS = range(1, 9) |
| 32 |
LDC_POLARITIES = ['AG', 'CG'] |
| 33 |
STATUS = ['ON', 'OFF'] |
| 34 |
|
| 35 |
def __init__(self, adapter, name="Thorlabs Pro 8000", **kwargs): |
| 36 |
super().__init__( |
| 37 |
adapter, |
| 38 |
name, |
| 39 |
**kwargs |
| 40 |
) |
| 41 |
self.write(':SYST:ANSW VALUE') |
| 42 |
|
| 43 |
# Code for general purpose commands (mother board related) |
| 44 |
slot = Instrument.control(":SLOT?", ":SLOT %d", |
| 45 |
"Control slot selection. Allowed values are: {}""".format(SLOTS), |
| 46 |
validator=strict_discrete_set, |
| 47 |
values=SLOTS, |
| 48 |
map_values=False) |
| 49 |
|
| 50 |
# Code for LDC-xxxx daughter boards (laser driver) |
| 51 |
LDCCurrent = Instrument.control(":ILD:SET?", ":ILD:SET %g", |
| 52 |
"""Control laser current.""") |
| 53 |
|
| 54 |
LDCCurrentLimit = Instrument.control( |
| 55 |
":LIMC:SET?", ":LIMC:SET %g", |
| 56 |
"""Set Software current Limit (value must be lower than hardware current limit).""" |
| 57 |
) |
| 58 |
|
| 59 |
LDCPolarity = Instrument.control( |
| 60 |
":LIMC:SET?", ":LIMC:SET %s", |
| 61 |
f"""Set laser diode polarity. Allowed values are: {LDC_POLARITIES}""", |
| 62 |
validator=strict_discrete_set, |
| 63 |
values=LDC_POLARITIES, |
| 64 |
map_values=False |
| 65 |
) |
| 66 |
|
| 67 |
LDCStatus = Instrument.control( |
| 68 |
":LASER?", ":LASER %s", |
| 69 |
"""Set laser diode status. Allowed values are: {}""".format( |
| 70 |
STATUS), |
| 71 |
validator=strict_discrete_set, |
| 72 |
values=STATUS, |
| 73 |
map_values=False |
| 74 |
) |
| 75 |
|
| 76 |
# Code for TED-xxxx daughter boards (TEC driver) |
| 77 |
TEDStatus = Instrument.control(":TEC?", ":TEC %s", |
| 78 |
f"""Control TEC status. Allowed values are: {STATUS}""", |
| 79 |
validator=strict_discrete_set, |
| 80 |
values=STATUS, |
| 81 |
map_values=False) |
| 82 |
|
| 83 |
TEDSetTemperature = Instrument.control(":TEMP:SET?", ":TEMP:SET %g", |
| 84 |
"""Control TEC temperature""") |