Package: pyoctal
PyOctalPyOctal is a Python package equipped with sweep tests, analysis tools, and interfaces with equipments that are used primarily for optical chip testing.More About PyOctalDirectory StructureInstallationGit BashPython EnvironmentVisual Studio Code (VSCode)Install PyOctalGetting StartedHow to Run a TestTest and Setup InstrumentsDebugging IssuesDeveloper GuideGit BashExpand this LibraryMore About PyOctalThis 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 atherefor 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>InstallationBefore 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.Git Bash (Optional)If you have not install Git, install the newest correct version of Git for your Windows system. Git is a source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. This is a very useful tool to keep track of the newest information being pushed onto the remote Github repository.EnvironmentThis repository only works when two conditions are satisfied:Windows OS machine - this is neccessary for pywin32 modulepython version >= 3.6 - this is neccessary for f-string formattingMethod 1 - Install Anaconda (Preferred):The Anaconda version mustSupport your current Windows OS systemAble to create a Python 3.6 environmentInstall Anaconda version which supports your OS system and make sure all listed packages inrequirements.txtare 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 installpyvisa. 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>condacreate--namepyoctal_envpython=<version># activate your new environment>condaactivatepyoctal_env# deactivate>condadeactivatepyvisarequires "conda-forge" channelpyamlrequires "conda-forge" channelNOTE 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 toUsing Anaconda on older operating systemsfor more information.Method 2 - Use Virtual Python Environment:Run this in the root-directory of this repository namelyautotesting.PlatformShellCommand to activate virtual environmentPosixbash/zsh$ source .venv/bin/activatefish$ source .venv/bin/activate.fishcsh/tcsh$ source .venv/bin/activate.cshPowerShell$ .venv/bin/Activate.ps1Windowscmd.exe> .venv\Scripts\activate.batPowerShell> .venv\Scripts\Activate.ps1# This automatically setup your virtual environment>python3-mvenv_setup# Windows PS example# Activate a venv machine.>.venv\Scripts\Activate.ps1# Deactivate a venv machine>deactivateVisual Studio Code (VSCode)Install VSCode for code editing or running in python terminal. This software can be opened in Anaconda Navigator under Home tab. Recommend you to setup a Github account if you have not already done so and sign in to the account in VSCode.Open a new bash terminal in VSCode by going to the top tab bar and Terminal > New Terminal. Now you will have opened a terminal and ready to clone the repository down.NOTE:If you are running Windows 7, alternative code editors, such as Atom, VSCodium, and Texteditor are available.Install PyOctalFor 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>mkdirautotesting# Go into that directory>cdautotesting# Clone this repository down to your autotesting directory>gitclonehttps://github.com/christina-chang-tw/PyOctal.git# move into that directory>cdPyOctalMethod 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 InstallationThis package supports installation using pip allowing users to expand the project further. The usage is just like other python packages.>python-mpipinstallpyoctalGetting StartedHow to Run a Test?Everything is this repository should be run as a python module. It uses argparse package to parse command line information to the program.SweepsThese are the optical tests that are currently implemented by this library. These can be run by runningsweep_main.pyas a module from the root directory.TestsInstrumentsDescriptionpassiveILME, Agilent 8163BInsertion loss testing using PAS ILME engineAgilent 8163BManual insertion loss testingdcdc sweepsBefore you run a test, please make sure that you set all parameters correctly in the corresponding configuration file! All configuration files should be stored underconfigfolder.# Example:# (1) General helper message>python-msweep_main-h# (2) Run a passive test without specifying anything>python-msweep_main-tpassive# (3) Run a dc sweep test with logging level as DEBUG and specify the config file path>python-msweep_main-tdc--config./config/test.yamlInstrument SetupAn interface to easily setup an instrument.TestInstrumentDescriptionagilent8163BAgilent 8163BSetup the multimeter to the auto-range and desired wavelength and output powerh_speedSetup the clock frequency for both clock signal generator and oscilloscope# Example:# (1) General helper message>python-minstr_main-h# (2) Helper message for specific instrument(s)>python-minstr_mainagilent8163B-h# (3) Setup 8163B wavelength at 1550nm and power at 10dBm>python-minstr_mainm_8163b-w1550-p10Debugging issuesf-string formatting method cannot be used is an issues related to the python version. Only versions after Python 3.6 adopts f-string format.Contact me if need extra help:tyc1g20@soton.ac.ukDeveloper InformationGit BashGit commands related to updating the remote directory. The best practice isCreate a new branch before making any modifictions to the repository as it isolates out your changes from othersAlways pull the newest update before you push your new changesOnce you are satisfied and ready to make the final update to the main reponsitory, merge your branch and the main branch togetherCreate a branch for developing your own code:# Example>gitbranchnew_branch# create a new branch called new_branch>gitcheckoutnew_branch# checkout to new_branch from current branchPull the newest changes down:>gitpull# or>gitpullhttps://github.com/christina-chang-tw/orcoctal.gitPush your local changes to the remote repository:>gitadd.
>gitcommit-m"message"# commit your local changes with "message" as a comment>gitpush# push your changes to the remote branchExpand this libraryTo maintain the current structure, place your instrument class in the correct file. If the type of your instrument does not exist yet, please create a class which subclass theBaseInstrumentclass.