- Notifications
You must be signed in to change notification settings - Fork40
qutip/qutip-tutorials
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repositories collects tutorials of different complexity forusingQuTiP. Some of the notebooks are also shown ontheQuTiP Tutorials website.
The notebooks in this repository are stored in a Markdown format and thushave no outputs. To generate the outputs, follow the installation guide below.
The notebooks are located in the folderstutorials-v4
/tutorials-v5
,where the version number stands for the QuTiP version they work with.
To modify and execute the notebooks yourself, you have to install anenvironment with the required packages.
If you use Anaconda, you can install the required dependencies for thisrepository by:
cd qutip-tutorialsconda env create --file environment.ymlconda activate qutip-tutorials
Alternatively, you can install the requirements usingpip
(we recommendthe usage of virtual environments):
pip install -r requirements.txt
Regardless of the installation method, you can now startJupyter Notebook byexecuting:
jupyter notebook
Your browser should automatically open the Jupyter Notebook frontend. Otherwiseopen the link displayed in the terminal.
Navigate into thetutorials-v4
ortutorials-v5
directory and select one ofthe notebooks.Note that the format of the notebooks is.md
(markdown), which is intendedfor better compatibility with git features.
You are most welcome to contribute to QuTiP development by forking thisrepository and sending pull requests, or filing bug reports attheissues page.Note that all notebooks are tested automatically to work with the latestversion of QuTiP. Furthermore, this repository uses notebooks in the markdownformat. See below how to convert the format of an already existing notebook.
If you want to create a new notebook, copy thetemplate.md
located in thetutorials
directory, edit it and save it as a new markdown file. Pleasekeep in mind that new users might use the notebook as an entry point toQuTiP.
To add an already existing notebook to the repository, copy it to thetutorials
directory and create a pull request. If the notebook is in the. ipynb
format please convert it to markdown using JupyText by executing:
jupytext --to md my_notebook.ipynb
We aim to create notebooks consistent with the PEP8 style guide. Therefore, weuseflake8
to check the formatting of every notebook. To format a notebookbefore adding it to this repository you can useblack
andisort
to do so.You can apply these two tools to notebook by using the toolnbQA
.
To format any notebooknotebook.ipynb
(in the Jupyter format) run:
nbqa black notebook.ipynbnbqa isort notebook.ipynb
To test whether the notebook conforms with the PEP8 style guide run:
nbqa flake8 notebook.ipynb
If the notebook is already in the MarkDown format, you can useJupyText
to convert it back to.ipynb
:
jupytext --to notebook notebook.md
If the notebook is in the MarkDown format saved via Jupytext, you can format it using:
nbqa black notebook.md
Some functions of the notebooks (e.g. plotting QCircuits) require a workinginstallation ofImageMagick andLaTeX. Ifyou usedconda
to install the requirements,ImageMagick is alreadyinstalled. Otherwise, follow the instruction on their website.