-
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
minor upgrades to uvpspec and pspecdata #119
Conversation
…comments including uvp.get_blpairs func, doc string clarify and more informative assert in pspecdata and inversely averaging nsamp1 and nsamp2 in pspecdata.pspec()
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 docstring-related comments.
@@ -1399,8 +1401,8 @@ def pspec(self, bls1, bls2, dsets, pols, input_data_weight='identity', norm='I', | |||
nsamp1 = np.sum(dset1.get_nsamples(bl1 + (p[0],))[:, self.spw_range[0]:self.spw_range[1]] * wgts1, axis=1) / np.sum(wgts1, axis=1).clip(1, np.inf) | |||
nsamp2 = np.sum(dset2.get_nsamples(bl2 + (p[1],))[:, self.spw_range[0]:self.spw_range[1]] * wgts2, axis=1) / np.sum(wgts2, axis=1).clip(1, np.inf) | |||
|
|||
# take average of nsamp1 and nsamp2 and multiply by integration time [seconds] to get total integration | |||
pol_ints.extend(np.mean([nsamp1, nsamp2], axis=0) * dset1.integration_time) | |||
# take inverse average of nsamp1 and nsamp2 and multiply by integration time [seconds] to get total integration |
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.
Why are we taking the inverse average now? It would be good to add a comment to document why we need to do this.
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.
sure. the inverse average is done b/c the nsample
is actually a proxy for 1/sigma
, where sigma
is the std of the noise. so we really should be averaging sigma
directly, which is equivalent to inversely averaging nsamples
. I'll make a comment explaining this.
hera_pspec/pspecdata.py
Outdated
@@ -1505,12 +1507,11 @@ def pspec(self, bls1, bls2, dsets, pols, input_data_weight='identity', norm='I', | |||
def rephase_to_dset(self, dset_index=0, inplace=True): | |||
""" | |||
Rephase visibility data in self.dsets to the LST grid of dset[dset_index] | |||
using hera_cal.utils.lst_rephase. | |||
using hera_cal.utils.lst_rephase. Each integration in all other dsets are |
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.
"are" => "is"
hera_pspec/pspecdata.py
Outdated
|
||
Will only phase if the dataset's phase type is 'drift'. | ||
Will only phase if the dataset's phase type is 'drift'. Note that if you intend | ||
to use Jy_to_mK(), it must be run after rephase_to_dset(). |
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.
It would be good to mention why.
@@ -1597,6 +1598,45 @@ def rephase_to_dset(self, dset_index=0, inplace=True): | |||
if inplace is False: | |||
return dsets | |||
|
|||
def Jy_to_mK(self, beam=None): |
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.
Should the example Jupyter notebook be changed to use this method now?
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.
yup
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.
except that to run on our test data another small bug fix is required that is addressed in a separate PR open right now. I'll update the notebook at a (near) future date incorporating all the changes we are making in this and a few other simultaneous PRs.
hera_pspec/uvpspec.py
Outdated
|
||
def get_all_keys(self): | ||
""" | ||
Returns a list of all possible tuple keys in the data_array. |
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.
It would be good to say what the keys are, i.e. (spectral window, baseline pair, polarisation)
addressing various 5/2018 DR comments, including uvp.get_blpairs func, doc string clarify and more informative assert in pspecdata, inversely averaging nsamp1 and nsamp2 in pspecdata.pspec(), and making Jy_to_mK a method on pspecdata.
Addresses issues #104, #105, #106, #111, and #115