q-optimize / c3

Toolset for control, calibration and characterization of physical systems
https://c3-toolset.readthedocs.io/
Apache License 2.0
66 stars 36 forks source link

Ideal gate assignment missing in Instruction class constructor #229

Closed YonatanGideoni closed 2 years ago

YonatanGideoni commented 2 years ago

Bug description

The Instruction class gets the ideal gate as a parameter but does not use it.

To Reproduce

import numpy as np
from c3.signal.gates import Instruction
ideal = np.array([[0., 1.], [1., 0.]])
instr = Instruction(ideal=ideal)

print(instr.get_ideal_gate(dims=[3]))

Expected behavior

Expected output:

[[0.+0.j 1.+0.j]
 [1.+0.j 0.+0.j]]

Real output:

[[1.+0.j 1.+0.j]
 [1.+0.j 1.+0.j]]

Environment

Additional context

Solution - add self.set_ideal(ideal) at the end of the Instruction constructor. Will do this and open a pull request.