Open alecandido opened 21 hours ago
@ElStabilini since you already hit the problem yourself, you may consider this (only after your current commitments), as a technical contribution. It is not physics-related, but it may help you familiarize more with the library (and the NumPy API itself), while giving a help to simplify Qibocal itself, which is invaluable (assuming it's possible...).
Most of the routines (especially sweeper-based ones) are handling acquired data by collecting them in arrays with structured data types, which are then dumped to disk.
This is often critical in two respects:
While 1. is also relevant, it may be explored by a different issue, as it is less technical, and more related to the individual protocol's structure.
Instead, I suspect that the second point is also related to a poor usage of the NumPy API for record arrays creation (which is fully wrapped by the
np.rec.array
constructor). In particular:np.rec.fromarrays
(that can also be invoked through the commonnp.rec.array
interface), which may alleviate or eliminate the need for something likeData.register_qubit
np.load
is used, which requires to be wrapped in something likeAbstractData.load_data
, while, since the expected data type is always known by the routine (or just the related data structure), it should be sufficient to specify it as thedtype=
argument innp.rec.fromfile
(also accessible through thenp.rec.array
interface)In general, we may reduce the custom handling of data by Qibocal, replacing it with more idiomatic usage of the NumPy API, possibly leading to a more vectorized treatment of data (fewer Python
for
loops), consequently reducing nesting (as functions, likeData
/AbstractData
methods, and blocks, i.e. the mentioned Pythonfor
loops).