-
Notifications
You must be signed in to change notification settings - Fork 4
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
Multimode error analysis! #44
Conversation
|
||
def run( | ||
self, method: str, *args, parse_output=lambda X: X, num_samples=11, **kwargs | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might need a docstring here to clarify these arguments.
quantumnetworks/analysis/error.py
Outdated
scalings = np.random.normal(size=num_samples * num_variables).reshape( | ||
num_samples, num_variables | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but you might be able to specify the shape directly in size, without needing np.reshape
.
E.g. size=(num_samples, num_variables)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, but this is assuming the error on all omegas or kappas, etc. is the same? That is omegas_error
is assumed to be the same for omega_a
, omega_b
, etc? Might be good to mention that explicitly in a docstring since in principle one might have different uncertainties on those (e.g. if omega_a
is a microwave resonator and omega_b
is a Fabry-Perot optical cavity, the experiments one would do to measure the frequencies are different and so might have different uncertainties).
That said, keeping omegas_error
the same for all is totally fine here (i.e. not worth the time to have to explicitly set all uncertainties manually). So maybe just mention it as a specific choice and leave it at that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, omegas_error
is a vector and we're doing element-wise multiplication when we do omegas_error * scaling_vec[:num_modes]
!
Check the notebook for detailed use!
def calculate_error( | ||
self, method: str, *args, num_samples=11, parse_output=lambda X: X, **kwargs | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copying the description over from #4, but good to add a docstring here to clarify the general idea of what this method is trying to do.
General idea:
Let's say we measure parametera ± δa
,b ± δb
, andc ± δc
. Then, to find the error inf(a,b,c)
, we can sample the parameter values ofa*
in the gaussian distribution centered arounda
with standard deviation ofδa
(and similarly forb*
andc*
) and calculatef(a*,b*,c*)
multiple times. Then, we can take the standard deviation of that set off(a*,b*,c*)
s to findδf
.
Comments mainly consist of adding docstrings and other minor fixes. Otherwise, looks solid! 💯 |
PR to close #4 .
Relevant notebook: demos/analysis/ErrorAnalysis.ipynb