Package: pyEPR-quantum
Welcome to pyEPR :beers:!      (seearXiv:2010.00620)Automated Python module for the design and quantization of Josephson quantum circuitsDocumentationRead the docs here.Scientific work:Minev, Z. K., Leghtas, Z., Mudhada, S. O., Reinhold, P., Diringer, A., & Devoret, M. H. (2018).pyEPR: The energy-participation-ratio (EPR) open-source framework for quantum device design.Minev, Z. K., Leghtas, Z., Mundhada, S. O., Christakis, L., Pop, I. M., & Devoret, M. H. (2020). Energy-participation quantization of Josephson circuits. ArXiv. Retrieved fromhttp://arxiv.org/abs/2010.00620(2020)Z.K. Minev, Ph.D. Dissertation, Yale University (2018), Chapter 4. (arXiv:1902.10355)  (2018)pyEPR Working group meeting -- Planning for the future of pyEPRPlease sign-up here:https://github.com/zlatko-minev/pyEPR/issues/45ordirectly here:bangbang: :beers:SeepyEPR wikifor notes from first meeting.We will schedule a follow-up meeting in 1-2 mo.Who uses pyEPR?Yale University, Michel Devoret labQLab, CT, USAYale University, Rob Schoelkopf labRSL, CT, USAIBM Quantumand IBM's Qiskit MetalQUANTIC(QUANTUM INFORMATION CIRCUITS), PARISINRIA, ENS, MINES PARISTECH, UPMC, CNRS. Groups of Zaki Leghtas and team. FranceQuantum Circuit GroupBenjamin Huard, Ecole Normale Supérieure de Lyon, FranceEmanuel Flurin, CEA Saclay, FranceIoan Pop group, KIT Physikalisches Institut, GermanyUC Berkeley,Quantum Nanoelectronics Laboratory, Irfan Siddiqi, CA, USAQuantum Circuits, Inc., CT, USASeeqc(spin-out of Hypres) Digital Quantum Computing, USASerge [Rosenblum Lab] quantum circuits group (https://www.weizmann.ac.il/condmat/rosenblum/) in the Weizmann Instatue, IsraelUniversity of Oxford - LeekLab - PeterLeek Lab, UKBrittonPlourde Lab, Syracuse University, USAJavadShabani LabQuantum Materials & Devices, NYU, NY, USAUChicago Dave Schuster Lab, USASQC lab - Shay Hacohen Gourgy, IsraelLawrence Berkeley National LabColorado School of Mines, USASyracuse University, USAIPQC, SJTU, Shanghai, ChinaBhabha Atomic Research Centre, IndiaQuantum Computing UKAlice&Bob, FranceCentre for Quantum Technologies / QcrewQuantum Device Lab ETHZ; Andreas WallraffBleximo... and many more! (Please e-mailzlatko.minev@aya.yale.eduwith updates.)Contents:Start here: UsingpyEPRVideo TutorialsSetup and InstallationHFSS Project Setup forpyEPRTroubleshootingpyEPRAuthors and ContributorsStart here: UsingpyEPRFork:fork_and_knife: thepyEPR top-level repositoryon GitHub. (How to fork a GitHub repo?). Share some love bystaring:star:pyEPR.Clone:point_down: your forked repository locally. (How to clone a GitHub repo?). Setup thepyEPRpython code by followingInstallation and Python Setup.TutorialsLearn how to use using thejupyter notebook tutorialsStay up to dateEnjoy and make sure to git add the master remote branchgit remote add MASTER_MINEV git://github.com/zlatko-minev/pyEPR.git(help?).CitepyEPRarXiv:2010.00620/arXiv:1902.10355and enjoy! :birthday:Start-up exampleJupyter notebook tutorialsThe following code illustrates how to perform a complete analysis of a simple two-qubit, one-cavity device in just a few lines of code withpyEPR.  In the HFSS file, before running the script, first specify the non-linear junction rectangles and variables (see Sec. pyEPR Project Setup in HFSS). All operations in the eigen analysis and Hamiltonian computation are fully automated. The results are saved, printed, and succinctly plotted.# Load pyEPR. See the tutorial notebooks!importpyEPRasepr# 1. Connect to your Ansys, and load your designpinfo=epr.ProjectInfo(project_path=r'C:\sim_folder',project_name=r'cavity_with_two_qubits',design_name=r'Alice_Bob')# 2a. Non-linear (Josephson) junctionspinfo.junctions['jAlice']={'Lj_variable':'Lj_alice','rect':'rect_alice','line':'line_alice','Cj_variable':'Cj_alice'}pinfo.junctions['jBob']={'Lj_variable':'Lj_bob','rect':'rect_bob','line':'line_bob','Cj_variable':'Cj_bob'}pinfo.validate_junction_info()# Check that valid names of variables and objects have been supplied.# 2b. Dissipative elements: specifypinfo.dissipative['dielectrics_bulk']=['si_substrate','dielectric_object2']# supply names of hfss objectspinfo.dissipative['dielectric_surfaces']=['interface1','interface2']# Alternatively, these could be specified in ProjectInfo with# pinfo = epr.ProjectInfo(..., dielectrics_bulk = ['si_substrate', 'dielectric_object2'])# 3.  Perform microwave analysis on eigenmode solutionseprd=epr.DistributedAnalysis(pinfo)if1:# automatic reportseprd.quick_plot_frequencies(swp_var)# plot the solved frequencies before the analysiseprd.hfss_report_full_convergence()# report convergenceeprd.do_EPR_analysis()# 4a.  Perform Hamiltonian spectrum post-analysis, building on mw solutions using EPRepra=epr.QuantumAnalysis(eprd.data_filename)epra.analyze_all_variations(cos_trunc=8,fock_trunc=7)# 4b. Report solved resultsswp_variable='Lj_alice'# suppose we swept an optimetric analysis vs. inductance Lj_aliceepra.plot_hamiltonian_results(swp_variable=swp_variable)epra.report_results(swp_variable=swp_variable,numeric=True)epra.quick_plot_mode(0,0,1,numeric=True,swp_variable=swp_variable)pyEPRVideo TutorialsTutorial 1 - OverviewTutorial 2 - Setup of Conda & GitTutorial 3 - Setup of Packages & ConfigJupyter notebook tutorialsInstallation and setup ofpyEPRUsepyEPRdirectly from the source, and pull updates from the master git repo, since we often update it. The following steps explain how to set up Python 3, fork thepyEPRrepo and use it.
Please keep up to date withpyEPRby using git. We like to make it simple using a git-gui manager,SourceTreeorGitHub Desktop.Quick setupWe recommend the approach in the following section, which will be most up to date, but for quick use you can use theconda forge channelto installconda install -c conda-forge pyepr-quantumor thePyPichannelpip install pyEPR-quantumRecommended procedure.Install Python 3.x, we recommend theAnacondadistribution.The code is currently under dev with Python 3.6/7. It was developed under 2.7 and should still be compatible.After the install, make sure you configure your system PATH variables. On Windows, in the taskbar search or control panel, search for"Edit environment variables for your account". In the section System Variables, find the PATH environment variable and select it. Click Edit.  PlaceC:\Anaconda3;C:\Anaconda3\Scripts;C:\Anaconda3\Library\bin;at the beginning of the path. If you have a previous Python installation this step isveryimportant, especially to compile the qutip module. You may verity your path using the following command in the Command Prompt (terminal):sh $ echo %PATH%Install the required packages, includingpint,qutip, andaddict. In a terminal windowcondainstall-cconda-forgepint
condainstall-cconda-forgequtip
pipinstalladdictFork this pyEPR repository on GitHub with your GitHub account. You may clone the fork to your PC and manage it using theSourceTreegit-gui manager.Add the pyEPR repository folder to your python search path. Make sure to add the git remote to the master is set up,git remote add MASTER_MINEV git://github.com/zlatko-minev/pyEPR.git!(Help?)Edit pyEPR module_config_user.pyto set your data-saving directory and other parameters of interest.  (To keep your changes local, use the shell commandgit update-index --skip-worktree _config_user.pyin thepyEPR/pyEPRfolder)ENJOY and cite pyEPR!:+1:“Editable” install for development modeAlthough not required, it’s common to locally install your project in “editable” or “develop” mode while you’re working on it. This allows your project to be both installed and editable in project form.Assuming you’re in the root of your project directory, then run(see here):python -m pip install -e .Although somewhat cryptic, -e is short for --editable, and . refers to the current working directory, so together, it means to install the current directory (i.e. your project) in editable mode. This will also install any dependencies declared with “install_requires” and any scripts declared with “console_scripts”. Dependencies will be installed in the usual, non-editable mode. Quoted frompythonNote for Mac/Linux.Follow the same instructions above. You shouldn't have to install mingw or modify distutils.cfg, since your distribution should come with gcc as the default compiler.Legacy usersWarning: pyEPR organization was significantly improved in v0.8-dev (starting 2020; current branch: master [to be made stable soon]). If you used a previous version, you will find that all key classes have been renamed. Please, see the tutorials and docs.  In the meantime, if you cannot switch yet, revert to use the stable v0.7.HFSS Project Setup forpyEPREigenmode Design --- How to set up junctionsYou may find an advised work flow and some setup tips here.Define circuit geometry & electromagnetic boundary condition (BC).Junction rectangles and BC: Create a rectangle for each Josephson junction and give it a good name; e.g.,jAlicefor a qubit named Alice. We recommend 50 x 100 um rectangle for a simple simulation, although orders of magnitude smaller rectangles work as well. Note the length of this junction, you will supply it to pyEPR. Assign aLumped RLCBC on this rectangle surface, with an inductance value given by a local variable,Lj1for instance. The name of this variable will also be supplied to the pyEPR.Over each junction rectangle draw a modelpolylineto define give a sense of the junction current-flow direction. This line should spans the length of the full junction rectangle. Define it using an object coordinate system on the junction rectangle (so that they move together when the geometry is altered). The name of this line will be supplied to the pyEPR module.Meshing.Lightly mesh the thin-film metal BC. Lightly mesh the junction rectangles.Simulation setupWe recommendmixed ordersolutions.Troubleshooting pyEPRFirst run: pint error: system='mks' unknown.Please update to pint version newer than 0.7.2. You may usepip install pint --upgradeNo attributeStringIOduring do_EPR_analysis()AttributeError: module 'pandas.compat' has no attribute 'StringIO'Caleb pointed this out, seehereand here forsolution. You need to change the pandas version. [pyEPR to be upgraded]This was solved inthis commit. Try to update your pyEPR version to the current master.When importing qutip an error occursAttributeError: module 'numpy' has no attribute '__config__'You probably have to update your numpy installation. For me, the following bash sequence worked:conda update qutip
conda update numpyQutip installationYou may also choose to install the optional qutip package for some advanced numerical analysis of the Hamiltonian.
We useQutipto handle quantum objects. Follow the instruction on their website. As of Aug. 2017, qutip is part of conda, and you can usecondainstallqutipIf this doesn't work, try  installing from conda forgecondainstall-cconda-forgequtipQutip installation -- alternative, manual installIf you wish to install manually, follow the following procedure. Some of this can get a bit tricky at times.
First, you need to install a C compiler, since qutip uses Cython. If you dont have VS9, gcc, or mingw installed, the following works:pipinstall-ihttps://pypi.anaconda.org/carlkl/simplemingwpyLet anaconda know to use this compiler by creating the fileC:\Anaconda2\Lib\distutils\distutils.cfgwith the following content[build]
compiler = mingw32
[build_ext]
compiler = mingw32Next, let's install qutip. You can choose to use conda install or pip install, or pull from the git directly  as done here:condainstallgit
pipinstallgit+https://github.com/qutip/qutip.gitCOM Error on opening HFSSCheck the project and design file names carefully. Make sure that the file-path doesn't have apostrophes or other bad characters, such as in C:\Minev's PC\my:Project.  Check that HFSS hasn't popped up an error dialogue, such as "File locked." Manually open HFSS and the file.COM error on calculation of expressionEither HFSS popped an error dialog, froze up, or you miss-typed the name of something.HFSS refuses to closeIf your script terminates improperly, this can happen. pyHFSS tries to catch termination events and handle them. Your safety should be guaranteed however, if you callhfss.release()when you have finished. Use the Task-manager (Activity Monitor on MAC) to kill HFSS if you want.Parametric Sweep ErrorWhen running a parametric sweep in HFSS, make sure you are actually saving the fields for each variation before running pyEPR. This can be done by right-clicking on your ParametricSetup -> properties -> options -> "Save Fields and Mesh".Spyder pops up command window cmd with tput.exe executedThis problem is due to pandas 0.20.1, update to 0.20.3 or better solves this issue.ValueError: cannot set WRITEABLE flag to True of this arrayThis error happens when trying to read in an hdf file with numpy version 1.16, seegit issue here. A solution is to downgrade numpy to 1.15.4 or upgrade to newer versions of hdf and numpy.Authors and ContributorsAuthors:Zlatko Minev&Zaki Leghtas, with contributions from many friends and colleagues. (arXiv:2010.00620)2015 - present.Contributors:Phil Rheinhold, Lysander Christakis,Devin Cody, ...
Original versions of pyHFSS.py and pyNumericalDiagonalization.py contributed byPhil Rheinhold, excellent originalrepo.Terms of use: Use freely and kindly cite the paper (arXiv link to be posted here) and/or this package.How can I contribute? ContactZ. MinevorZ. Leghtas.How do I citepyEPR?Use thisbibtexforpyEPRand for the method use the energy-participation-ratio paperarXiv:2010.00620.