refactoring emulator results.py file - #1412
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1412 +/- ##
==========================================
+ Coverage 37.36% 37.54% +0.18%
==========================================
Files 114 114
Lines 5736 5755 +19
==========================================
+ Hits 2143 2161 +18
- Misses 3593 3594 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @alecandido, am I wrong or this np.stack(np.unravel_index(meas, hamiltonian.dims))[i]and we can simply write: np.unravel_index(meas, hamiltonian.dims)[i] |
|
Yes, it looks irrelevant: import numpy as np
a = tuple(np.arange(i*100, i*100 + 10) for i in range(10, 20))
np.stack(a)[3] == a [3](for higher dimensions, just |
dc7fd25 to
da18ccf
Compare
alecandido
left a comment
There was a problem hiding this comment.
Just reading it, it seems alright. If you also tested and are reasonably confident with the results, we could merge.
I only left few marginal comments.
| if options.averaging_mode is AveragingMode.SINGLESHOT and options.nshots is None: | ||
| raise ValueError("nshots must be specified for SINGLESHOT mode") |
There was a problem hiding this comment.
Actually, since this only depends on the function inputs, better to place it as soon as possible in the function (instead of performing first some computation, to then fail anyhow).
| # Through the entire function state_probs has dimensions: | ||
| # (*S, M *H_dim), where | ||
| # *S is the number of iteration for each sweep in the experiment | ||
| # M is the number of measurements applied in the pulse sequence | ||
| # *H_dim is the complete system dimension |
There was a problem hiding this comment.
As suggested before, move this explanation in the module-level docstring. And then just comment locally using the defined symbols
62f6081 to
7473480
Compare
…e selected; clipping singleshot from 0 to 1
…id-circuits measurement simulations
Co-authored-by: Stefano Carrazza <scarrazza@users.noreply.github.com>
Co-authored-by: Stefano Carrazza <scarrazza@users.noreply.github.com>
Co-authored-by: Alessandro Candido <candido.ale@gmail.com>
In this small PR we simply anticipate the
results.pymodification that were first introduced in PR #1401.Checklist: