I need to draw circuits and diagrams! Orestes Mas - - PowerPoint PPT Presentation

i need to draw circuits and diagrams
SMART_READER_LITE
LIVE PREVIEW

I need to draw circuits and diagrams! Orestes Mas - - PowerPoint PPT Presentation

Quality diagrams with PyCirkuit Orestes Mas (orestes@tsc.upc.edu) Polytechnic University of Catalonia 2nd February 2020 , FOSDEM 20 Quality diagrams with PyCirkuit Orestes Mas (orestes@tsc.upc.edu) Polytechnic University of Catalonia 2nd


slide-1
SLIDE 1

Quality diagrams with PyCirkuit

Orestes Mas (orestes@tsc.upc.edu)

Polytechnic University of Catalonia

2nd February 2020

FOSDEM 20

,

slide-2
SLIDE 2

Quality diagrams with PyCirkuit

Orestes Mas (orestes@tsc.upc.edu)

Polytechnic University of Catalonia

2nd February 2020

FOSDEM 20

,

slide-3
SLIDE 3

FOSDEM 20

,

The problem

I need to draw circuits and diagrams!

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-4
SLIDE 4

FOSDEM 20

,

The problem

I need to draw circuits and diagrams!

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-5
SLIDE 5

FOSDEM 20

,

The problem

I need to draw circuits and diagrams!

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-6
SLIDE 6

FOSDEM 20

,

The problem

I need to draw circuits and diagrams!

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-7
SLIDE 7

FOSDEM 20

,

Why PyCirkuit?

Requirements we have

▶ Beautiful (publishing quality) ▶ Large library of predefined symbols ▶ Uniform style (don’t mix libraries) ▶ Parametrizable symbols ▶ Consistent typography: 𝑆𝑐, 𝑤𝛿, 𝑗2, 𝛾𝑗𝑐 ▶ Free formats, tools and systems 𝑆𝑓 𝛾𝑗𝑐 − 𝑤𝑦 + 𝑆𝑑

− +

𝑤𝛿 𝑆𝑐 𝑗𝑐 + 𝑊𝑑𝑑 𝑗1 𝑗2

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-8
SLIDE 8

FOSDEM 20

,

Why PyCirkuit?

Requirements we have

▶ Beautiful (publishing quality) ▶ Large library of predefined symbols ▶ Uniform style (don’t mix libraries) ▶ Parametrizable symbols ▶ Consistent typography: 𝑆𝑐, 𝑤𝛿, 𝑗2, 𝛾𝑗𝑐 ▶ Free formats, tools and systems 𝑆𝑓 𝛾𝑗𝑐 − 𝑤𝑦 + 𝑆𝑑

− +

𝑤𝛿 𝑆𝑐 𝑗𝑐 + 𝑊𝑑𝑑 𝑗1 𝑗2

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-9
SLIDE 9

FOSDEM 20

,

Chosen solution

Insert graphic commands into a L

A

T EX document

\begin{tikzpicture} \draw[step=0.25,color=blue!20,very thin] (-1.8,-1.6) grid (1.8,1.6); \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}$}; } \end{tikzpicture}

𝑓𝑘0∘ 𝑓𝑘30∘ 𝑓𝑘60∘ 𝑓𝑘90∘ 𝑓𝑘120∘ 𝑓𝑘150∘ 𝑓𝑘180∘ 𝑓𝑘210∘ 𝑓𝑘240∘ 𝑓𝑘270∘ 𝑓𝑘300∘ 𝑓𝑘330∘

L

A

T EX+ TikZ !

Perfect text/graphics integration. Programmability & flexibility Mathematical formulae pose no problems Good circuit library (circuitikz) Vector graphics

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-10
SLIDE 10

FOSDEM 20

,

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!

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-11
SLIDE 11

FOSDEM 20

,

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

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-12
SLIDE 12

FOSDEM 20

,

PyCirkuit - How it works

Phase 1: The «Circuit Macros»

source file m4 .pic file Circuit macros

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-13
SLIDE 13

FOSDEM 20

,

PyCirkuit - How it works

Phase 2: The Dpic .pic file dpic PGF-TikZ PSTricks PostScript+psfrag MetaPost mfpic eepicemu L

A

T EX «picture» xfig SVG PostScript PDF Generic L

A

T EX

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-14
SLIDE 14

FOSDEM 20

,

The PyCirkuit

Phase 3: Visualisation

source file m4 Circuit Macros .pic dpic .tikz pdfL

AT

EX Template .pdf pdfuoppm .png

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-15
SLIDE 15

FOSDEM 20

,

The PyCirkuit

Phase 4: Exporting and Extra bonus

source file m4 Circuit Macros .pic dpic .svg .tikz pdfL

AT

EX Template .pdf pdfuoppm .png .jpg

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-16
SLIDE 16

FOSDEM 20

,

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.

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-17
SLIDE 17

Demonstrations

slide-18
SLIDE 18

FOSDEM 20

,

Demo

Graphical User Interface

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-19
SLIDE 19

FOSDEM 20

,

Demo

Command-Line Interface

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-20
SLIDE 20

FOSDEM 20

,

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!)

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-21
SLIDE 21

FOSDEM 20

,

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/

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-22
SLIDE 22

FOSDEM 20

,

Acknowledgements

▶ Donald Knuth & Leslie Lamport: For giving us T EX and L

AT

EX ▶ 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 sofuware community for the contributions to these projects!

Orestes Mas (orestes@tsc.upc.edu) - UPC Quality diagrams with PyCirkuit 2nd February 2020

slide-23
SLIDE 23

Thank you!