Skip to main content

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

Metadata

Release files for pyflexlab 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyflexlab 1.1
File Size Uploaded Provenance Actions
pyflexlab-1.1.tar.gz 204.8 kB Without provenance Details for pyflexlab-1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyflexlab 1.1
File Interpreter ABI Platform Actions
pyflexlab-1.1-py3-none-any.whl Python 3 none any Details for pyflexlab-1.1-py3-none-any.whl

Total release size: 434.2 kB

Release files / pyflexlab-1.1.tar.gz

Download URL pyflexlab-1.1.tar.gz
Size 204.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e7d9098d455c329f5b24ee5e4c83098d0cc9cb7ce8d3b42dc38922263bb2061d
BLAKE2b-256 checksum
How to use checksums
c97233bc1ace061deff855d57cb79547a566b54ad5457751484d3b1396c3b35a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release files / pyflexlab-1.1-py3-none-any.whl

Download URL pyflexlab-1.1-py3-none-any.whl
Size 229.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce9ef8a1adad95fcf2354e8f389708928ff2067d7db9d2efa12d573ae2486a93
BLAKE2b-256 checksum
How to use checksums
28d288e4434e8ab757bde106123f044c5cdff29eaf90ace796b492562538e4c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Security for pyflexlab 1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page