Adding a new instrument and respective commands #249
-
I'm trying to use tm_devices with non-Tek/Keithley instruments and I'm finding it very difficult to setup the commands for these new instruments. I've tried to reverse engineer the process of adding a new instrument by reading the codebase; I'll use the MSO6 as an example:
I assume that if I want to create a new scope class, I should use the base Scope class but what methods should/can I define? An example and documentation on the basics of defining a new instrument class and respective commands would be very useful. Additionally, I will likely only need to define a few subcommands but, with the current process, will have to define classes for all the layers before it. As an example, if I want to use "MEASUrement:MEAS:FILTers:LOWPass:FREQ?" (defined in src/tm_devices/commands/gen_e3e9uu_lpdmso/measurement.py) I would have to define a class for measurement, meas, filters, lowpass and freq; and the corresponding inits, variables and methods for each. This is rather cumbersome and creates a steep time investment for even starting to use tm_devices. Is there an easier way to define commands that I'm missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @afonsotrepa, I spoke with @nfelt14 on this topic this morning. There are two levels of use within tm_devices:
Right now third party instruments can be added for that 'basic' level which should still be an improved experience over the typical PyVISA connection management (better write/query/set_and_check methods, access to the driver class (scope example)) A full Python API for these instruments cannot be added easily, as the Python APIs are generated code. You might be able to manually do this but as you have noticed it is going to be pretty cumbersome. To get that code completion and syntax checking benefit the command header has to be split up across classes, and that is going to be extremely tedious to do by hand -- hence why its auto-generated here. |
Beta Was this translation helpful? Give feedback.
Hi @afonsotrepa,
I spoke with @nfelt14 on this topic this morning.
There are two levels of use within tm_devices:
Right now third party instruments can be added for that 'basic' level which should still be an improved experience over the typical PyVISA connection management (better write/query/set_and_check methods, access to the driver class (scope example))
A full Python API for these instruments cannot be added easily, as the Python APIs are generated code. You might be able to manually do this but as you have noticed it is going to be pretty cumbersome. To get that code completion and syntax che…