Skip to content

Commit

Permalink
refactor: drop old serialization and hash
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros11 committed Jul 4, 2024
1 parent 765a1a3 commit 4263426
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/qibolab/instruments/qm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ def element(pulse):
return pulse.channel


def float_serial(x):
"""Convert float to string to use in config keys."""
return format(x, ".6f").rstrip("0").rstrip(".")


@dataclass
class QMConfig:
"""Configuration for communicating with the ``QuantumMachinesManager``."""
Expand Down Expand Up @@ -358,18 +353,15 @@ def register_waveform(self, pulse, mode="i"):
return serial

phase = (pulse.relative_phase % (2 * np.pi)) / (2 * np.pi)
amplitude = float_serial(pulse.amplitude)
phase_str = float_serial(phase)
serial = f"{hash(pulse)}_{mode}"
if isinstance(pulse.envelope, Rectangular):
serial = f"constant_wf({amplitude}, {phase_str})"
if serial not in self.waveforms:
if mode == "i":
sample = pulse.amplitude * np.cos(phase)
else:
sample = pulse.amplitude * np.sin(phase)
self.waveforms[serial] = {"type": "constant", "sample": sample}
else:
serial = f"{hash(pulse)}_{mode}"
if serial not in self.waveforms:
samples_i = pulse.i(SAMPLING_RATE)
samples_q = pulse.q(SAMPLING_RATE)
Expand Down

0 comments on commit 4263426

Please sign in to comment.