GithubHelp home page GithubHelp logo

christina-chang-tw / pyoctal Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 3.16 MB

Instrument control and over a broad range of optical testing instruments and simple sweet tests.

License: GNU General Public License v3.0

Python 100.00%
instrument-control instrumentation-tests python3 pyvisa

pyoctal's Introduction

PyOctal

PyOctal is a Python package equipped with sweep tests, analysis tools, and interfaces with equipments that are used primarily for optical chip testing. This package supports visa communications with a varitey of instruments.

More About PyOctal

This is a tool allowing you to do three things: remotely setup your instruments, run different types of sweeps, and analyse the results afterwards. This is still at its infancy stage so is still lacking a lot of functions which are widely used by the users. Please suggest and we would love to help!

Take a look at here for detailed information of supported instruments.

Directory Structure

.
<folders>
├── config                   # all configuration files
│   └── ...                         # read the README.md
├── pyoctal                  # core library
│   └── ...                         # read the README.md
├── results                  # all test results should be stored here <empty>
├── tools                    # all test results should be stored here
│   |── plot_main.py                # plotting graphs
│   |── instr_main.py               # simple interface for setting up instruments
│   └── sweep_main.py               # interface for running sweeps
<files>
├── pyproject.toml           # pyoctal package setup 
├── requirements.txt         # contain all required python packages for this repository <need to be amended>
└── venv_setup.py            # set up virtual environment <not working>

Installation

Before installing any of the software, please make sure that you know exactly the operating system that you are running on and whether it is 32-bit or 64-bit.

Environment

This repository only works when two conditions are satisfied:

  • Windows OS machine - this is neccessary for pywin32 module
  • python version >= 3.6 - this is neccessary for f-string formatting

Method 1 - Install Anaconda (Preferred):

The Anaconda version must

  • Support your current Windows OS system
  • Able to create a Python 3.6 environment

Install Anaconda version which supports your OS system and make sure all Listed packages in requirements.txt are installed.

To install packages, go to Enviornments tab, select not installed, and then search up the packages. There are some packages that might not be Listed because the channel which contain them are not imported upon installation. If that is the case, search up the python package and find the corresponding channel and include it in Anaconda environment.

If your Anaconda does not use Python 3.6 for its environment, it will fail to install pyvisa. Firstly, make sure that the current Anaconda python version is at least 3.6. Once the condition is satisfied, create a new environment with Anaconda Prompt and specify Python version as Python 3.6. After the new environment is successfully created, it can be viewed under Environments tab. The packages can then be installed on this new environment without errors.

# create a new conda environment
> conda create --name pyoctal_env python=<version>
# activate your new environment
> conda activate pyoctal_env
# deactivate
> conda deactivate
  • pyvisa requires "conda-forge" channel
  • pyaml requires "conda-forge" channel

NOTE FOR WINDOWS 7 USERS: If your system is running on Windows 7, please only install Anaconda versions which are equipped with Python versions older than 3.8. This is very important as versions since Python 3.9 do not support Windows 7. The safe option is install versions before anaconda3-2020-11.

If you attempt to install the later anaconda version on your Windows 7 system, you will get a "Failed to create menus" error. Refer to Using Anaconda on older operating systems for more information.

Method 2 - Use Virtual Python Environment:

Run this in the root-directory of this repository namely autotesting.

Platform Shell Command to activate virtual environment
Posix bash/zsh $ source .venv/bin/activate
fish $ source .venv/bin/activate.fish
csh/tcsh $ source .venv/bin/activate.csh
PowerShell $ .venv/bin/Activate.ps1
Windows cmd.exe > .venv\Scripts\activate.bat
PowerShell > .venv\Scripts\Activate.ps1
# This automatically setup your virtual environment
> python3 -m venv_setup

# Windows PS example
# Activate a venv machine.
> .venv\Scripts\Activate.ps1

# Deactivate a venv machine
> deactivate

Install PyOctal

For users, I recommend to update your current old repository to a newer version by cloning or downloading this repository again and delete the old ones.

Method 1 - Clone from Git (Preferred):

Getting the repository cloned to a local direcotory

# Create a directory named autotesting
> mkdir pyoctal
# Go into that directory
> cd pyoctal
# Clone this repository down to your autotesting directory
> git clone https://github.com/christina-chang-tw/PyOctal.git
# move into that directory
> cd PyOctal

Method 2 - Download from Github:

You can download a zip file containing this repository by navigating to <> Code tab and then select Local and Download ZIP.

Method 3 - Pip Installation

This package supports installation using pip allowing users to expand the project further. The usage is just like other python packages.

> python -m pip install pyoctal

Getting Started

How to Run a Test?

There has been a refactoring in this module. It used to be using argparse as an interface, but due to have more and more testings to be added, I have chosen to run each file individually and those files are stored in the tools directory.

Sweeps

# Example: 
> python -m tools.sweeps.pulse

Instrument Setup

An interface to easily setup an instrument. Go to tools > setups > config.yml to change the settings for the corresponding instrument.

Test Instrument Description
agilent816xB Agilent 8163B, 8164B Setup the multimeter to the auto-range and desired wavelength and output power
E3640A Set the output voltage and current limit for the DC power source
# Example: 
> python -m tools.setups.main 816xB

Debugging issues

  1. f-string formatting method cannot be used is an issues related to the python version. Only versions after Python 3.6 adopts f-string format.
  2. Contact me if need extra help: [email protected]

pyoctal's People

Contributors

christina-chang-tw avatar finlaymorrison avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

nushakoff

pyoctal's Issues

Auto-aligning of laser module to a specified dB point

It is desirable to operate a modulator at a wavelength of specific dB point. As the operating point will be in relative to the maximum output power so this shouldn't change with regards of the coupling loss. This automation is intended to strip away the possibility of human error on setting an incorrect operating wavelength.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.