Skip to content
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

Merged
merged 4 commits into from
Dec 6, 2021
Merged

Multimode error analysis! #44

merged 4 commits into from
Dec 6, 2021

Conversation

Phionx
Copy link
Owner

@Phionx Phionx commented Dec 6, 2021

PR to close #4 .

Relevant notebook: demos/analysis/ErrorAnalysis.ipynb

@Phionx Phionx marked this pull request as ready for review December 6, 2021 08:31
@Phionx Phionx changed the title Multimode error analysis with omegas working! Multimode error analysis! Dec 6, 2021

def run(
self, method: str, *args, parse_output=lambda X: X, num_samples=11, **kwargs
):
Copy link
Collaborator

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.

Comment on lines 85 to 87
scalings = np.random.normal(size=num_samples * num_variables).reshape(
num_samples, num_variables
)
Copy link
Collaborator

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)

Copy link
Collaborator

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

Copy link
Owner Author

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!

Comment on lines +55 to +57
def calculate_error(
self, method: str, *args, num_samples=11, parse_output=lambda X: X, **kwargs
):
Copy link
Collaborator

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 parameter a ± δa, b ± δb, and c ± δc. Then, to find the error in f(a,b,c), we can sample the parameter values of a* in the gaussian distribution centered around a with standard deviation of δa (and similarly for b* and c*) and calculate f(a*,b*,c*) multiple times. Then, we can take the standard deviation of that set of f(a*,b*,c*)s to find δf.

@shoumikdc
Copy link
Collaborator

Comments mainly consist of adding docstrings and other minor fixes. Otherwise, looks solid! 💯

@Phionx Phionx merged commit 7e2b9a0 into master Dec 6, 2021
@Phionx Phionx deleted the feature/4/error-analysis branch December 6, 2021 22:31
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.

Error Analysis based on parameter precision/uncertainty
2 participants