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

Replace Register.rotate() with Register.rotated() #639

Merged
merged 2 commits into from
Feb 5, 2024

Conversation

HGSilveri
Copy link
Collaborator

  • Introduces Register.rotated(), which returns a new instance instead of rotating in place
  • Deprecates Register.rotate()

Closes #628 .

@HGSilveri HGSilveri requested a review from a-corni February 1, 2024 14:57
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

if self.layout is not None:
warnings.warn(
"The rotated register won't have an associated "
"'RegisterLayout'.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps specify the category ? It's a Userwarning by default and it might never change

Copy link
Collaborator

Choose a reason for hiding this comment

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

I also feel like there is a way to define the rotation for both layout and register, by defining a method get_rotated_coords(self, angle) in CoordsCollection (that would only work for 2D coords/rotate around phi=0 in 3D). But I guess it's not very interesting to rotate a register layout since it is obtained from calibration ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I doubt warnings.warn() will ever change the default warning category in Python 3.x, but I can still specify it.
As you suggested, register layouts should give a notion of being static so having an easy option to rotate them is not something we want to be giving the user imo

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes let's go with this PR !

@HGSilveri HGSilveri merged commit a8d17f2 into develop Feb 5, 2024
7 checks passed
HGSilveri added a commit that referenced this pull request Feb 6, 2024
* Bump to version 0.17dev0

* Refactoring `QutipEmulator` class (#602)

* Adding Hamiltonian class

* fixing type

* Modifying docstring

* Simplifying refactoring

* Simplifying refactoring

* Fix test, simplify attributes in QutipEmulator

* Restore _eval_times_instruction, def device in ham

* delete get_attr

* using NoiseModel for config in Hamiltonian

* Fixing doc, tests

* Move build_operator, add_config to simulation

* Fix typing

* Bump to v0.17dev1

* Clarify confusion between kraus operators and collapse operators (#616)

* Bump version to v0.17dev0

* Delete L0, refactor error message

* Delete identity condition, 2nd order approximation

* Fixing tests

* Fixing test + doc

* Create rate attr, deprecate prob attr

* Replace prob by rate, err if def of rate and prob

* Fixing type

* Use dataclasses.fields, run effective noise notebook

* Illustrate rate > 1 in notebook

* Modifying cell count

* Support standalone serialization of `Register` and `RegisterLayout` to the abstract representation + Hashing for coordinate collections (#627)

* Implement CoordsCollection superclass to share hash with Register

* Incorporating register and layout schemas

* Add serialization and deserialization for layout and register

* Add new JSON schemas to the MANIFEST

* Add extra UTs

* Cover both jsonschema versions in CI

* Fix legacy jsonschema validation

* Test for legacy jsonschema more efficiently

* Addressing review comments

* FIX: Coordinate matching in `WeightMap.get_qubit_weight_map()` (#631)

* Bump version to 0.17dev2

* Explicitly define public symbols for all modules  (#630)

* Fix pyright import errors

* WIP: Attempt to use __all__

* Exposing the appropriate symbols throughout the codebase

* Fix typo

* Expose relevant submodules

* Expose layout classes in pulser.register

* [FIX] Restore compatibility with pytest 8.0.0 (#637)

* Unrestrict scipy<1.12  (#635)

* Bump version to v0.17dev0

* Remove restriction scipy<1.12

* Clip qutip to 4.7.5

* Replace `Register.rotate()` with `Register.rotated()` (#639)

* Modify deprecation of total_bottom_detuning to v0.18 (#638)

* Reduce imports on main tutorials (#636)

* Bump version to 0.17.0

---------

Co-authored-by: a_corni <antoine.cornillot@pasqal.com>
Co-authored-by: Antoine Cornillot <61453516+a-corni@users.noreply.github.com>
@HGSilveri HGSilveri deleted the hs/deprecate-rotate branch April 15, 2024 09:51
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.

Deprecate Register.rotate()
2 participants