Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Referencing issues in Quam Root #93

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading