Skip to content

44 state aliasing - #5

Merged
jayvanderwall-snl merged 12 commits into
mainfrom
44_state_aliasing
Jul 29, 2026
Merged

44 state aliasing#5
jayvanderwall-snl merged 12 commits into
mainfrom
44_state_aliasing

Conversation

@EthanMcGarrigle-SNL

Copy link
Copy Markdown
Collaborator

Added functionality to create alternative names or "aliases" for energy levels and energy eigenstates in IonSim. This is a quality-of-life update meant to improve readability of basis states and levels in the context of quantum information or other applications. For example, we can alias a level in Yb171+ with name "S1/2, 0, 0" with an alias "0" or "down" or "1" for "S1/2, 1, 0". For the example of a 2-qubit basis, the state "S1/2, 0, 0 ; S1/2, 1, 0" would be aliased to "01". This is a nice feature when dealing with intermediate states or Rydberg states, which can be abbreviated to common symbols like "e" for excited or "r" for Rydberg.
Summary of changes:

Added functionality for the AtomicSpin and MotionalMode constructors to accept a list of aliases by the user.
Atomic internal energy levels and Fock energy levels now have an optional alias attribute.
The user can specify a "join rule" to customize how basis states (in the basis of energy eigenstates) will join aliases from each degree of freedom together. e.g. A user can choose the alias to be "01" or "0,1" or "0;1" for the 2-qubit basis state "S1/2, 0, 0 ; S1/2, 1, 0" in Yb171+.

Added tests to test_basis.py to ensure correct functionality and integration into automated testing.

@EthanMcGarrigle-SNL
EthanMcGarrigle-SNL requested review from jayvanderwall-snl and removed request for brandonruzic July 29, 2026 16:10

@jayvanderwall-snl jayvanderwall-snl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like the alias attribute is missing from the LSFineLevel class despite being in the rest of the subclasses of AtomicInternalEnergyLevel. But it seems like this was an intentional choice, otherwise you could have put it in AtomicInternalEnergyLevel itself. What is going on there?

Comment thread src/ionsim/degree_of_freedom.py Outdated
Co-authored-by: jayvanderwall-snl <89104236+jayvanderwall-snl@users.noreply.github.com>
@EthanMcGarrigle-SNL

EthanMcGarrigle-SNL commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

It looks like the alias attribute is missing from the LSFineLevel class despite being in the rest of the subclasses of AtomicInternalEnergyLevel. But it seems like this was an intentional choice, otherwise you could have put it in AtomicInternalEnergyLevel itself. What is going on there?

The intention is for every level class to have an alias attribute. I'm seeing the alias attribute on my end in LSFineLevel, here's a screenshot:

LSFineLevel_44

I'm not sure why this isn't showing up on your end.

Also, I would have made alias an attribute in the AtomicInternalEnergyLevel parent class, but I think alias needs to be None by default since it's optional and python doesn't like having a default attribute before non-default attributes.

@jayvanderwall-snl

Copy link
Copy Markdown
Collaborator

The issue was me not being able to read good, but I did fix the ordering issue by making alias keyword only in the initializer (which is probably what we really want anyway). If you don't like the commit I'll revert it but it was easier to do it than mark up all the individual lines.

@EthanMcGarrigle-SNL

Copy link
Copy Markdown
Collaborator Author

The issue was me not being able to read good, but I did fix the ordering issue by making alias keyword only in the initializer (which is probably what we really want anyway). If you don't like the commit I'll revert it but it was easier to do it than mark up all the individual lines.

I don't see the commit in the history, but if it passes the tests and aligns with the intention, then feel free to push the commit. Is there a way for me to see this commit before pushing? It's okay if not

@jayvanderwall-snl

Copy link
Copy Markdown
Collaborator

The issue was me not being able to read good, but I did fix the ordering issue by making alias keyword only in the initializer (which is probably what we really want anyway). If you don't like the commit I'll revert it but it was easier to do it than mark up all the individual lines.

I don't see the commit in the history, but if it passes the tests and aligns with the intention, then feel free to push the commit. Is there a way for me to see this commit before pushing? It's okay if not

Sorry it seems I'm not as sharp this morning as I'd like.

The way we've done this in other cases is make another branch that you can see and possibly merge in. I'll do that going forward.

@EthanMcGarrigle-SNL

Copy link
Copy Markdown
Collaborator Author

The issue was me not being able to read good, but I did fix the ordering issue by making alias keyword only in the initializer (which is probably what we really want anyway). If you don't like the commit I'll revert it but it was easier to do it than mark up all the individual lines.

I don't see the commit in the history, but if it passes the tests and aligns with the intention, then feel free to push the commit. Is there a way for me to see this commit before pushing? It's okay if not

Sorry it seems I'm not as sharp this morning as I'd like.

The way we've done this in other cases is make another branch that you can see and possibly merge in. I'll do that going forward.

Sounds good - thank you for making this change! Feel free to proceed with the merge, or I can do so.

@jayvanderwall-snl
jayvanderwall-snl merged commit 51d7f6c into main Jul 29, 2026
1 check 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