diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000..383e65c --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,23 @@ +name: Pylint + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + - name: Analysing the code with pylint + run: | + pylint $(git ls-files '*.py') diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..de5b471 --- /dev/null +++ b/.gitignore @@ -0,0 +1,134 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.idea/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# training data +data/* +checkpoints/* diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/self-interferometry.iml b/.idea/self-interferometry.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/self-interferometry.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6d8a0f8 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# mm-wave Lab Physics Models + +This is our repository of shared code for calculations of +interest to mm-wave Lab. + +For a minimal working example of the format and function we are going for, +please see the "/models/gatefidelity.py", "/plotters/plot_gatefidelity.py", +and "/notebooks/GateErrors.ipynb" collection. + +## Introduction +The idea is that all calculation-heavy code will be placed in the /models +directory. These are calculations that everyone will use; therefore, the +source code should be re-used and scrutinized often to check for factors of +$2\pi$, sign errors, etc. Use these models for larger calculations and plots, +and everyone will understand where the underlying code came from, there will +be fewer silly mistakes, and hence shorter discussions and meetings! + +If you make a very complex plot, or multiple plots for the same model, you +should write a Python file that contains your plotting functions and +avoid cluttered Jupyter notebooks. These files should be named with the +prefix "plot_X.py" and placed in the /plotters directory. + +Finally, your stunning Jupyter notebook can go in the /notebooks +directory. The notebook should call functions and classes that are +implemented either in /plotters or in /models to benefit from the shared +(error-checked) code base. These notebooks can be individualized to +your specific use case, but they should still be synced to the Github repo. + +You can edit the Python code in the repo and your Jupyter notebook +simultaneously. Restart your Jupyter kernel to reload any Python code you +edit in your Python IDE. + +## Contributing +Whenever you want to edit or add to the repo, checkout a new Git branch. + +Make your edits, making commits and pushing code to your branch as +you go. + +Create a pull request for your branch. One colleague needs to review and +approve your code before you can merge your branch. Consider using the +automated PyLinter to edit your code to match the PEP8 style guide. + +Once your code is approved, merge commit the branch and then delete it. + +Repeat as necessary. diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..c27e2b8 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[pycodestyle] +max-line-length = 120 + +[pydocstyle] +ignore = D100, D101, D102, D107 \ No newline at end of file diff --git a/tests/test_example.py b/tests/test_example.py new file mode 100644 index 0000000..2afc1c7 --- /dev/null +++ b/tests/test_example.py @@ -0,0 +1,10 @@ +import unittest + + +class MyTestCase(unittest.TestCase): + def test_something(self): + self.assertEqual(True, False) # add assertion here + + +if __name__ == '__main__': + unittest.main()