Skip to content

Commit

Permalink
Merge pull request #93 from qua-platform/fix/quam-root-referencing
Browse files Browse the repository at this point in the history
Fix: Referencing issues in Quam Root
  • Loading branch information
nulinspiratie authored Dec 12, 2024
2 parents 31dff5d + 7c30b2a commit 963a2ad
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
### Changed
- `Pulse.integration_weights` now defaults to `#./default_integration_weights`, which returns [(1, pulse.length)]

### Fixed
- Fixed issues with parameters being references in a QuamRoot object


## [0.3.8]
### Added
Expand Down
3 changes: 0 additions & 3 deletions quam/core/quam_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,6 @@ def generate_config(self) -> Dict[str, Any]:

return qua_config

# def get_unreferenced_value(self, attr: str):
# return getattr(self, attr)


class QuamComponent(QuamBase):
"""Base class for any QuAM component class.
Expand Down
32 changes: 32 additions & 0 deletions tests/quam_base/referencing/test_quam_root_referencing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from quam import QuamRoot, QuamComponent, quam_dataclass
import warnings


@quam_dataclass
class Component(QuamComponent):
y: int = 2


@quam_dataclass
class Root(QuamRoot):
a: Component
b: Component = "#/a"


def test_quam_root_reference():
with warnings.catch_warnings():
warnings.simplefilter("error")
root = Root(a=Component())
assert root.a is root.b


def test_quam_root_reference_to_dict():
with warnings.catch_warnings():
warnings.simplefilter("error")
root = Root(a="#/b", b=Component())
d = root.to_dict()
assert d == {
"a": "#/b",
"b": {},
"__class__": "test_quam_root_referencing.Root",
}
File renamed without changes.

0 comments on commit 963a2ad

Please sign in to comment.