-
Notifications
You must be signed in to change notification settings - Fork 3
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
Lazy covariance #179
Lazy covariance #179
Conversation
cbf99cd
to
2c6eb2e
Compare
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.
Can you also update the doc-string of PSpecData.R()
to note that the K
matrix can be either I
, iC
or sinc_downweight
based on the value of self.data_weighting
?
It seems like what you've done in |
@anguta Here is a neat example for you to test out.
You'll find that CF and CF2 are nearly identical, which I think suggests that this is not necessarily a replacement for covariance weighting.. |
I think that the main reason to include this matrix in our power-spectrum stage is that its action is most easily incorporated into the calculation of power-spectrum covariances and error bars if its added as the K matrix. That said, we could propogate it into C either empirically or through direct calculation (though for the calculation, we'd need to develop some extra machinery outside of pspec). We should discuss this on the next telecon. |
I've added that sinc_downweight can be used as an option |
Wouldn't you want to filter this by the inverse covariance? I do think that this weighting is very similar to inv covariance weighting. One simple way to think of inverse covariance filtering is that you transform into the eigenbasis of the signal vector (which in an ideal infinite bandwidth, spectrally flat foregrounds case would be delay space), and then divide the foreground modes (in the wedge) by their variance, and then transform back. What you've done is suppressed the sinusoids in the wedge by a factor of 1/Var which is essentially what the inverse sinc weighting does (although the supression factor is set by |
@anguta could you also link your lazy covariance PDF or overleaf url for posterity here? thanks |
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.
Looks good. Just a few questions about things I'm confused about, and a query about how r_params
is specified.
I'm working on a tutorial notebook that also describes some of the underlying math and why the filter is effective. I'm going to be adding it to uvtools with a new pull request there (which lets you use lazy covariance weighting as a general clean method for data inspection). |
@anguta ok sounds good. do we want to wait on this PR so that you just call Also we still need to figure out how to propagate some amount of |
Yeah, lets wait until the uvtools code is merged in so I can reference it from hera_pspec. for the history issue, maybe we can use one baseline per redundant group for now as you suggested. cheers, -Aaron |
fae39b1
to
3c33bc9
Compare
I've added linear cleaning to uvtools and removed duplicate code here. |
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.
Looks good, just a couple of things to clean up.
@anguta Also: the new notebook |
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.
Apart from a few minor typos in the example notebook, this is ready to go.
I've also added a new r_params parameter for uvpspec objects that stores r_parameters as a string (in a compressed format that avoids storing many copies of the same dictionary) along with a decompression method to retrieve the original dictionary. |
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.
Looks good, but a few loose ends to tie up:
- a couple of docstrings could be a little clearer/more detailed
- it's not clear how
r_params
is treated when UVPSpec objects are added together - I think the
get_r_params
test should be a bit more real-worldy
…spec into lazy_covariance
I'm a little bit confused by this example. The filtering matrix is supposed to be the inverse of sinc_downweight_inv. At any rate, I'd naively expect CF2 and CF to be the same since the first is the covariance of the data after applying a matrix multiplication (basically a change of basis with a matrix) and the second is applying the transformation matrix to the covariance of the original basis (equivalent to calculating the covariance in the new basis). |
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.
looks good, thanks Aaron!
I've addressed all of the issues mentioned here. cheers, -Aaron |
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.
Looks good. Just minor typos.
Added some new weighting modes.