Skip to content

More datagen classes#106

Merged
marcosfrenkel merged 12 commits intotoolsforexperiments:mainfrom
osn07:more-datagen-classes
May 4, 2026
Merged

More datagen classes#106
marcosfrenkel merged 12 commits intotoolsforexperiments:mainfrom
osn07:more-datagen-classes

Conversation

@osn07
Copy link
Copy Markdown
Contributor

@osn07 osn07 commented Apr 8, 2026

Brought datagen up to codebase standards and included the new classes for protocols in CQEDToolbox. Other pushes before are from before the major changes and thus out of date

Comment thread src/labcore/data/datagen.py Outdated

@staticmethod
def model(coordinates: NDArray[Any], pi_amp: float) -> NDArray[Any]:
val = np.cos(2 * np.pi * coordinates / (2 * pi_amp)) + 2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the offset a parameter instead of hard coding it. Add amplitude as well

Comment thread src/labcore/data/datagen.py Outdated
Comment on lines +160 to +174
@dataclass
class HangerResonator(DataGen):
A: float = 1
Qc: float = 1000
Qi: float = 1000
f0: float = 1e9
phi: float = 0

@staticmethod
def model(
coordinates: NDArray[Any], A: float, Qc: float, Qi: float, f0: float, phi: float
) -> NDArray[Any]:
Q_l = 1.0 / (1.0 / Qc + 1.0 / Qi)
Q_e_complex = Qc * np.exp(-1j * phi)
return A * (1 - (Q_l / Q_e_complex) / (1 + 2j * Q_l * (coordinates - f0) / f0))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move it back to res_spec since this is not generic

…ied: only real noise is applied to functions that just have real components.
Copy link
Copy Markdown
Contributor

@marcosfrenkel marcosfrenkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is currently failing the code quality check. You need to run the formatter ruff format and then run ruff check and ruff format --check and make sure it passes

Comment thread src/labcore/data/datagen.py Outdated
Comment on lines +162 to +172
@dataclass
class PowerRabi(DataGen):
A: float = 1
pi_amp: float = 1
of: float = 0
imaginary: bool = True

@staticmethod
def model(coordinates: NDArray[Any], A: float, pi_amp: float, of: float) -> NDArray[Any]:
val = A * np.cos(2 * np.pi * coordinates / (2 * pi_amp)) + of
return val - 1j * val
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can you not use a Sine or Cosine gen for power rabi? If we cannot use a "generic" function then it should go where it is needed.

@marcosfrenkel marcosfrenkel merged commit d49f956 into toolsforexperiments:main May 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants