Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dihm
Copy link
Contributor

@dihm dihm commented Aug 21, 2025

Fixing a number of outstanding issues with Cell, revealed by trying to fix issues revealed by #37.

Improves unit testing around the revealed issues, ensure Cell actually adds transit broadening, and improves minor aspects for typing and caching of eta, kappa, and probe_freq properties.

Fixes #37

dihm added 5 commits August 21, 2025 11:47
…oadening is applied

when provided by the constructor.
This improves typing a fair bit, and technically improves performance slightly.
…to actually work.

Also adds some better type hinting.
@dihm dihm requested a review from benjamin-n-miller August 21, 2025 21:06
@dihm dihm self-assigned this Aug 21, 2025
@dihm dihm added the bug Something isn't working label Aug 21, 2025
…nifolds,

'all' with single states, and 'all' with manifolds.
@dihm
Copy link
Contributor Author

dihm commented Aug 21, 2025

Note that above fixes alter a bunch of docstring outputs, presumably to be more accurate. They will need updating, along with the changelog.

@benjamin-n-miller
Copy link
Collaborator

I am starting to go through this, should i try to get the failing tests cleaned up?

I will need to get the public repo set up on my computer to get this all fixed properly, so i might have to open a pr to this pr

@dihm
Copy link
Contributor Author

dihm commented Aug 22, 2025

If you can get that done, that would be superb. A solid review of the changes are also in order. And One of us will need to make another PR to update the example notebook.

@dihm
Copy link
Contributor Author

dihm commented Aug 22, 2025

@benjamin-n-miller Had a few minutes to tweak up the doctests. A solid review of the PR is in order to make sure I'm not introducing new bugs, doctest updates are actually right, and the unit tests I added are robust/correct.

@benjamin-n-miller
Copy link
Collaborator

I will do this before i wrap up today

Copy link
Collaborator

@benjamin-n-miller benjamin-n-miller left a comment

Choose a reason for hiding this comment

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

I have some comments, but most of them are just commenting on stuff. Overall everything lgtm, im happy with the implementation and new tests

>>> c.add_coupling(states=(g,e), rabi_frequency=np.linspace(1e-6, 1, 5), detuning=1, label="probe")
>>> snr, mesh = rq.get_snr(c, 'probe_rabi_frequency')
>>> print(snr)
[ 0. 13947396.7 27887614.4 41813486.6
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this just because the previous results were calculated incorrectly?

Copy link
Contributor Author

@dihm dihm Aug 23, 2025

Choose a reason for hiding this comment

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

Prior results did not include any transit broadening. I suppose an alternative fix would have been to set gamma_transit=0 in these tests.

self._add_state_lifetimes()
self._add_decoherence_rates()
self._add_gamma_mismatches(gamma_mismatch)
self.add_transit_broadening(gamma_transit)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did I actually just ignore the transit broadening previously? Or am I not remembering that it worked differently before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to go back and check. V1 rydiqule called this function. Apparently we dropped it when re-working self._add_decoherence_rates and self._add_gamma_mismatches. Oops.


@property
def kappa(self):
def kappa(self) -> float:
Copy link
Collaborator

Choose a reason for hiding this comment

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

There were a lot more missing type hints than I realized

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may have been intentional. I vaguely remember the type checker complaining about type overloads from Sensor. That has stopped, so I put them in.

degeneracy = len(self.states_with_spec(ground_manifold))

self.add_decoherence((state, ground_manifold), gamma=(lifetime-transition_total), label="mismatch")
self.add_decoherence((state, ground_manifold), gamma=(lifetime-transition_total)/degeneracy, label="mismatch")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was so sure that I considered this when I first implemented this for the first time, and I am wondering if maybe the rework of coupling-coefficents in cell changed something here in a way we didn't notice? Idk all my comments are sort of just editorializing at this point.

@dihm dihm merged commit 00cba9d into main Aug 23, 2025
5 checks passed
@dihm dihm deleted the cell_fixes branch August 23, 2025 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RF heterodyne example issue

3 participants