Skip to content

Commit

Permalink
feat: Extract results from qblox acqusitions structure
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Jan 24, 2025
1 parent 20ea994 commit 15cafdc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/qibolab/_core/instruments/qblox/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from operator import or_
from typing import Optional, TypedDict

import numpy as np
from qblox_instruments.qcodes_drivers.module import Module

from qibolab._core.identifier import ChannelId, Result
Expand Down Expand Up @@ -82,8 +83,17 @@ class IndexedData(TypedDict):
AcquiredData = dict[acquisition.MeasureId, IndexedData]


def _extract(data: Integration, length: int) -> Result:
res = np.array([data["path0"], data["path1"]])
return np.moveaxis(res, 0, -1) / length


def extract(
acquisitions: dict[ChannelId, AcquiredData],
lenghts: dict[acquisition.MeasureId, int],
lengths: dict[acquisition.MeasureId, int],
) -> dict[PulseId, Result]:
return {}
return {
int(acq): _extract(idata["acquisition"]["bins"]["integration"], lengths[acq])
for data in acquisitions.values()
for acq, idata in data.items()
}

0 comments on commit 15cafdc

Please sign in to comment.