Skip to content

Commit 4a682e5

Browse files
committed
Commit for LabVIEW compatibility
LabVIEW does not support dicts and complex numbers, use of arrays as replacements.
1 parent e40ef47 commit 4a682e5

14 files changed

Lines changed: 610 additions & 447 deletions

File tree

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout
12-
uses: actions/checkout@v3
12+
uses: actions/checkout@v4
1313
with:
1414
fetch-depth: 0
1515
- run: python3 -m pip install --upgrade build && python3 -m build

Examples/BCMuxInterface/BCMuxInterface.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
class BCMuxInterface:
5-
"""BC-Mux control class.
5+
r"""BC-Mux control class.
66
77
With this class the `BC-MUX Multiplexer <https://zahner.de/products-details/multiplexer/bc-mux>`_ can
88
be controlled remotely without the BC-Mux Controller software.
@@ -36,15 +36,15 @@ def __init__(self, ip, port):
3636
return
3737

3838
def close(self):
39-
"""Closing the connection.
39+
r"""Closing the connection.
4040
4141
Disconnects the TCP/IP connection to the BC-MUX.
4242
"""
4343
self.socket.close()
4444
return
4545

4646
def connectChannel(self, channel):
47-
"""Connects the channel to the zennium.
47+
r"""Connects the channel to the zennium.
4848
4949
With this command, a channel is disconnected from the cyclizer and switched to the Zennium,
5050
for example for impedance measurements.
@@ -57,7 +57,7 @@ def connectChannel(self, channel):
5757
return self._executeCommandAndReadReply(command.format(channel))
5858

5959
def disconnectChannel(self):
60-
"""Disconnects all channels from the zennium.
60+
r"""Disconnects all channels from the zennium.
6161
6262
All channels are disconnected from the Zennium and switched to the specific cyclizer channel.
6363
@@ -68,7 +68,7 @@ def disconnectChannel(self):
6868
return self._executeCommandAndReadReply(command)
6969

7070
def setPulseLength(self, length):
71-
"""Setting the relais control.
71+
r"""Setting the relais control.
7272
7373
The BC-MUX supports switchboxes containing monostable or bistable relais. With this command,
7474
the control of the relais is set.
@@ -84,7 +84,7 @@ def setPulseLength(self, length):
8484
return self._executeCommandAndReadReply(command.format(length))
8585

8686
def _executeCommandAndReadReply(self, command):
87-
"""Private function to send a command to the device and read a string.
87+
r"""Private function to send a command to the device and read a string.
8888
8989
This command sends the command to the device and returns the response from the device.
9090

Examples/ExternalDeviceFRA/ExternalDeviceFRA.ipynb

Lines changed: 125 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# FRA measurements with 3rd party devices\n",
7+
"# FRA-X measurements with 3rd party devices\n",
88
"\n",
99
"If sources or sinks have analog interfaces for control, it is possible to use them for impedance measurement with Thales and the [FRA probe](https://www.zahner.de/products-details/probes/fra-probe).\n",
1010
"\n",
@@ -13,13 +13,12 @@
1313
},
1414
{
1515
"cell_type": "code",
16-
"execution_count": 6,
16+
"execution_count": 84,
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
20-
"import sys\n",
2120
"from thales_remote.connection import ThalesRemoteConnection\n",
22-
"from thales_remote.script_wrapper import PotentiostatMode,ThalesRemoteScriptWrapper\n",
21+
"from thales_remote.script_wrapper import PotentiostatMode, ThalesRemoteScriptWrapper\n",
2322
"import time"
2423
]
2524
},
@@ -32,17 +31,33 @@
3231
},
3332
{
3433
"cell_type": "code",
35-
"execution_count": null,
34+
"execution_count": 85,
3635
"metadata": {},
37-
"outputs": [],
36+
"outputs": [
37+
{
38+
"name": "stdout",
39+
"output_type": "stream",
40+
"text": [
41+
"devel version\n"
42+
]
43+
},
44+
{
45+
"data": {
46+
"text/plain": [
47+
"'128,ScriptRemote,5,6,0,0'"
48+
]
49+
},
50+
"execution_count": 85,
51+
"metadata": {},
52+
"output_type": "execute_result"
53+
}
54+
],
3855
"source": [
56+
"zenniumConnection = ThalesRemoteConnection()\n",
57+
"zenniumConnection.connectToTerm(\"192.168.2.47\", \"ScriptRemote\")\n",
3958
"\n",
40-
"if __name__ == \"__main__\":\n",
41-
" zenniumConnection = ThalesRemoteConnection()\n",
42-
" zenniumConnection.connectToTerm(\"localhost\", \"ScriptRemote\")\n",
43-
" \n",
44-
" zahnerZennium = ThalesRemoteScriptWrapper(zenniumConnection)\n",
45-
" zahnerZennium.forceThalesIntoRemoteScript()"
59+
"zahnerZennium = ThalesRemoteScriptWrapper(zenniumConnection)\n",
60+
"zahnerZennium.forceThalesIntoRemoteScript()"
4661
]
4762
},
4863
{
@@ -64,48 +79,73 @@
6479
"\n",
6580
"This results in the settings of the gains in the following lines of code. It may be, as in this example, that some gains must have a negative sign. This must be tested with the respective device.\n",
6681
"\n",
67-
"The FRA probe has a maximum +-10 V target signal and one input each for +-10 V current and voltage signal.\n",
68-
"\n",
6982
"The source must be controlled separately so that the analog interface is used, the source is switched on and off or for potentiostatic and galvanostatic. The Thales software only provides the analog signals, everything else must be done via the device interface.\n",
7083
"\n"
7184
]
7285
},
7386
{
7487
"cell_type": "code",
75-
"execution_count": null,
88+
"execution_count": 86,
7689
"metadata": {},
77-
"outputs": [],
90+
"outputs": [
91+
{
92+
"data": {
93+
"text/plain": [
94+
"'OK\\r'"
95+
]
96+
},
97+
"execution_count": 86,
98+
"metadata": {},
99+
"output_type": "execute_result"
100+
}
101+
],
78102
"source": [
79-
" zahnerZennium.disableFraMode()\n",
80-
" \n",
81-
" zahnerZennium.setFraVoltageMinimum(0)\n",
82-
" zahnerZennium.setFraVoltageMaximum(18)\n",
83-
" zahnerZennium.setFraCurrentMinimum(0)\n",
84-
" zahnerZennium.setFraCurrentMaximum(220)\n",
85-
" \n",
86-
" zahnerZennium.setFraVoltageInputGain(18.0/5.0)\n",
87-
" zahnerZennium.setFraVoltageOutputGain(18.0/5.0)\n",
88-
" zahnerZennium.setFraCurrentInputGain(-220.0/5.0)\n",
89-
" zahnerZennium.setFraCurrentOutputGain(-220.0/5.0)\n",
90-
" \n",
91-
" zahnerZennium.setFraPotentiostatMode(PotentiostatMode.POTMODE_GALVANOSTATIC)"
103+
"zahnerZennium.enableFraMode()"
92104
]
93105
},
94106
{
95-
"cell_type": "markdown",
107+
"cell_type": "code",
108+
"execution_count": 87,
96109
"metadata": {},
110+
"outputs": [
111+
{
112+
"data": {
113+
"text/plain": [
114+
"'OK\\r'"
115+
]
116+
},
117+
"execution_count": 87,
118+
"metadata": {},
119+
"output_type": "execute_result"
120+
}
121+
],
97122
"source": [
98-
"After parameterization the FRA mode can be switched on."
123+
"zahnerZennium.setFraVoltageMinimum(0)\n",
124+
"zahnerZennium.setFraVoltageMaximum(18)\n",
125+
"zahnerZennium.setFraCurrentMinimum(0)\n",
126+
"zahnerZennium.setFraCurrentMaximum(220)\n",
127+
"\n",
128+
"zahnerZennium.setFraVoltageInputGain(5 * (4 / 5)) # gain * (4 / 5)\n",
129+
"zahnerZennium.setFraVoltageInputOffset(-25e-3)\n",
130+
"\n",
131+
"zahnerZennium.setFraVoltageOutputGain(18.0/5.0)\n",
132+
"zahnerZennium.setFraVoltageOutputOffset(-0.3)\n",
133+
"\n",
134+
"zahnerZennium.setFraCurrentInputGain(-242)\n",
135+
"zahnerZennium.setFraCurrentInputOffset(-15.03)\n",
136+
"\n",
137+
"zahnerZennium.setFraCurrentOutputGain(-220.0/5.0)\n",
138+
"zahnerZennium.setFraCurrentOutputOffset(-3)\n",
139+
"\n",
140+
"zahnerZennium.setFraPotentiostatMode(PotentiostatMode.POTMODE_GALVANOSTATIC)\n",
141+
"zahnerZennium.setCurrent(0)"
99142
]
100143
},
101144
{
102-
"cell_type": "code",
103-
"execution_count": null,
145+
"cell_type": "markdown",
104146
"metadata": {},
105-
"outputs": [],
106147
"source": [
107-
" zahnerZennium.enableFraMode()\n",
108-
" zahnerZennium.setCurrent(0)"
148+
"After parameterization the FRA mode can be switched on."
109149
]
110150
},
111151
{
@@ -121,26 +161,42 @@
121161
},
122162
{
123163
"cell_type": "code",
124-
"execution_count": 10,
164+
"execution_count": 88,
125165
"metadata": {},
126166
"outputs": [
127167
{
128168
"name": "stdout",
129169
"output_type": "stream",
130170
"text": [
131-
"Potential:\t0.004607167\tV\n",
132-
"Potential:\t1.913566\tV\n",
133-
"Potential:\t3.952542\tV\n",
134-
"Potential:\t6.068166\tV\n",
135-
"Potential:\t8.130561\tV\n"
171+
"Potential:\t0.0005221556\tV\n",
172+
"Current:\t0.04569409\tA\n",
173+
"Potential:\t0.01014815\tV\n",
174+
"Current:\t1.006116\tA\n",
175+
"Potential:\t0.01979393\tV\n",
176+
"Current:\t2.000953\tA\n",
177+
"Potential:\t0.02997681\tV\n",
178+
"Current:\t3.007906\tA\n",
179+
"Potential:\t0.04010656\tV\n",
180+
"Current:\t3.994758\tA\n",
181+
"Potential:\t0.05025365\tV\n",
182+
"Current:\t5.002351\tA\n",
183+
"Potential:\t0.05973741\tV\n",
184+
"Current:\t6.009117\tA\n",
185+
"Potential:\t0.06979417\tV\n",
186+
"Current:\t7.020814\tA\n",
187+
"Potential:\t0.07994695\tV\n",
188+
"Current:\t8.008658\tA\n",
189+
"Potential:\t0.09013592\tV\n",
190+
"Current:\t9.006383\tA\n"
136191
]
137192
}
138193
],
139194
"source": [
140-
" for i in range(5):\n",
141-
" zahnerZennium.setCurrent(i)\n",
142-
" time.sleep(1)\n",
143-
" print(f\"Potential:\\t{zahnerZennium.getPotential()}\\tV\")"
195+
"for i in range(10):\n",
196+
" zahnerZennium.setCurrent(i)\n",
197+
" time.sleep(0.5)\n",
198+
" print(f\"Potential:\\t{zahnerZennium.getPotential()}\\tV\")\n",
199+
" print(f\"Current:\\t{zahnerZennium.getCurrent()}\\tA\")"
144200
]
145201
},
146202
{
@@ -153,7 +209,7 @@
153209
},
154210
{
155211
"cell_type": "code",
156-
"execution_count": 11,
212+
"execution_count": 89,
157213
"metadata": {},
158214
"outputs": [
159215
{
@@ -165,29 +221,27 @@
165221
}
166222
],
167223
"source": [
168-
" zahnerZennium.setEISOutputPath(r\"C:\\THALES\\temp\\test1\")\n",
169-
" zahnerZennium.setEISNaming(\"counter\")\n",
170-
" zahnerZennium.setEISCounter(13)\n",
171-
" zahnerZennium.setEISOutputFileName(\"spectra\")\n",
172-
"\n",
173-
" zahnerZennium.setAmplitude(0.5)\n",
174-
" zahnerZennium.setCurrent(5)\n",
175-
" zahnerZennium.setLowerFrequencyLimit(0.1)\n",
176-
" zahnerZennium.setStartFrequency(10)\n",
177-
" zahnerZennium.setUpperFrequencyLimit(100)\n",
178-
" zahnerZennium.setLowerNumberOfPeriods(3)\n",
179-
" zahnerZennium.setLowerStepsPerDecade(2)\n",
180-
" zahnerZennium.setUpperNumberOfPeriods(20)\n",
181-
" zahnerZennium.setUpperStepsPerDecade(3)\n",
182-
" zahnerZennium.setScanDirection(\"startToMax\")\n",
183-
" zahnerZennium.setScanStrategy(\"single\")\n",
184-
" \n",
185-
" zahnerZennium.measureEIS()\n",
186-
" \n",
187-
" zahnerZennium.disableFraMode()\n",
188-
"\n",
189-
" zenniumConnection.disconnectFromTerm()\n",
190-
" print(\"finish\")"
224+
"zahnerZennium.setEISOutputPath(r\"C:\\THALES\\temp\\test1\")\n",
225+
"zahnerZennium.setEISNaming(\"counter\")\n",
226+
"zahnerZennium.setEISCounter(13)\n",
227+
"zahnerZennium.setEISOutputFileName(\"spectra\")\n",
228+
"\n",
229+
"zahnerZennium.setCurrent(10)\n",
230+
"zahnerZennium.setAmplitude(2)\n",
231+
"zahnerZennium.setLowerFrequencyLimit(1)\n",
232+
"zahnerZennium.setStartFrequency(1000)\n",
233+
"zahnerZennium.setUpperFrequencyLimit(10e3)\n",
234+
"zahnerZennium.setLowerNumberOfPeriods(3)\n",
235+
"zahnerZennium.setLowerStepsPerDecade(2)\n",
236+
"zahnerZennium.setUpperNumberOfPeriods(20)\n",
237+
"zahnerZennium.setUpperStepsPerDecade(3)\n",
238+
"zahnerZennium.setScanDirection(\"startToMax\")\n",
239+
"zahnerZennium.setScanStrategy(\"single\")\n",
240+
"\n",
241+
"zahnerZennium.measureEIS()\n",
242+
"\n",
243+
"zenniumConnection.disconnectFromTerm()\n",
244+
"print(\"finish\")"
191245
]
192246
}
193247
],
@@ -207,7 +261,7 @@
207261
"name": "python",
208262
"nbconvert_exporter": "python",
209263
"pygments_lexer": "ipython3",
210-
"version": "3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)]"
264+
"version": "3.12.2"
211265
},
212266
"orig_nbformat": 4,
213267
"vscode": {

0 commit comments

Comments
 (0)