Quality Diagrams with Pycirkuit
Total Page:16
File Type:pdf, Size:1020Kb
, FOSDEM 20 Quality diagrams with PyCirkuit Orestes Mas ([email protected]) Polytechnic University of Catalonia 2nd February 2020 , FOSDEM 20 Quality diagrams with PyCirkuit Orestes Mas ([email protected]) Polytechnic University of Catalonia 2nd February 2020 The problem I need to draw circuits and diagrams! , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 The problem I need to draw circuits and diagrams! , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 The problem I need to draw circuits and diagrams! , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 The problem I need to draw circuits and diagrams! , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 Why PyCirkuit? Requirements we have ▶ Beautiful (publishing quality) ▶ Large library of predefined 푅 푅 symbols 푏 푐 푖푏 푖1 푖2 ▶ Uniform style (don’t mix libraries) + + 푣 + 훾 − 푣푥 훽푖푏 푉푐푐 − ▶ Parametrizable symbols ▶ Consistent typography: 푅푒 푅푏, 푣훾, 푖2, 훽푖푏 ▶ Free formats, tools and systems , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 Why PyCirkuit? Requirements we have ▶ Beautiful (publishing quality) ▶ Large library of predefined 푅 푅 symbols 푏 푐 푖푏 푖1 푖2 ▶ Uniform style (don’t mix libraries) + + 푣 + 훾 푣푥 훽푖 푉푐푐 − − 푏 ▶ Parametrizable symbols ▶ Consistent typography: 푅푒 푅푏, 푣훾, 푖2, 훽푖푏 ▶ Free formats, tools and systems , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 Chosen solution Insert graphic commands into a LATEX document \begin{tikzpicture} \draw[step=0.25,color=blue!20,very thin] LAT X+ TikZ! (-1.8,-1.6) grid (1.8,1.6); E \foreach \ang in {0,30,...,330}{ \draw[color=red] (0,0) to[R, -*] (\ang:1.1); \node at (\ang:1.35) {\tiny$e^{j\ang^\circ}$}; � Perfect text/graphics integration. } \end{tikzpicture} � Programmability & flexibility 푗90∘ � Mathematical formulae pose no ∘ 푒 ∘ 푒푗120 푒푗60 problems ∘ ∘ 푒푗150 푒푗30 ∘ ∘ � Good circuit library (circuitikz) 푒푗180 푒푗0 ∘ ∘ 푒푗210 푒푗330 � Vector graphics 푗240∘ 푗300∘ 푒 ∘ 푒 푒푗270 , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 The end of the tunnel? Not yet... CircuiTikZ seemed the right tool, but... ▶ Too much use of absolute coordinates to position elements ▶ Aesthetical issues Circuit Macros! , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 What is PyCirkuit? In short: ▶ A program to help drawing those circuits ▶ Written in Python 3 + PyQt5 ▶ 2 modes of operation: ▶ GUI ▶ CLI / Batch mode , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 PyCirkuit - How it works Phase 1: The «Circuit Macros» Circuit macros source .pic m4 file file , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 PyCirkuit - How it works Phase 2: The Dpic PGF-TikZ PSTricks PostScript+psfrag MetaPost LATEX mfpic .pic dpic eepicemu file LATEX «picture» xfig SVG Generic PostScript PDF , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 The PyCirkuit Phase 3: Visualisation Circuit Template Macros .pic .pdf source A .png file m4 dpic .tikz pdfLTEX pdftoppm , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 The PyCirkuit Phase 4: Exporting and Extra bonus Circuit Macros Template .svg .pic source .png file m4 dpic .pdf .tikz pdfLATEX pdftoppm .jpg , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 PyCirkuit Installation ▶ On Debian Testing (Bullseye) is straightforward: apt-get install pycirkuit ▶ From PyPI (recommended for MacOs/Windows) pip install pycirkuit ▶ From GitHub pip install git+https://github.com/orestesmas/pycirkuit.git Outside Debian you must install some PyCirkuit dependencies by hand. See README file on GitHub project page. , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 Demonstrations Demo Graphical User Interface , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 Demo Command-Line Interface , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 Future work What’s planned? Primary goals ▶ Documentation and code cleaning ▶ Supporting/improving other input and output formats ▶ Improve the editor Secondary goals ▶ Allow simultaneous drawings on GUI ▶ Configurable workflows. Plugin-based architecture? ▶ Become a KDE project? (KDE - Python bindings!) , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 Relevant links Main ▶ GitHub repo: https://github.com/orestesmas/pycirkuit ▶ PyPI repo: https://pypi.org/project/pycirkuit/ Other ▶ PIC language: http://plan9.bell-labs.com/10thEdMan/pic.pdf ▶ PIC tutorial: http://floppsie.comp.glam.ac.uk/Glamorgan/gaius/web/pic.html ▶ Dpic site: https://ece.uwaterloo.ca/~aplevich/dpic/ ▶ Circuit Macros: https://ece.uwaterloo.ca/~aplevich/Circuit_macros/ , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 Acknowledgements ▶ Donald Knuth & Leslie Lamport: For giving us TEX and LATEX ▶ Till Tantau: Author of TikZ (and Beamer too) ▶ Dwight Aplevich: Circuit Macros and Dpic author ▶ Matteo Agostinelli: “cirkuit” application ▶ Aniol Marti & Àlex Muntada: Debian packages for dpic, circuit-macros and pycirkuit ▶ ...and the free software community for the contributions to these projects! , FOSDEM 20 Orestes Mas ([email protected]) - UPC Quality diagrams with PyCirkuit 2nd February 2020 Thank you!.