-
Notifications
You must be signed in to change notification settings - Fork 14
Add prescriptions to use diagonal theory cov mat #2453
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
Open
enocera
wants to merge
2
commits into
master
Choose a base branch
from
theory_uncorr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -141,6 +141,30 @@ def covmat_7pt(name1, name2, deltas1, deltas2): | |||||
| ) | ||||||
| return s | ||||||
|
|
||||||
| def covmat_7pt_diag(name1, name2, deltas1, deltas2): | ||||||
| """Returns diagonal theory covariance sub-matrix for 7pt prescription, | ||||||
| given two dataset names and collections of scale variation shifts""" | ||||||
| if name1 == name2: | ||||||
| s = (1 / 3) * sum(np.outer(d, d) for d in deltas1) | ||||||
| else: | ||||||
| s = (1 / 6) * ( | ||||||
| 2 * (np.outer(deltas1[0], deltas2[0]) + np.outer(deltas1[1], deltas2[1])) | ||||||
| + ( | ||||||
| np.outer((deltas1[2] + deltas1[3]), (deltas2[2] + deltas2[3])) | ||||||
| + np.outer((deltas1[4] + deltas1[5]), (deltas2[4] + deltas2[5])) | ||||||
| ) | ||||||
| ) | ||||||
| return np.diag(np.diag(s)) | ||||||
| def covmat_7pt_sym_envelope(name1, name2, deltas1, deltas2): | ||||||
| """Returns the diagonal theory covariance sub-matrix constructed as the | ||||||
| symmetric envelope around the central scale of the 7pt variations""" | ||||||
| if name1 == name2: | ||||||
| deltas1_max = np.max(np.abs(deltas1), axis=0) | ||||||
|
|
||||||
| s = np.outer(deltas1_max, deltas1_max) | ||||||
| else: | ||||||
| sys.exit("Inconsistent process name") | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Is this the intended behaviour? |
||||||
| return np.diag(np.diag(s)) | ||||||
|
|
||||||
| def covmat_9pt(name1, name2, deltas1, deltas2): | ||||||
| """Returns theory covariance sub-matrix for 9pt prescription, | ||||||
|
|
@@ -255,6 +279,10 @@ def compute_covs_pt_prescrip(point_prescription, name1, deltas1, name2=None, del | |||||
| elif point_prescription == "7 point": | ||||||
| # 7pt (Gavin) | ||||||
| s = covmat_7pt(name1, name2, deltas1, deltas2) | ||||||
| elif point_prescription == "7 point diagonal": | ||||||
| s = covmat_7pt_diag(name1, name2, deltas1, deltas2) | ||||||
| elif point_prescription == "7 point sym envelope": | ||||||
| s = covmat_7pt_sym_envelope(name1, name2, deltas1, deltas2) | ||||||
| elif point_prescription == "9 point": | ||||||
| s = covmat_9pt(name1, name2, deltas1, deltas2) | ||||||
| elif point_prescription == "ad ihou": | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm confused here because if name1 != name2 then there's nothing in the diagonal right? Should this also error out in that case. Or return all 0s if we only want the diagonal?
I think right now this one would be filling up random diagonals across the datasetX - datasetY offdiagonals