My programming interests are mainly in scientific simulation, numerical calculation, data analyses, and instrumentation (control software for measurements). The majority of my public projects focus on building a Python-ecosystem for scientific experiments:
Magnetic simulation (PyMacrospin) and CMOS circuit simulation (PyWRspice)
Experiment control (PyMeasure, Auspex) and optimization (Adapt)
A big part of the beauty and challenge of magnetization dynamics comes from its vector analysis. Vector differential equations are usually nonintuitive and difficult to manipulate. A good way to understand and gain intuition of magnetization dynamics is to visualize it by simulation.
PyMacrospin is a Python package to perform macrospin (i.e. standalone magnetization vector) simulation following the Landau-Lifshitz-Gilbert description of magnetization dynamics under an effective field and the Slonczewski spin-transfer-torque effect. The package provides simple interface to describe the sample (demag field, uniaxial and cubic anisotropy), spin-torque contribution, and sweep the external field and current for most frequently used measurement techniques. Beside the implementation using core Python, the package comes with Numba and Cython kernels to speed up the calculation by 100x.
Originally developed as macrospin by Colin Jermain in his time in grad school. I upgraded the package by adding core Python and Numba kernels.
PyWRspice is a Python wrapper for WRspice circuit simulator. It helps construct circuit schematics, render them to SPICE netlists, run them through WRspice and read the outcome into Numpy arrays for further data processing. Hence, with PyWRspice, one can design, simulate circuits and analyze the results in a single Jupyter notebook. The big benefit of having all these tasks in one place is that one can optimize the circuit parameters by dynamically varying the parameters depending on the simulated results.
Some perks from PyWRspice for heavy circuit simulation workload: It can run multiple simulations in parallel using multi-core processor, and can run simulations on a remote server (via SSH connection).
I wrote PyWRspice for an internal project at Raytheon BBN. Fortunately it was made publicly available and has been used by people outside of the company.
How would you run a measurement from a computer? Some of us may choose to use LabView or Matlab, both are commercial software with expensive license fee, to set up a control program on the computer. When the measurement is completed and data collected, we run a separate program to analyze the data. From what we learn from the analyzed results, we will likely do a few more iterations of the measurement. Isn’t it painful?
PyMeasure offers a free-of-charge solution to build a control program for your measurements, switching between running on a Jupyter notebook (yes, programmers’ favorite) and GUI without changing much of your codes. The package takes all the pain off your construction of a control program: it builds GUI and dynamic plots, it takes care of data collection, logging, and backup. What you need to do is specifying the overall procedure: which equipment does what, how the sweeps are to be executed. The rest will be automatic.
Led by Colin Jermain during our time in grad school at Cornell Univ. The package has been well maintained since then.
The PyMeasure package mentioned above targets convenience and peace of mind for novice programmers: it helps to quickly build a GUI program to run simple measurement sweeps. Think of it as an open-source replacement of LabView or Matlab. But if you want to run complicated measurements with irregular sweeps and collect a huge amount of data, then you need something more customizable. That is what Auspex offers.
Auspex was developed for automating high-speed, complex measurements in quantum computer engineering. It allows you to construct measurements dynamically: Next measurements can be dynamically modified depending on the outcome of the previous runs. If cleverly designed, this strategy can lead to huge gain in speed (see the package Adapt below). Data are stored in HDF5 binary format which can handle large datasets and is easily ported to Python.
Led by Graham Rowlands, my ex-boss at Raytheon BBN and the head of the QEC (quantum engineering and computing) group, and developed by the scientists and engineers in the group.
In physical experiments and numerical simulation, we often sweep one or more parameters, normally on a equally-separated grid. That can be inefficient. For instance, the most interesting features of a ferromagnetic resonance measurement are often found around the resonance frequency (which is unknown before the measurement). A sweep on a grid is inefficient if most parts of the grid are far away from the resonance.
A more effective strategy for sweeping is to do it adaptively: First, run a quick sweep on a sparse grid with few data points. Then analyze the result from the first round, and decide whereabout to measure more. Adapt is a little package to help with this: It determines the points on the parameter space for the next round of measurement based on the results gotten so far so that the measurement can focus more on the most informative areas in the parameter space.
I wrote the majority of Adapt during my summer internship at Raytheon BBN.
Echo State Network (ESN) is a popular flavor of Reservoir Computing which is a branch of Recurrent Neural Networks. The simplicity and effectiveness of ESN has been demonstrated in machine learning benchmarks involving time-series data (audio, communications, etc), especially prediction tasks. Its internal dynamics motivates physicists to search for physical dynamical systems as its hardware implementation.
PyESN is a Python module for ESN, originally developed by Clemens Korndörfer. I revised the package to allow simulation of ESN with physical systems.
A Python version of FourmiLab's ENT: Benchmarking suite for pseudorandom number generator. It performs the following tests on random number sequence (read byte-per-byte from binary files):
Entropy
Chi-square
Arithmetic mean versus Median
Monte-Carlo value for Pi
Serial correlation coefficient
STDF is a standard binary file format to store wafer, die and chip testing data in semiconductor industry. PySTDF is a Python parser to read STDF files, mostly developed by Casey Marshall for Python 2. I ported it to Python 3 and added some extra features such as Excel extraction.