More datagen classes#106
Merged
marcosfrenkel merged 12 commits intotoolsforexperiments:mainfrom May 4, 2026
Merged
Conversation
…ract model() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ial, sine, and gaussian class implementations
… are now static methods. Parameters can be set at instantiation or overridden in generate().
… class model() signatures
… into more-datagen-classes
… classes. changed naming style to exclude 'DataGen'
marcosfrenkel
requested changes
Apr 9, 2026
|
|
||
| @staticmethod | ||
| def model(coordinates: NDArray[Any], pi_amp: float) -> NDArray[Any]: | ||
| val = np.cos(2 * np.pi * coordinates / (2 * pi_amp)) + 2 |
Contributor
There was a problem hiding this comment.
Make the offset a parameter instead of hard coding it. Add amplitude as well
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)) |
Contributor
There was a problem hiding this comment.
Move it back to res_spec since this is not generic
…ied: only real noise is applied to functions that just have real components.
marcosfrenkel
requested changes
Apr 15, 2026
Contributor
marcosfrenkel
left a comment
There was a problem hiding this comment.
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 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 |
Contributor
There was a problem hiding this comment.
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
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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