LabToolkit


NameLabToolkit JSON
Version 1.4.0 PyPI version JSON
download
home_page
SummaryPython package for instrument control, data acquisition and automation
upload_time2023-12-26 22:33:37
maintainer
docs_urlNone
author
requires_python>=3.10
license
keywords acquisition gpib measurement rs232 serial usb visa
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Labtoolkit

Python package for instrument control, data acquisition and automation. 


## Demo enumeration

``` python
import labtoolkit
import pyvisa
from pyvisa_py.tcpip import TCPIPInstrVxi11 as TCPVXI11  # TCPVXI11.list_resources()

rm = pyvisa.ResourceManager()
resources = rm.list_resources('(GPIB[0129]::?*::INSTR)|(USB?*)')
ignores = ['GPIB2::22::INSTR',]
resources = [resource for resource in resources if resource not in ignores]

resources = resources + TCPVXI11.list_resources()
ignores = ['TCPIP::192.168.100.5::INSTR',]
resources = [resource for resource in resources if resource not in ignores]

lab = labtoolkit.Enumerate(resourcemanager=rm, resources=resources)

sa = lab.enumeration.iloc[0].inst

sa.frequency_center = 1e9
sa.frequency_span = 10e6
sa.sweep_points = 8192
sa.OPC
df = sa.trace
# returns a DataFrame of the trace data
df.plot(grid=True, figsize=(8, 6))
df.attrs
# df.attrs are used to store metadata (sweep_time, resolution_bandwidth, etc)
```

## Demo manual driver selection

``` python
# Communicate with Hardware with PyVISA
import pyvisa
import labtoolkit.SpectrumAnalyser.AgilentE44nn


rm = pyvisa.ResourceManager()
sa = labtookit.SpectrumAnalyser.AgilentE44nn.AgilentE44nn(rm.open_resource('GPIB0::18::INSTR'))

sa.frequency_center = 1e9
sa.frequency_span = 10e6
sa.sweep_points = 8192
sa.OPC
df = sa.trace
# returns a DataFrame of the trace data
df.plot(grid=True, figsize=(8, 6))
df.attrs
# df.attrs are used to store metadata (sweep_time, resolution_bandwidth, etc)
```
[SpectrumAnalyser example](./examples/SpectrumAnalyser_carrier.ipynb)


## Badges
![PyPI - License](https://img.shields.io/pypi/l/Labtoolkit?color=green&style=for-the-badge)
![GitHub top language](https://img.shields.io/github/languages/top/DavidLutton/LabToolkit?style=for-the-badge)
![Read the Docs](https://img.shields.io/readthedocs/labtoolkit?style=for-the-badge)
![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/pypi/labtoolkit?style=for-the-badge)
![PyPI - Downloads](https://img.shields.io/pypi/dm/labtoolkit?style=for-the-badge)
![GitHub issues](https://img.shields.io/github/issues/davidlutton/labtoolkit?style=for-the-badge)
![GitHub pull requests](https://img.shields.io/github/issues-pr/davidlutton/labtoolkit?style=for-the-badge)
![GitHub contributors](https://img.shields.io/github/contributors/davidlutton/labtoolkit?style=for-the-badge)
![PyPI](https://img.shields.io/pypi/v/labtoolkit?style=for-the-badge)


## Authors

- [@DavidLutton](https://github.com/DavidLutton)


## Acknowledgements


 - [Awesome Readme Templates](https://awesomeopensource.com/project/elangosundar/awesome-README-templates)
 - [Awesome README](https://github.com/matiassingers/awesome-readme)
 - [How to write a Good readme](https://bulldogjob.com/news/449-how-to-write-a-good-readme-for-your-github-project)
 - [readme.so](https://readme.so/editor)
 - [Sans I/O documentation](https://sans-io.readthedocs.io/index.html) 

## Makes use of 
- [NumPy](https://numpy.org/doc/stable/user/whatisnumpy.html)
- [pandas - Python Data Analysis Library](https://pandas.pydata.org/)
- [PyVISA - Control your instruments with Python](https://pyvisa.readthedocs.io/en/latest/)
- [PyVISA-py - Pure Python backend for PyVISA](https://pyvisa.readthedocs.io/projects/pyvisa-py/en/latest/)
- [pytest - helps you write better programs](https://doc.pytest.org/en/latest/)


# Notes
Lots of the libaries that exist around PyVISA start their own ResourceManager. 

Some intentionally operate differently when using a different interface (GPIB, LAN, USB, serial)

Absolutely no changes needed to run on Linux or Windows (I don't have a Mac to test with)

To rescan the avalable instruments if needed (between tests) 

To assign drivers that simplify setting and retreaving data from instruments. Which provide a fairly common interface to instruments of the same kind (spectrum analyser, oscilloscope, VNA)

Do most of the instrument response conversion out of view (see `query_bool` or `query_float`)

Make sure I could explain how this driver layer behaves to test enginners or auditors

I know I am at least number 15 in this situation [xkcd: Standards](https://xkcd.com/927/)

I will be processing reasonably sized arrays (8k min or 40k to 100k on spectrum analyser) more from an oscilloscope so Numpy and Pandas are essential

## Units
Wherever practicible units returned are in the basic unit 

Wherever practicible inputs units are in the basic unit

For example 5e-12 rather than 5 ps

Use ... for formatting when passing to users as needed

## GUI
I have used [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/getting_started/overview.html) for myself

And for a couple of single flow applications I have used [Voilà to turn Jupyter notebooks into standalone web applications](https://github.com/voila-dashboards/voila) 

As it stands I'm planning on using [Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies](https://github.com/hoffstadt/DearPyGui)




## Existing [xkcd: Standards](https://xkcd.com/927/)
- [KE5FX GPIB Toolkit](http://www.ke5fx.com/gpib/readme.htm)
- [Galvant/InstrumentKit](https://github.com/Galvant/InstrumentKit) has stripped [numpy](https://github.com/Galvant/InstrumentKit/issues/91) out
- [LabPy/lantz](https://github.com/LabPy/lantz) has gone quiet
- [p3trus/slave](https://github.com/p3trus/slave) has gone quiet, ([breakdown of IEEE 488.2](https://slave.readthedocs.io/en/develop/basic_concepts.html#module-slave.iec60488) is tidy
- [python-ivi/python-iv](https://github.com/python-ivi/python-ivi) has gone quiet, more RF focused.
- [QCoDeS/Qcodes](https://github.com/QCoDeS/Qcodes/blob/master/qcodes/instrument_drivers/Keysight/N9030B.py)
- [scikit-rf/scikit-rf: RF and Microwave Engineering](https://github.com/scikit-rf/scikit-rf)
- ...
- [relationship between pyvisa, lantz, slave, etc · Issue #23 · python-ivi/python-ivi](https://github.com/python-ivi/python-ivi/issues/23)
- [Catalog the python lab automation landscape · Issue #23 · LabPy/labpy-discussion](https://github.com/LabPy/labpy-discussion/issues/23)
- [REVIEW: Hardware-Control: Instrument Control and Automation Package · Issue #2688 · openjournals/joss-reviews](https://github.com/openjournals/joss-reviews/issues/2688)
- [berkeleylab / hardware-control — Bitbucket](https://bitbucket.org/berkeleylab/hardware-control/src/main/)
- [python-data-acquisition/meta](https://github.com/python-data-acquisition/meta/issues/1) 
- [pycro-manager](https://pycro-manager.readthedocs.io/en/latest/) focues on microscope optical tasks, has Java controller.
- [yaq](https://yaq.fyi) seems to run daemons for everything 
- [Adding Additional RF Instrument Support · Galvant/InstrumentKit](https://github.com/Galvant/InstrumentKit/issues/212)
- [QCoDeS/Qcodes](https://github.com/QCoDeS/Qcodes) Modular data acquisition framework [15 minutes to QCoDeS](http://qcodes.github.io/Qcodes/examples/15_minutes_to_QCoDeS.html)
- [pymeasure: Scientific measurement library for instruments, experiments, and live-plotting](https://github.com/pymeasure/pymeasure)
- ...
- VISA GPIB [HP-Agilent-Keysight-equipment@groups.io | GPIB toolkit on Linux ?](https://groups.io/g/HP-Agilent-Keysight-equipment/topic/85273486#118451)
- [HP-Agilent-Keysight-equipment@groups.io | HP8695E HPIB Commands](https://groups.io/g/HP-Agilent-Keysight-equipment/topic/85912607#118981)
- [Creating and Editing Waveforms with Keysight PathWave BenchVue Software | Keysight Blogs](https://blogs.keysight.com/blogs/tech/bench.entry.html/2021/09/19/creating_and_editingwaveformswithkeysightpathw-KJgF.html)
- [Exopy’s documentation](https://exopy.readthedocs.io/en/latest/)
- [Instrbuilder: Easy Instrument Control with Python ](https://lucask07.github.io/instrbuilder/build/html/)


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "LabToolkit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "Acquisition,GPIB,Measurement,RS232,Serial,USB,VISA",
    "author": "",
    "author_email": "David Lutton <david.lutton@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3f/70/da351e23633879c73d762a761334a00f31a528baf2bbf5b133fb74ee80e0/labtoolkit-1.4.0.tar.gz",
    "platform": null,
    "description": "\n# Labtoolkit\n\nPython package for instrument control, data acquisition and automation. \n\n\n## Demo enumeration\n\n``` python\nimport labtoolkit\nimport pyvisa\nfrom pyvisa_py.tcpip import TCPIPInstrVxi11 as TCPVXI11  # TCPVXI11.list_resources()\n\nrm = pyvisa.ResourceManager()\nresources = rm.list_resources('(GPIB[0129]::?*::INSTR)|(USB?*)')\nignores = ['GPIB2::22::INSTR',]\nresources = [resource for resource in resources if resource not in ignores]\n\nresources = resources + TCPVXI11.list_resources()\nignores = ['TCPIP::192.168.100.5::INSTR',]\nresources = [resource for resource in resources if resource not in ignores]\n\nlab = labtoolkit.Enumerate(resourcemanager=rm, resources=resources)\n\nsa = lab.enumeration.iloc[0].inst\n\nsa.frequency_center = 1e9\nsa.frequency_span = 10e6\nsa.sweep_points = 8192\nsa.OPC\ndf = sa.trace\n# returns a DataFrame of the trace data\ndf.plot(grid=True, figsize=(8, 6))\ndf.attrs\n# df.attrs are used to store metadata (sweep_time, resolution_bandwidth, etc)\n```\n\n## Demo manual driver selection\n\n``` python\n# Communicate with Hardware with PyVISA\nimport pyvisa\nimport labtoolkit.SpectrumAnalyser.AgilentE44nn\n\n\nrm = pyvisa.ResourceManager()\nsa = labtookit.SpectrumAnalyser.AgilentE44nn.AgilentE44nn(rm.open_resource('GPIB0::18::INSTR'))\n\nsa.frequency_center = 1e9\nsa.frequency_span = 10e6\nsa.sweep_points = 8192\nsa.OPC\ndf = sa.trace\n# returns a DataFrame of the trace data\ndf.plot(grid=True, figsize=(8, 6))\ndf.attrs\n# df.attrs are used to store metadata (sweep_time, resolution_bandwidth, etc)\n```\n[SpectrumAnalyser example](./examples/SpectrumAnalyser_carrier.ipynb)\n\n\n## Badges\n![PyPI - License](https://img.shields.io/pypi/l/Labtoolkit?color=green&style=for-the-badge)\n![GitHub top language](https://img.shields.io/github/languages/top/DavidLutton/LabToolkit?style=for-the-badge)\n![Read the Docs](https://img.shields.io/readthedocs/labtoolkit?style=for-the-badge)\n![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/pypi/labtoolkit?style=for-the-badge)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/labtoolkit?style=for-the-badge)\n![GitHub issues](https://img.shields.io/github/issues/davidlutton/labtoolkit?style=for-the-badge)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/davidlutton/labtoolkit?style=for-the-badge)\n![GitHub contributors](https://img.shields.io/github/contributors/davidlutton/labtoolkit?style=for-the-badge)\n![PyPI](https://img.shields.io/pypi/v/labtoolkit?style=for-the-badge)\n\n\n## Authors\n\n- [@DavidLutton](https://github.com/DavidLutton)\n\n\n## Acknowledgements\n\n\n - [Awesome Readme Templates](https://awesomeopensource.com/project/elangosundar/awesome-README-templates)\n - [Awesome README](https://github.com/matiassingers/awesome-readme)\n - [How to write a Good readme](https://bulldogjob.com/news/449-how-to-write-a-good-readme-for-your-github-project)\n - [readme.so](https://readme.so/editor)\n - [Sans I/O documentation](https://sans-io.readthedocs.io/index.html) \n\n## Makes use of \n- [NumPy](https://numpy.org/doc/stable/user/whatisnumpy.html)\n- [pandas - Python Data Analysis Library](https://pandas.pydata.org/)\n- [PyVISA - Control your instruments with Python](https://pyvisa.readthedocs.io/en/latest/)\n- [PyVISA-py - Pure Python backend for PyVISA](https://pyvisa.readthedocs.io/projects/pyvisa-py/en/latest/)\n- [pytest - helps you write better programs](https://doc.pytest.org/en/latest/)\n\n\n# Notes\nLots of the libaries that exist around PyVISA start their own ResourceManager. \n\nSome intentionally operate differently when using a different interface (GPIB, LAN, USB, serial)\n\nAbsolutely no changes needed to run on Linux or Windows (I don't have a Mac to test with)\n\nTo rescan the avalable instruments if needed (between tests) \n\nTo assign drivers that simplify setting and retreaving data from instruments. Which provide a fairly common interface to instruments of the same kind (spectrum analyser, oscilloscope, VNA)\n\nDo most of the instrument response conversion out of view (see `query_bool` or `query_float`)\n\nMake sure I could explain how this driver layer behaves to test enginners or auditors\n\nI know I am at least number 15 in this situation [xkcd: Standards](https://xkcd.com/927/)\n\nI will be processing reasonably sized arrays (8k min or 40k to 100k on spectrum analyser) more from an oscilloscope so Numpy and Pandas are essential\n\n## Units\nWherever practicible units returned are in the basic unit \n\nWherever practicible inputs units are in the basic unit\n\nFor example 5e-12 rather than 5 ps\n\nUse ... for formatting when passing to users as needed\n\n## GUI\nI have used [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/getting_started/overview.html) for myself\n\nAnd for a couple of single flow applications I have used [Voil\u00e0 to turn Jupyter notebooks into standalone web applications](https://github.com/voila-dashboards/voila) \n\nAs it stands I'm planning on using [Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies](https://github.com/hoffstadt/DearPyGui)\n\n\n\n\n## Existing [xkcd: Standards](https://xkcd.com/927/)\n- [KE5FX GPIB Toolkit](http://www.ke5fx.com/gpib/readme.htm)\n- [Galvant/InstrumentKit](https://github.com/Galvant/InstrumentKit) has stripped [numpy](https://github.com/Galvant/InstrumentKit/issues/91) out\n- [LabPy/lantz](https://github.com/LabPy/lantz) has gone quiet\n- [p3trus/slave](https://github.com/p3trus/slave) has gone quiet, ([breakdown of IEEE 488.2](https://slave.readthedocs.io/en/develop/basic_concepts.html#module-slave.iec60488) is tidy\n- [python-ivi/python-iv](https://github.com/python-ivi/python-ivi) has gone quiet, more RF focused.\n- [QCoDeS/Qcodes](https://github.com/QCoDeS/Qcodes/blob/master/qcodes/instrument_drivers/Keysight/N9030B.py)\n- [scikit-rf/scikit-rf: RF and Microwave Engineering](https://github.com/scikit-rf/scikit-rf)\n- ...\n- [relationship between pyvisa, lantz, slave, etc \u00b7 Issue #23 \u00b7 python-ivi/python-ivi](https://github.com/python-ivi/python-ivi/issues/23)\n- [Catalog the python lab automation landscape \u00b7 Issue #23 \u00b7 LabPy/labpy-discussion](https://github.com/LabPy/labpy-discussion/issues/23)\n- [REVIEW: Hardware-Control: Instrument Control and Automation Package \u00b7 Issue #2688 \u00b7 openjournals/joss-reviews](https://github.com/openjournals/joss-reviews/issues/2688)\n- [berkeleylab / hardware-control \u2014 Bitbucket](https://bitbucket.org/berkeleylab/hardware-control/src/main/)\n- [python-data-acquisition/meta](https://github.com/python-data-acquisition/meta/issues/1) \n- [pycro-manager](https://pycro-manager.readthedocs.io/en/latest/) focues on microscope optical tasks, has Java controller.\n- [yaq](https://yaq.fyi) seems to run daemons for everything \n- [Adding Additional RF Instrument Support \u00b7 Galvant/InstrumentKit](https://github.com/Galvant/InstrumentKit/issues/212)\n- [QCoDeS/Qcodes](https://github.com/QCoDeS/Qcodes) Modular data acquisition framework [15 minutes to QCoDeS](http://qcodes.github.io/Qcodes/examples/15_minutes_to_QCoDeS.html)\n- [pymeasure: Scientific measurement library for instruments, experiments, and live-plotting](https://github.com/pymeasure/pymeasure)\n- ...\n- VISA GPIB [HP-Agilent-Keysight-equipment@groups.io | GPIB toolkit on Linux ?](https://groups.io/g/HP-Agilent-Keysight-equipment/topic/85273486#118451)\n- [HP-Agilent-Keysight-equipment@groups.io | HP8695E HPIB Commands](https://groups.io/g/HP-Agilent-Keysight-equipment/topic/85912607#118981)\n- [Creating and Editing Waveforms with Keysight PathWave BenchVue Software | Keysight Blogs](https://blogs.keysight.com/blogs/tech/bench.entry.html/2021/09/19/creating_and_editingwaveformswithkeysightpathw-KJgF.html)\n- [Exopy\u2019s documentation](https://exopy.readthedocs.io/en/latest/)\n- [Instrbuilder: Easy Instrument Control with Python ](https://lucask07.github.io/instrbuilder/build/html/)\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python package for instrument control, data acquisition and automation",
    "version": "1.4.0",
    "project_urls": {
        "Homepage": "https://github.com/DavidLutton/LabToolkit",
        "Issues": "https://github.com/DavidLutton/LabToolkit/issues"
    },
    "split_keywords": [
        "acquisition",
        "gpib",
        "measurement",
        "rs232",
        "serial",
        "usb",
        "visa"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "41336a36dab6f06561513dc50890ec88b17ec3db3db63c06f7d470d0733e20a1",
                "md5": "05e652845d3da25167160acde0f23e31",
                "sha256": "4fa36708a266ba2ad6c82ee491a858da49c119d9b7d18cec49b8e2b4d2fc178b"
            },
            "downloads": -1,
            "filename": "labtoolkit-1.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "05e652845d3da25167160acde0f23e31",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 131101,
            "upload_time": "2023-12-26T22:33:35",
            "upload_time_iso_8601": "2023-12-26T22:33:35.440380Z",
            "url": "https://files.pythonhosted.org/packages/41/33/6a36dab6f06561513dc50890ec88b17ec3db3db63c06f7d470d0733e20a1/labtoolkit-1.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f70da351e23633879c73d762a761334a00f31a528baf2bbf5b133fb74ee80e0",
                "md5": "aebffcd8613e48c1c3e3a3ee64a3d5b9",
                "sha256": "7f277b8303c32537a396f6cd98c78b6869bb5ba420a856d74d8aa00a64e74a61"
            },
            "downloads": -1,
            "filename": "labtoolkit-1.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "aebffcd8613e48c1c3e3a3ee64a3d5b9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 113088,
            "upload_time": "2023-12-26T22:33:37",
            "upload_time_iso_8601": "2023-12-26T22:33:37.445132Z",
            "url": "https://files.pythonhosted.org/packages/3f/70/da351e23633879c73d762a761334a00f31a528baf2bbf5b133fb74ee80e0/labtoolkit-1.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-26 22:33:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DavidLutton",
    "github_project": "LabToolkit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "labtoolkit"
}
        
Elapsed time: 0.16024s