Skip to main content

Integrated Tools for Electronic, Cryogenic and Magnetic Measurements

Project description

pyflexlab 🔬

Python 3.11+ PyMeasure QCoDeS License: MIT

An integrated package for scientific data collection, processing, and visualization

pyflexlab is an integrated package based on PyMeasure and QCoDeS, designed for collecting, processing, and plotting experimental data.

Why pyflexlab instead of QCoDeS/PyMeasure? While QCoDeS/PyMeasure provides excellent out-of-box experience for experiments, pyflexlab offers a more flexible, lower-level interface that enables direct control over instruments, as if sitting right beside them. This approach allows researchers to implement highly customized experimental workflows. More to mention, the drivers of QCoDeS or PyMeasure alone are not complete. It's often the case one needs to assemble different versions of drivers.

Brief Summary of What it does: Utilize the basic interface of PyMeasure & QCoDeS to manipulate instruments and encapsulate similar instruments with unified interface, thus providing basic modules for measurement workflow.

📋 Table of Contents

✨ Key Features

  • 🔧 Flexible Architecture: Lower-level interface and modularized components, enabling flexible composition of complex functionalities
  • 🎛️ Unified Control: Seamless interface for instruments control
  • 💾 Automatic File Organization: Structured data storage with automatic file organization
  • 📊 Live Visualization: Real-time visualization and data recording (Jupyter / Dash web interface)
  • 📈 Data Analysis: Comprehensive tools for data analysis and processing

🚀 Installation

Ensure you have Python 3.11 or higher installed. Virtual environment is recommended. You can install it through pypi or local package downloaded here (add [gui] option for using GUI):

# local package installation
cd ${PACKAGE_DIR}  # replace with folder path
python -m pip install . 
# pypi installation
python -m pip install pyflexlab 

📖 Usage

Set Environmental Variables

  • PYLAB_DB_LOCAL: the path to the local database, storing rarely changing data like measure_type.json
  • PYLAB_DB_OUT: the path to the out database, storing the main experimental data and records

(set them via os.environ or directly in the system setting, the suffixes of the env vars do not matter, like PYLAB_DB_OUT and PYLAB_DB_OUT_User are the same. The package will automatically choose the first one found in alphabetic order)

Configure Local Setting Files

measure_types.json is used for automatically naming data files. This highly depends on personal preferences and research needs. A template is provided. assist_measure.ipynb and assist_post.ipynb are jupyter notebook files used for convenience of measurements. The program will automatically retrieve them from local database path and paste them to the measurement directory.

These files should be placed in the local database directory specified by PYLAB_DB_LOCAL.

Also, templates for them are provided with the package, run follow command to initialize the local database folder:

import pyflexlab
pyflexlab.initialize_with_templates()

Start Measurement

Detailed examples of a few typical measurements have been demonstrated in assist_measure.ipynb. But just as the reason why this package exists, the measurement workflow can be easily established via basic python knowledge and understanding of instruments.

Provided GUIs

  • 🔄 gui-coor-trans: A GUI for coordinate transformation used to locate objects using two reference points on a flat surface (linear transform solver)
  • 🎨 gui-pan-color: A color palette for choosing colors

🔌 Supported Instruments

Currently supported instruments are listed here (some are directly from or modified from PyMeasure/QCoDeS; others are self-written):

  • Meters: Keithley 2182a/2400/2401/2450/6221/6430/6500; SR830
  • Temperature Controllers: Oxford ITC503, Oxford Mercury ITC
  • Magnet Controllers: Oxford IPS
  • Other Instruments: Probe Rotator (need C++ interface WJ_API.dll)

Custom instrument drivers can be easily added referring to the abstract classes in equip_wrapper.py. Drivers with good universality will be contributed back to PyMeasure or QCoDeS, hopefully.

⚠️ Known Issues

  • The memory management of plotly drawing remains a problem for long-time measurement. (be careful when number of points exceeds 50k)
  • The driver of the rotator is not working properly due to weird interaction between C++ dll and python
  • Currently no keyboard interruption actions implemented, if the measurement is interrupted, the meters would be left in the last state (data is saved in real-time, interruption won't affect data)
  • The dash app in Chrome would crash from time to time. (won't affect anything, just refresh the page)

📦 Dependencies

  • Python >= 3.11 (earlier version is not tested)
  • Required packages:
    • numpy
    • pandas
    • matplotlib
    • plotly >= 5.24.1
    • kaleido == 0.1.0.post1
    • pyvisa
    • pyvisa-py
    • pymeasure >= 0.14.0
    • qcodes >= 0.47.0
    • jupyter
    • dash
  • Optional packages:
    • PyQt6

Built with ❤️ for scientific research

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyflexlab-1.0.tar.gz (113.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyflexlab-1.0-py3-none-any.whl (116.3 kB view details)

Uploaded Python 3

File details

Details for the file pyflexlab-1.0.tar.gz.

File metadata

  • Download URL: pyflexlab-1.0.tar.gz
  • Upload date:
  • Size: 113.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for pyflexlab-1.0.tar.gz
Algorithm Hash digest
SHA256 6e6d4785e1ebd8c96ac00436102e6dad020ef10b506979c9da64029c1b9b47ea
MD5 a7ebbd8d02ce442d35ab391e14dccd79
BLAKE2b-256 e83ae5797f26247781f33875c33a2ef1d208d434a92ce608d880df6fc82fda5e

See more details on using hashes here.

File details

Details for the file pyflexlab-1.0-py3-none-any.whl.

File metadata

  • Download URL: pyflexlab-1.0-py3-none-any.whl
  • Upload date:
  • Size: 116.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for pyflexlab-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5e15730f9ba3d8f3f94cc9168add04a52cc5892f706eafea45cdecc6b4c65fe
MD5 6b19e0b2de51e7f66ee9a267c66de25e
BLAKE2b-256 887e2ac333da98019e3d2f2a60020b7ba27c0bd1015d7bd237aa7f5a645dcbbc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page