qiboteam / qibolab

Quantum hardware module and drivers for Qibo.
https://qibo.science
Apache License 2.0
40 stars 10 forks source link

Drawing sequences #923

Open alecandido opened 1 week ago

alecandido commented 1 week ago

Whenever a sequence is known (i.e. before #917 - and also with that, when it can be compiled), it would be nice to have a schematic representation of it.

The plot itself is already nice (and should be maintained), but some pulses are very short in comparison to others, making them less evident.

A possible way of schematic drawing could be to make it similar to a circuit:

If the bixes' length is fixed, the only thing to determine is the initial position of each one (including delays, treated as phantom boxes). For this, we should make a function that is processing the sequence, and returning these initial positions. The algorithm could inspect the pulses with a queue-like approach:

The fixed amount could depend on the box length (e.g. one quarter of a box) or something like that, or in relation to a proxy for the (yet) unknown channel length (e.g. box length * maximum number of boxes per wire). But in general, the algorithm is approximate to make drawing "nice" (subjective) and meaningful (causal relations are respected, as much as possible). Thus, we could expose some arbitrary choices as parameters of the algorithm.

This information can then be consumed to create a simple diagram with characters or svg (this last one as a standalone graphics, or to be emitted in Jupyter notebooks).