-
Notifications
You must be signed in to change notification settings - Fork 66
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
Incorporate automatic layout generation in Register
#753
Conversation
98b7d92
to
1d8c88a
Compare
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Register
Register
min_traps, | ||
) | ||
if max_traps: | ||
target_traps = min(target_traps, max_traps) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it also possible that min_traps be bigger than max_traps ? Shouldn't we also have
min_traps = min(min_traps, max_traps)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When they come from Device
it's not possible; min_traps > max_traps
has no solution, after all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not supposed to be user-facing so I'll just add some asserts for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I think there was a little misunderstanding. I meant that if N_seeds is extremely big, you might have the new min_traps higher than max_traps after the np.ceil, so I guess it would be good to have
target_traps = min(target_traps, max_traps) | |
target_traps = min(target_traps, max_traps) | |
min_traps = min(min_traps, max_traps) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean but if you do this, the program will successfully terminate when it reach max_traps
, which will be lower than what you need (min_traps
before your new line). We don't want this to happen because it won't respect the max_layout_filling
.
What I'll do instead is always check at the end that len(traps) >= min_traps
and raise the RuntimeError
otherwise.
**Main changes**: - Add layout restricting parameters to BaseDevice (#751) - Incorporate automatic layout generation in Register (#753) **Fixes**: - Fix rounding error in RampWaveform (#747) - Fix normalisation in ring of atoms (#750) - Improve the NoiseModel unused parameters warning message (#752)
Register.with_automatic_layout(device: Device)
, which allows the user to get an automatically generated layout that obeys thedevice
constrains from any registerCloses #748 .