qiboteam / qibolab

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

Remove native.py #746

Closed stavros11 closed 4 months ago

stavros11 commented 8 months ago

After pulse refactoring is complete:

Indeed, I just found it useful for keeping some constant information about each field here (and also in some other case in #733). It can be replaced by a constant variable, for example

SYMMETRIC_GATES = {"CZ", "iSWAP"}

and then field.metadata["symmetric"] would be just field.name in SYMMETRIC_GATES but I found it a bit more organized to use metadata (actually more in #733 than here).

General comment regarding native.py is that we could probably drop most of it. Particularly NativePulse, NativeSequence, CouplerPulse should be replaced by Pulse/PulseSequence objects once their refactoring is done. As you can probably see, for example here https://github.com/qiboteam/qibolab/blob/33f4519cdf28b9958278a1b80be09ecae16e9350/src/qibolab/native.py#L69

for the most part these are just creating a Pulse with arbitrary start time, so once we remove start from the Pulse they'll automatically become redundant. That's why I don't worry much about them now (they are also not a priority as long as they don't break anything).

Still SingleQubitNatives and TwoQubitNatives will probably be needed for the serialization/deserialization of the runcard and also to provide the interface:

qubit.native_gates.RX -> Pulse
pair.native_gates.CNOT -> PulseSequence

I am not sure if there is a better way to implement them but I would still leave it after the pulse refactor (maybe open issue).

_Originally posted by @stavros11 in https://github.com/qiboteam/qibolab/pull/737#discussion_r1446019587_

alecandido commented 4 months ago

@stavros11 what's the status of this?

stavros11 commented 4 months ago

@stavros11 what's the status of this?

Done in #789 (for 0.2).