pasqal-io / Pulser

Library for pulse-level/analog control of neutral atom devices. Emulator with QuTiP.
Apache License 2.0
159 stars 57 forks source link

Rectangular lattice register and layout #665

Closed soufianekaghad98 closed 2 months ago

soufianekaghad98 commented 3 months ago

Addition of classes to the special layouts : RectangularLatticeLayout to be able to play with x and y spacing. Now SquareLatticeLayout inherits from it. Don't know how to deal with the print change, we can keep rectangular for a square. (one test fails that compares the strings) TriangularLatticeLayoutRectShape to have triangular lattice in a rectangular layout RandomLayout that generates a random layout for a given number of traps (limited number of iterations)

mypy failed because of no type defintion of an empty list in RandomLayout.

HGSilveri commented 3 months ago

Hi @soufianekaghad98 , thank you for your contribution! I have a few preliminary comments and questions:

  1. I agree with the addition of RectangularLatticeLayout but I'm not sure about the others.
  2. In your opinion, what is the advantage of having a triangular lattice in a rectangular shape? Note that you can still define rectangular-shaped registers in the standard triangular lattice
  3. RandomLayout is problematic because layouts rely on reproducibility, meaning that the same call should yield identical results. This will naturally not be the case for a random layout. Would it be so bad for the user to randomly generate the set of coordinates given to RegisterLayout instead?
soufianekaghad98 commented 3 months ago

Hi @HGSilveri, thanks for your feedback! To give you some context, I am currently working on the equalization of the traps. So my goal is to generate a whole bunch of different layouts and test them to see how well we can get equalized traps. This is why I want to use special_layouts which gives different kinds of patterns ready to use, and triangular lattice in rectangular shape is one among the easy layouts to try. I agree that in the end for a whole sequence it will suffice to just have the rectangular register, but for now I'm only working with layouts). I feel like RandomLayout could be useful for other people who like me need to generate a lot of random layouts with given constraints (mostly for benchmarking and testing). Maybe it could be placed somewhere else then?

HGSilveri commented 3 months ago

This is why I want to use special_layouts which gives different kinds of patterns ready to use, and triangular lattice in rectangular shape is one among the easy layouts to try. I agree that in the end for a whole sequence it will suffice to just have the rectangular register, but for now I'm only working with layouts). I feel like RandomLayout could be useful for other people who like me need to generate a lot of random layouts with given constraints (mostly for benchmarking and testing). Maybe it could be placed somewhere else then?

Yes, I think RandomLayout should be placed at a higher-level package (which could be wherever you are using Pulser). TriangularLatticeRectShape could be included here but since you are already defining RandomLayout somewhere else, maybe it could go there as well? I'm not strongly opposed to the inclusion of TriangularLatticeRectShape, I just think its utility will be very limited and it can easily end up being something we support but nobody uses after a while.

review-notebook-app[bot] commented 2 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

soufianekaghad98 commented 2 months ago

Feels like I messed up when trying to push again (apparently there was some issue with my local branch not being up to date with the remote... I tried different commands to pull then push which ended with me pushing stuff I didn't know about...). Sorry for the mess.

HGSilveri commented 2 months ago

Feels like I messed up when trying to push again (apparently there was some issue with my local branch not being up to date with the remote... I tried different commands to pull then push which ended with me pushing stuff I didn't know about...). Sorry for the mess.

No worries, it's nothing we can't fix. I'll give you a hand when I can