mpylab 0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mpylab-0.9/LICENSE +26 -0
- mpylab-0.9/PKG-INFO +34 -0
- mpylab-0.9/README.md +4 -0
- mpylab-0.9/pyproject.toml +68 -0
- mpylab-0.9/src/mpylab/LICENSE +25 -0
- mpylab-0.9/src/mpylab/__init__.py +1 -0
- mpylab-0.9/src/mpylab/device/Meta_ui.py +304 -0
- mpylab-0.9/src/mpylab/device/__init__.py +1 -0
- mpylab-0.9/src/mpylab/device/amp_ar_25s1g4.py +96 -0
- mpylab-0.9/src/mpylab/device/amp_blma_1018_100.py +154 -0
- mpylab-0.9/src/mpylab/device/amp_blwa_0810_100.py +111 -0
- mpylab-0.9/src/mpylab/device/amp_cba_1g_030d.py +100 -0
- mpylab-0.9/src/mpylab/device/amp_ifi_smx25.py +120 -0
- mpylab-0.9/src/mpylab/device/amplifier.py +149 -0
- mpylab-0.9/src/mpylab/device/device.py +2762 -0
- mpylab-0.9/src/mpylab/device/driver.py +313 -0
- mpylab-0.9/src/mpylab/device/driver_new.py +270 -0
- mpylab-0.9/src/mpylab/device/fieldprobe.py +132 -0
- mpylab-0.9/src/mpylab/device/fieldprobe_ui.py +90 -0
- mpylab-0.9/src/mpylab/device/mc_teseq_stirrer.py +474 -0
- mpylab-0.9/src/mpylab/device/motorcontroller.py +72 -0
- mpylab-0.9/src/mpylab/device/mpy_exceptions.py +53 -0
- mpylab-0.9/src/mpylab/device/networkanalyzer.py +533 -0
- mpylab-0.9/src/mpylab/device/networkanalyzer_ui.py +139 -0
- mpylab-0.9/src/mpylab/device/nport.py +169 -0
- mpylab-0.9/src/mpylab/device/nw_rs_zlv.py +921 -0
- mpylab-0.9/src/mpylab/device/pm_gt_8540c.py +321 -0
- mpylab-0.9/src/mpylab/device/pm_lumiloop_lspm.py +426 -0
- mpylab-0.9/src/mpylab/device/pm_rs_nrp.py +367 -0
- mpylab-0.9/src/mpylab/device/pm_rxatt.py +1189 -0
- mpylab-0.9/src/mpylab/device/pmini.ini +25 -0
- mpylab-0.9/src/mpylab/device/powermeter.py +290 -0
- mpylab-0.9/src/mpylab/device/powermeter2c.py +86 -0
- mpylab-0.9/src/mpylab/device/powermeter_ui.py +118 -0
- mpylab-0.9/src/mpylab/device/prb_ar_fm7004.py +145 -0
- mpylab-0.9/src/mpylab/device/prb_lumiloop_lsprobe.py +460 -0
- mpylab-0.9/src/mpylab/device/prb_pmm_ep601.py +221 -0
- mpylab-0.9/src/mpylab/device/r_types.py +272 -0
- mpylab-0.9/src/mpylab/device/sg_gt_12000a.py +180 -0
- mpylab-0.9/src/mpylab/device/sg_rs_smb100a.py +215 -0
- mpylab-0.9/src/mpylab/device/sg_rs_smc100a.py +251 -0
- mpylab-0.9/src/mpylab/device/sg_rs_smf100a.py +272 -0
- mpylab-0.9/src/mpylab/device/sg_rs_smr.py +144 -0
- mpylab-0.9/src/mpylab/device/sg_rs_swm.py +121 -0
- mpylab-0.9/src/mpylab/device/signalgenerator.py +253 -0
- mpylab-0.9/src/mpylab/device/signalgenerator_ui.py +212 -0
- mpylab-0.9/src/mpylab/device/sp_rs_zlv-6.py +566 -0
- mpylab-0.9/src/mpylab/device/spectrumanalyzer.py +378 -0
- mpylab-0.9/src/mpylab/device/spectrumanalyzer_ui.py +366 -0
- mpylab-0.9/src/mpylab/device/switch.py +25 -0
- mpylab-0.9/src/mpylab/device/tools.py +1043 -0
- mpylab-0.9/src/mpylab/device/validators.py +283 -0
- mpylab-0.9/src/mpylab/env/Measure.py +586 -0
- mpylab-0.9/src/mpylab/env/__init__.py +1 -0
- mpylab-0.9/src/mpylab/env/custom.py +27 -0
- mpylab-0.9/src/mpylab/env/msc/ImmunityThreshold.py +229 -0
- mpylab-0.9/src/mpylab/env/msc/MSC.py +3686 -0
- mpylab-0.9/src/mpylab/env/msc/__init__.py +1 -0
- mpylab-0.9/src/mpylab/env/tem/TEMCell.py +2079 -0
- mpylab-0.9/src/mpylab/env/tem/__init__.py +1 -0
- mpylab-0.9/src/mpylab/env/univers/AmplifierTest.py +576 -0
- mpylab-0.9/src/mpylab/env/univers/__init__.py +1 -0
- mpylab-0.9/src/mpylab/tools/Configuration.py +96 -0
- mpylab-0.9/src/mpylab/tools/PControler.py +128 -0
- mpylab-0.9/src/mpylab/tools/__init__.py +1 -0
- mpylab-0.9/src/mpylab/tools/aunits.py +10 -0
- mpylab-0.9/src/mpylab/tools/calling.py +74 -0
- mpylab-0.9/src/mpylab/tools/correlation.py +96 -0
- mpylab-0.9/src/mpylab/tools/dataparser.py +306 -0
- mpylab-0.9/src/mpylab/tools/directivity.py +43 -0
- mpylab-0.9/src/mpylab/tools/distributions.py +62 -0
- mpylab-0.9/src/mpylab/tools/dot.g +141 -0
- mpylab-0.9/src/mpylab/tools/dot.py +392 -0
- mpylab-0.9/src/mpylab/tools/get_char.py +52 -0
- mpylab-0.9/src/mpylab/tools/interpol.py +172 -0
- mpylab-0.9/src/mpylab/tools/kbhit.py +41 -0
- mpylab-0.9/src/mpylab/tools/level_control.py +175 -0
- mpylab-0.9/src/mpylab/tools/levenshtein.py +103 -0
- mpylab-0.9/src/mpylab/tools/log_freq.py +15 -0
- mpylab-0.9/src/mpylab/tools/mgraph.py +1114 -0
- mpylab-0.9/src/mpylab/tools/plyparser.py +63 -0
- mpylab-0.9/src/mpylab/tools/plyparser_DatFile_parsetab.py +45 -0
- mpylab-0.9/src/mpylab/tools/sin_fit.py +22 -0
- mpylab-0.9/src/mpylab/tools/spacing.py +149 -0
- mpylab-0.9/src/mpylab/tools/umd_types.py +103 -0
- mpylab-0.9/src/mpylab/tools/uncertain.py +77 -0
- mpylab-0.9/src/mpylab/tools/unixcrt.py +111 -0
- mpylab-0.9/src/mpylab/tools/util.py +563 -0
- mpylab-0.9/src/mpylab/tools/yappsrt.py +322 -0
mpylab-0.9/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
This module is free software: you can redistribute it and/or modify
|
|
2
|
+
it under the terms of the GNU General Public License as published by
|
|
3
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
4
|
+
(at your option) any later version.
|
|
5
|
+
|
|
6
|
+
This module is distributed in the hope that it will be useful,
|
|
7
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
8
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
9
|
+
GNU General Public License for more details.
|
|
10
|
+
|
|
11
|
+
You should have received a copy of the GNU General Public License
|
|
12
|
+
along with this module. If not, see <http://www.gnu.org/licenses/>.
|
|
13
|
+
|
|
14
|
+
Dieses Modul ist Freie Software: Sie können es unter den Bedingungen
|
|
15
|
+
der GNU General Public License, wie von der Free Software Foundation,
|
|
16
|
+
Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
|
|
17
|
+
veröffentlichten Version, weiter verteilen und/oder modifizieren.
|
|
18
|
+
|
|
19
|
+
Dieses Modul wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch
|
|
20
|
+
OHNE JEDE GEWÄHR,; sogar ohne die implizite
|
|
21
|
+
Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
|
|
22
|
+
Siehe die GNU General Public License für weitere Einzelheiten.
|
|
23
|
+
|
|
24
|
+
Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
|
|
25
|
+
Modul erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.
|
|
26
|
+
|
mpylab-0.9/PKG-INFO
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mpylab
|
|
3
|
+
Version: 0.9
|
|
4
|
+
Summary: A framework to simplify development of measurement 'scripts' for measurements in laboratories over e.g pyvisa.
|
|
5
|
+
Keywords: pyvisa,gpib,measurements,laboratory
|
|
6
|
+
Author: Hans Georg Krauthäuser, Christian Albrecht, Stephan, Oscar Rivera, Mathias Magdowski, Sophie Rautschek, Frank Schröder, Luzia Tesar, Konstantin Pasche, Thomas Reidemeister
|
|
7
|
+
Author-email: Hans Georg Krauthäuser <hgk@ieee.org>
|
|
8
|
+
License-Expression: GPL-3.0-or-later
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Requires-Dist: pyside6 ; extra == 'gui'
|
|
24
|
+
Maintainer: Hans Georg Krauthäuser
|
|
25
|
+
Maintainer-email: Hans Georg Krauthäuser <hgk@ieee.org>
|
|
26
|
+
Requires-Python: >=3.8
|
|
27
|
+
Project-URL: Repository, https://github.com/hgkdd/Mpy
|
|
28
|
+
Provides-Extra: gui
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
This is MpyLab. MpyLab is a framework for automatic measurement application and
|
|
32
|
+
hardware device drivers (TCP/IP, GPIB, serial, USB).
|
|
33
|
+
|
|
34
|
+
This software is distributed unter GPL-3 or higher. See LICENCE for details.
|
mpylab-0.9/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mpylab"
|
|
7
|
+
version = "0.9"
|
|
8
|
+
depandencies = [
|
|
9
|
+
"bidict",
|
|
10
|
+
"getch; sys_platform == 'linux' or sys_platform == 'darwin'",
|
|
11
|
+
"gpib-ctypes",
|
|
12
|
+
"Levenshtein",
|
|
13
|
+
"msvcrt; sys_platform == 'windows'",
|
|
14
|
+
"numpy",
|
|
15
|
+
"ply",
|
|
16
|
+
"pydot",
|
|
17
|
+
"pyparsing",
|
|
18
|
+
"pyserial",
|
|
19
|
+
"pyusb",
|
|
20
|
+
"pyvisa",
|
|
21
|
+
"pyvisa-py",
|
|
22
|
+
"scipy",
|
|
23
|
+
"simpleeval",
|
|
24
|
+
"matplotlib"
|
|
25
|
+
]
|
|
26
|
+
requires-python = ">= 3.8"
|
|
27
|
+
authors = [
|
|
28
|
+
{name = "Hans Georg Krauthäuser", email = "hgk@ieee.org"},
|
|
29
|
+
{name = "Christian Albrecht"},
|
|
30
|
+
{name = "Stephan"},
|
|
31
|
+
{name = "Oscar Rivera"},
|
|
32
|
+
{name = "Mathias Magdowski"},
|
|
33
|
+
{name = "Sophie Rautschek"},
|
|
34
|
+
{name = "Frank Schröder"},
|
|
35
|
+
{name = "Luzia Tesar"},
|
|
36
|
+
{name = "Konstantin Pasche"},
|
|
37
|
+
{name = "Thomas Reidemeister"}
|
|
38
|
+
]
|
|
39
|
+
maintainers = [
|
|
40
|
+
{name = "Hans Georg Krauthäuser", email = "hgk@ieee.org"}
|
|
41
|
+
]
|
|
42
|
+
description = "A framework to simplify development of measurement 'scripts' for measurements in laboratories over e.g pyvisa."
|
|
43
|
+
readme = "README.md"
|
|
44
|
+
license = "GPL-3.0-or-later"
|
|
45
|
+
license-files = ["LICENSE"]
|
|
46
|
+
keywords = ["pyvisa", "gpib", "measurements", "laboratory"]
|
|
47
|
+
classifiers = [
|
|
48
|
+
"Development Status :: 4 - Beta",
|
|
49
|
+
"Intended Audience :: Developers",
|
|
50
|
+
"Intended Audience :: Education",
|
|
51
|
+
"Intended Audience :: Science/Research",
|
|
52
|
+
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
|
53
|
+
"Topic :: Scientific/Engineering",
|
|
54
|
+
# Specify the Python versions you support here.
|
|
55
|
+
"Programming Language :: Python :: 3",
|
|
56
|
+
"Programming Language :: Python :: 3.8",
|
|
57
|
+
"Programming Language :: Python :: 3.9",
|
|
58
|
+
"Programming Language :: Python :: 3.10",
|
|
59
|
+
"Programming Language :: Python :: 3.11",
|
|
60
|
+
"Programming Language :: Python :: 3.12",
|
|
61
|
+
"Programming Language :: Python :: 3.13"
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[project.urls]
|
|
65
|
+
Repository = "https://github.com/hgkdd/Mpy"
|
|
66
|
+
|
|
67
|
+
[project.optional-dependencies]
|
|
68
|
+
gui = ["PySide6"]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
This module is free software: you can redistribute it and/or modify
|
|
2
|
+
it under the terms of the GNU General Public License as published by
|
|
3
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
4
|
+
(at your option) any later version.
|
|
5
|
+
|
|
6
|
+
This module is distributed in the hope that it will be useful,
|
|
7
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
8
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
9
|
+
GNU General Public License for more details.
|
|
10
|
+
|
|
11
|
+
You should have received a copy of the GNU General Public License
|
|
12
|
+
along with this module. If not, see <http://www.gnu.org/licenses/>.
|
|
13
|
+
|
|
14
|
+
Dieses Modul ist Freie Software: Sie können es unter den Bedingungen
|
|
15
|
+
der GNU General Public License, wie von der Free Software Foundation,
|
|
16
|
+
Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
|
|
17
|
+
veröffentlichten Version, weiter verteilen und/oder modifizieren.
|
|
18
|
+
|
|
19
|
+
Dieses Modul wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch
|
|
20
|
+
OHNE JEDE GEWÄHR,; sogar ohne die implizite
|
|
21
|
+
Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
|
|
22
|
+
Siehe die GNU General Public License für weitere Einzelheiten.
|
|
23
|
+
|
|
24
|
+
Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
|
|
25
|
+
Modul erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.9"
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""This is :mod:`mpylab.device.Metaui`: Metaclass to Build a standard GUI from the _setgetlist.
|
|
3
|
+
|
|
4
|
+
:author: Christian Albrecht, Hans Georg Krauthaeuser
|
|
5
|
+
:copyright: All rights reserved
|
|
6
|
+
:license: no licence yet
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import traits.api as tapi
|
|
10
|
+
from traits.etsconfig.api import ETSConfig
|
|
11
|
+
from traits.has_traits import MetaHasTraits
|
|
12
|
+
|
|
13
|
+
ETSConfig.toolkit = "wx"
|
|
14
|
+
import traitsui.api as tuiapi
|
|
15
|
+
import traitsui.menu as tuim
|
|
16
|
+
import io
|
|
17
|
+
import re
|
|
18
|
+
import inspect
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def erzeugeFired_Methode_mit_Rfunction(command, rfunction, param_list):
|
|
22
|
+
"""
|
|
23
|
+
Functionfactory zum erzeugen von Traits-fired Funktionen.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def Methode_fired(self):
|
|
27
|
+
setattr(self, rfunction.upper(), str(eval('self.dv.%s(%s)' % (command, ", ".join(param_list)))[1]))
|
|
28
|
+
|
|
29
|
+
return Methode_fired
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def erzeugeFired_Methode(name, param_list):
|
|
33
|
+
"""
|
|
34
|
+
Functionfactory zum erzeugen von Traits-fired Funktionen.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def Methode_fired(self):
|
|
38
|
+
setattr(self, name.upper(), str(eval('self.dv.%s(%s)' % (name, ", ".join(param_list)))[1]))
|
|
39
|
+
|
|
40
|
+
return Methode_fired
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _Init_fired(self):
|
|
44
|
+
"""
|
|
45
|
+
Standard init_fired Funktion.
|
|
46
|
+
"""
|
|
47
|
+
ini = io.StringIO(self.INI)
|
|
48
|
+
self.dv.Init(ini)
|
|
49
|
+
|
|
50
|
+
# Alle Get Funktionen einmal aufrufen und so die Anzeige mit aktuellen Werten belegen.
|
|
51
|
+
for item in self.mainEntries:
|
|
52
|
+
m = re.match(r'^[Gg]et.*$', item)
|
|
53
|
+
if m:
|
|
54
|
+
getattr(self, "_%s_fired" % item)()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def Erzeuge_TapiVar(typ):
|
|
58
|
+
"""
|
|
59
|
+
Hilfsfunktion zum erstellen von Traits-Variablen.
|
|
60
|
+
"""
|
|
61
|
+
if typ == float:
|
|
62
|
+
return tapi.Float()
|
|
63
|
+
elif typ == int:
|
|
64
|
+
return tapi.Int()
|
|
65
|
+
else:
|
|
66
|
+
return tapi.Str()
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class Metaui(MetaHasTraits):
|
|
70
|
+
"""
|
|
71
|
+
Diese Metaklasse ermöglicht das einfache Erstellen von Guis für das Testen eines Drivers.
|
|
72
|
+
|
|
73
|
+
Sie baut für alle im _commands- und _cmds-Dict vorhanden Commands und Functions passende Buttons und
|
|
74
|
+
Eingabefelder und nimmt so einem viel Schreibarbeit ab.
|
|
75
|
+
|
|
76
|
+
Es werden für alles in _commands und _cmds definiert Kommandos Buttons und Felder erstellt. Sind in dem cmds-Dict mehr
|
|
77
|
+
Kommandos definiert als in _commands, so werden auch für diese Buttons gebaut. Der Grund für dieses Vorgehen liegt in der
|
|
78
|
+
Tatsache, dass diese GUI zum testen der Klasse gedacht ist und somit alle definierten Kommandso abgebildet werden sollen.
|
|
79
|
+
Sind in _commands Kommandos aufgeführt die nicht in der konkreten Dirver-Klasse vorhanden sind, so wird eine Methode
|
|
80
|
+
erstellt welche einen NotImplementedError wirft.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
Zu jeder Driver-Superklasse sollte ein UI-Superklasse existieren in der zusätzliche Taps definiert werden
|
|
85
|
+
die für alle von ihr abgeleiteten Driverklassen gleich sein sollen.
|
|
86
|
+
Damit die Metaklasse einwandfrei arbeiten kann, dürfen in der Superklasse nur
|
|
87
|
+
sogenannte tuiapi.Group (das sind Taps) erstellt werden. Diese müssen wiederrum in einem Dict
|
|
88
|
+
mit dem Namen "GROUPS" gespeichert werden. Wobei folgende Konvention einzuhalten ist::
|
|
89
|
+
|
|
90
|
+
GROUPS={'Name des Taps' : tuiapi.Group(...)}
|
|
91
|
+
|
|
92
|
+
Als Beispiele siehe: :mod:`mpylab.device.networkanalyer_ui`
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
Weiterhin muss eine UI-Klasse für jede konkrete Driver-Implementierung erstellt werden, diese muss von
|
|
97
|
+
der UI-Superklasse abgeleitet sein. In dieser muss die Meta_ui als Metaklasse angegeben werden, weiterhin
|
|
98
|
+
sind folgende speziall Variablen nötig:
|
|
99
|
+
|
|
100
|
+
**__driverclass__= :** Verweis auf eine konkrete Klasse einer Driver-Implementierung. ACHTUNG!! nur ein Verweis auf die Klasse,
|
|
101
|
+
keine Instanz der Klasse.
|
|
102
|
+
|
|
103
|
+
**__super_driverclass__=**: Verweis auf die Superklasse eines Driver. ACHTUNG!! nur ein Verweis auf die Klasse,
|
|
104
|
+
keine Instanz der Klasse.
|
|
105
|
+
|
|
106
|
+
Aus diesen Varialben holt sich die Metaklase das _commands-Dict und _cmds-Dict.
|
|
107
|
+
|
|
108
|
+
Als Beispiel siehe: :class:`mpylab.device.nw_rs_zlv.UI`
|
|
109
|
+
|
|
110
|
+
.. rubric:: Methods:
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
# def __init__(cls, eins, zwei, drei):
|
|
114
|
+
# print "init %s \n\n %s \n\n %s"%(eins,zwei,drei)
|
|
115
|
+
|
|
116
|
+
def __new__(cls, class_name, bases, class_dict):
|
|
117
|
+
|
|
118
|
+
class_dict.update({'_Init_fired': _Init_fired})
|
|
119
|
+
|
|
120
|
+
driverclass = class_dict.get("__driverclass__")
|
|
121
|
+
super_driverclass = class_dict.get('__super_driverclass__')
|
|
122
|
+
|
|
123
|
+
tabs = 'INI_grp'
|
|
124
|
+
INI_grp = tuiapi.Group(
|
|
125
|
+
tuiapi.Item('INI', style='custom', springy=True, width=500, height=200, show_label=False),
|
|
126
|
+
tuiapi.Item('Init', show_label=False),
|
|
127
|
+
label='Ini')
|
|
128
|
+
|
|
129
|
+
# ********************
|
|
130
|
+
# _cmds abarbeiten
|
|
131
|
+
# ********************
|
|
132
|
+
|
|
133
|
+
_cmds = driverclass._cmds
|
|
134
|
+
mainEntries = []
|
|
135
|
+
items_Map = {}
|
|
136
|
+
|
|
137
|
+
for command_name, command in list(_cmds.items()):
|
|
138
|
+
items = ""
|
|
139
|
+
if command_name in class_dict['_ignore']:
|
|
140
|
+
continue
|
|
141
|
+
if command_name in mainEntries:
|
|
142
|
+
continue
|
|
143
|
+
|
|
144
|
+
mainEntries.append(command_name)
|
|
145
|
+
|
|
146
|
+
items = "%s tuiapi.Group(" % (items)
|
|
147
|
+
items = "%s tuiapi.Item('%s',show_label=False,width=100)," % (items, command_name)
|
|
148
|
+
class_dict[command_name] = tapi.Button(command_name)
|
|
149
|
+
|
|
150
|
+
if command.Rfunction():
|
|
151
|
+
items = "%s tuiapi.Item('%s',show_label=False,width=100)," % (items, command.Rfunction())
|
|
152
|
+
items = "%s tuiapi.Item('%s',label='Wert',style='readonly',width=70)," % (
|
|
153
|
+
items, command.Rfunction().upper())
|
|
154
|
+
|
|
155
|
+
class_dict[command.Rfunction().upper()] = Erzeuge_TapiVar(str)
|
|
156
|
+
class_dict[command.Rfunction()] = tapi.Button(command.Rfunction())
|
|
157
|
+
|
|
158
|
+
if command.Rfunction() not in mainEntries:
|
|
159
|
+
mainEntries.append(command.Rfunction())
|
|
160
|
+
|
|
161
|
+
if command.Rfunction() in list(items_Map.keys()):
|
|
162
|
+
del items_Map[command.Rfunction()]
|
|
163
|
+
else:
|
|
164
|
+
items = "%s tuiapi.Item('%s',label='%s',style='readonly',width=70)," % (
|
|
165
|
+
items, command_name.upper(), 'Wert'.rjust(38))
|
|
166
|
+
class_dict[command_name.upper()] = Erzeuge_TapiVar(str)
|
|
167
|
+
|
|
168
|
+
param_list = []
|
|
169
|
+
for param_name in command.getParameterTuple():
|
|
170
|
+
param = command.getParameter()[param_name]
|
|
171
|
+
if param.isClass_attr():
|
|
172
|
+
continue
|
|
173
|
+
|
|
174
|
+
if hasattr(driverclass, command_name):
|
|
175
|
+
if param_name not in inspect.getfullargspec(getattr(driverclass, command_name))[0]:
|
|
176
|
+
continue
|
|
177
|
+
|
|
178
|
+
items = "%s tuiapi.Item('param_%s_%s',label='%s',width=60)," % (items,
|
|
179
|
+
command_name,
|
|
180
|
+
param_name.upper(),
|
|
181
|
+
param_name)
|
|
182
|
+
class_dict['param_%s_%s' % (command_name, param_name.upper())] = Erzeuge_TapiVar(param.Getptype())
|
|
183
|
+
param_list.append('self.param_%s_%s' % (command_name, param_name.upper()))
|
|
184
|
+
|
|
185
|
+
if command.Rfunction():
|
|
186
|
+
class_dict["_%s_fired" % command_name] = erzeugeFired_Methode_mit_Rfunction(command_name,
|
|
187
|
+
command.Rfunction(),
|
|
188
|
+
param_list)
|
|
189
|
+
class_dict["_%s_fired" % command.Rfunction()] = erzeugeFired_Methode(command.Rfunction(), [])
|
|
190
|
+
|
|
191
|
+
else:
|
|
192
|
+
class_dict["_%s_fired" % command_name] = erzeugeFired_Methode(command_name, param_list)
|
|
193
|
+
|
|
194
|
+
items = "%s orientation='horizontal')" % (items)
|
|
195
|
+
items_Map[command_name] = items
|
|
196
|
+
|
|
197
|
+
class_dict.update({'mainEntries': mainEntries})
|
|
198
|
+
|
|
199
|
+
item_List = list(items_Map.values())
|
|
200
|
+
item_List = [item_List[i:i + 16] for i in range(0, len(item_List), 16)]
|
|
201
|
+
|
|
202
|
+
tabs_list_index = 0
|
|
203
|
+
tabs_list = []
|
|
204
|
+
|
|
205
|
+
for item in item_List:
|
|
206
|
+
tabs_list.append(tuiapi.Group(eval(", ".join(item)), label='Main_%d' % tabs_list_index))
|
|
207
|
+
tabs = tabs + ", tabs_list[%d]" % tabs_list_index
|
|
208
|
+
tabs_list_index = tabs_list_index + 1
|
|
209
|
+
|
|
210
|
+
# *******************
|
|
211
|
+
# commands abarbeiten
|
|
212
|
+
# *******************
|
|
213
|
+
|
|
214
|
+
notIEntries = []
|
|
215
|
+
items_Map = {}
|
|
216
|
+
|
|
217
|
+
for command_name, item in list(super_driverclass._commands.items()):
|
|
218
|
+
items = ""
|
|
219
|
+
if (command_name in mainEntries) or (command_name in notIEntries):
|
|
220
|
+
continue
|
|
221
|
+
if command_name in class_dict['_ignore']:
|
|
222
|
+
continue
|
|
223
|
+
|
|
224
|
+
if item['parameter']:
|
|
225
|
+
para_command = item['parameter']
|
|
226
|
+
if isinstance(para_command, str):
|
|
227
|
+
para_command = (para_command,)
|
|
228
|
+
|
|
229
|
+
# Testen ob die Methode direkt, also nicht über _cmds, implementiert wurde:
|
|
230
|
+
# Wird die Methode in _commands angegeben, aber nicht implementiert wurde,
|
|
231
|
+
# Erzeug die Meta Klasse eine Methode die einen NotImplementedError wirft
|
|
232
|
+
driver_ins = driverclass()
|
|
233
|
+
try:
|
|
234
|
+
p = ""
|
|
235
|
+
if item['parameter']:
|
|
236
|
+
for param_name in para_command:
|
|
237
|
+
p = p + "'',"
|
|
238
|
+
eval('driverclass.%s(driver_ins,%s)' % (command_name, p))
|
|
239
|
+
except NotImplementedError:
|
|
240
|
+
pass
|
|
241
|
+
else:
|
|
242
|
+
driver_ins.__del__()
|
|
243
|
+
continue
|
|
244
|
+
|
|
245
|
+
driver_ins.__del__()
|
|
246
|
+
|
|
247
|
+
notIEntries.append(command_name)
|
|
248
|
+
|
|
249
|
+
items = "%s tuiapi.Group(" % (items)
|
|
250
|
+
items = "%s tuiapi.Item('%s',show_label=False,width=100)," % (items, command_name)
|
|
251
|
+
class_dict[command_name] = tapi.Button(command_name)
|
|
252
|
+
|
|
253
|
+
items = "%s tuiapi.Item('%s',label='%s',style='readonly',width=70)," % (items, command_name.upper(), 'Wert')
|
|
254
|
+
class_dict[command_name.upper()] = Erzeuge_TapiVar(str)
|
|
255
|
+
|
|
256
|
+
param_list = []
|
|
257
|
+
|
|
258
|
+
if item['parameter']:
|
|
259
|
+
for param_name in para_command:
|
|
260
|
+
items = "%s tuiapi.Item('param_%s_%s',label='%s',width=60)," % (
|
|
261
|
+
items, command_name, param_name.upper(), param_name)
|
|
262
|
+
class_dict['param_%s_%s' % (command_name, param_name.upper())] = Erzeuge_TapiVar(str)
|
|
263
|
+
param_list.append('self.param_%s_%s' % (command_name, param_name.upper()))
|
|
264
|
+
|
|
265
|
+
class_dict["_%s_fired" % command_name] = erzeugeFired_Methode(command_name, param_list)
|
|
266
|
+
|
|
267
|
+
items = "%s orientation='horizontal')" % (items)
|
|
268
|
+
items_Map[command_name] = items
|
|
269
|
+
|
|
270
|
+
item_List = list(items_Map.values())
|
|
271
|
+
item_List = [item_List[i:i + 16] for i in range(0, len(item_List), 16)]
|
|
272
|
+
|
|
273
|
+
for item in item_List:
|
|
274
|
+
tabs_list.append(tuiapi.Group(eval(", ".join(item)), label='NotImp_%d' % tabs_list_index))
|
|
275
|
+
tabs = tabs + ", tabs_list[%d]" % tabs_list_index
|
|
276
|
+
tabs_list_index = tabs_list_index + 1
|
|
277
|
+
|
|
278
|
+
# **********************
|
|
279
|
+
# In den UI Klassen definiert Groups holen:
|
|
280
|
+
# ************************
|
|
281
|
+
|
|
282
|
+
for i in class_dict:
|
|
283
|
+
if type(class_dict.get(i)) == tuiapi.Group:
|
|
284
|
+
tabs = '%s,class_dict.get("%s")' % (tabs, i)
|
|
285
|
+
|
|
286
|
+
i = 0
|
|
287
|
+
for b in bases:
|
|
288
|
+
for n, v in list(b.GROUPS.items()):
|
|
289
|
+
if type(v) == tuiapi.Group:
|
|
290
|
+
tabs = '%s,bases[%d].GROUPS["%s"]' % (tabs, i, n)
|
|
291
|
+
i = i + 1
|
|
292
|
+
|
|
293
|
+
# *************
|
|
294
|
+
# Fenster zusammen bauen:
|
|
295
|
+
# ***************
|
|
296
|
+
|
|
297
|
+
tabs = "tuiapi.Group(%s, layout='tabbed')" % tabs
|
|
298
|
+
|
|
299
|
+
class_dict.update(
|
|
300
|
+
{'traits_view': tuiapi.View(eval(tabs), title="Spectrumanalyer", buttons=[tuim.CancelButton])})
|
|
301
|
+
|
|
302
|
+
# print "Meta %s \n\n bases\n %s \n\n dict \n %s"%(class_name,str(bases),str(class_dict))
|
|
303
|
+
|
|
304
|
+
return MetaHasTraits.__new__(cls, class_name, bases, class_dict)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from simpleeval import simple_eval
|
|
3
|
+
|
|
4
|
+
from mpylab.device.amplifier import AMPLIFIER as AMP
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AMPLIFIER(AMP):
|
|
8
|
+
conftmpl = AMP.conftmpl
|
|
9
|
+
conftmpl['init_value']['gpib'] = int
|
|
10
|
+
|
|
11
|
+
def __init__(self):
|
|
12
|
+
AMP.__init__(self)
|
|
13
|
+
self._cmds = {'POn': [("P1", None)],
|
|
14
|
+
'POff': [("P0", None)],
|
|
15
|
+
'Operate': [("G4095", None)],
|
|
16
|
+
'Standby': [("G0000", None)],
|
|
17
|
+
'GetDescription': [('*IDN?', r'(?P<IDN>.*)')]}
|
|
18
|
+
self.term_chars = '\r\n'
|
|
19
|
+
self.error = None
|
|
20
|
+
|
|
21
|
+
def Init(self, ini=None, channel=None):
|
|
22
|
+
self.error = AMP.Init(self, ini, channel)
|
|
23
|
+
self.POn()
|
|
24
|
+
self.Operate()
|
|
25
|
+
return self.error
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def main():
|
|
29
|
+
import sys
|
|
30
|
+
import io
|
|
31
|
+
|
|
32
|
+
from mpylab.tools.util import format_block
|
|
33
|
+
import scuq
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
ini = sys.argv[1]
|
|
37
|
+
except IndexError:
|
|
38
|
+
ini = format_block("""
|
|
39
|
+
[description]
|
|
40
|
+
DESCRIPTION = 25s1g4
|
|
41
|
+
TYPE = AMPLIFIER
|
|
42
|
+
VENDOR = AR
|
|
43
|
+
SERIALNR =
|
|
44
|
+
DEVICEID =
|
|
45
|
+
DRIVER =
|
|
46
|
+
|
|
47
|
+
[INIT_VALUE]
|
|
48
|
+
FSTART = 800e6
|
|
49
|
+
FSTOP = 4.2e9
|
|
50
|
+
FSTEP = 0.0
|
|
51
|
+
NR_OF_CHANNELS = 2
|
|
52
|
+
GPIB = 1
|
|
53
|
+
VIRTUAL = 0
|
|
54
|
+
|
|
55
|
+
[CHANNEL_1]
|
|
56
|
+
NAME = S21
|
|
57
|
+
UNIT = dB
|
|
58
|
+
INTERPOLATION = LOG
|
|
59
|
+
FILE = io.StringIO(format_block('''
|
|
60
|
+
FUNIT: Hz
|
|
61
|
+
UNIT: dB
|
|
62
|
+
ABSERROR: 0.0
|
|
63
|
+
800e6 45
|
|
64
|
+
4.2e9 45
|
|
65
|
+
'''))
|
|
66
|
+
[CHANNEL_2]
|
|
67
|
+
NAME = MAXIN
|
|
68
|
+
UNIT = dBm
|
|
69
|
+
INTERPOLATION = LOG
|
|
70
|
+
FILE = io.StringIO(format_block('''
|
|
71
|
+
FUNIT: Hz
|
|
72
|
+
UNIT: dBm
|
|
73
|
+
ABSERROR: 0.0
|
|
74
|
+
800e6 0
|
|
75
|
+
4.2e9 0
|
|
76
|
+
'''))
|
|
77
|
+
""")
|
|
78
|
+
ini = io.StringIO(ini)
|
|
79
|
+
|
|
80
|
+
amp = AMPLIFIER()
|
|
81
|
+
err = amp.Init(ini)
|
|
82
|
+
print(amp.GetDescription())
|
|
83
|
+
ctx = scuq.ucomponents.Context()
|
|
84
|
+
while True:
|
|
85
|
+
freq = float(simple_eval(input("Freq / Hz: ")))
|
|
86
|
+
if freq < 0:
|
|
87
|
+
break
|
|
88
|
+
amp.SetFreq(freq)
|
|
89
|
+
err, uq = amp.GetData(what='S21')
|
|
90
|
+
val, unc, unit = ctx.value_uncertainty_unit(uq)
|
|
91
|
+
print((freq, uq, val, unc, unit))
|
|
92
|
+
err = amp.Quit()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
if __name__ == '__main__':
|
|
96
|
+
main()
|