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. This function has been migrated to PyOmnix package, which is a dependence of this package.

🔌 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; KeySight b2902b; SR830/860
  • Temperature Controllers: Oxford ITC503, Oxford Mercury ITC, LakeShore336
  • 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 in jupyter inline mode. Use dash mode for long-time measurement.
  • 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)

📦 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
    • pyomnix
  • Optional packages:
    • PyQt6

Built with ❤️ for science

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.1.tar.gz (204.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.1-py3-none-any.whl (229.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyflexlab-1.1.tar.gz
  • Upload date:
  • Size: 204.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for pyflexlab-1.1.tar.gz
Algorithm Hash digest
SHA256 e7d9098d455c329f5b24ee5e4c83098d0cc9cb7ce8d3b42dc38922263bb2061d
MD5 ff61fc9519a004bfa77ca9fcb4bfa452
BLAKE2b-256 c97233bc1ace061deff855d57cb79547a566b54ad5457751484d3b1396c3b35a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyflexlab-1.1-py3-none-any.whl
  • Upload date:
  • Size: 229.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for pyflexlab-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce9ef8a1adad95fcf2354e8f389708928ff2067d7db9d2efa12d573ae2486a93
MD5 ecc00c55b5d2cb2bc3ef37d45631a1be
BLAKE2b-256 28d288e4434e8ab757bde106123f044c5cdff29eaf90ace796b492562538e4c8

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