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

minor upgrades to uvpspec and pspecdata #119

Merged
merged 2 commits into from
May 30, 2018
Merged

minor upgrades to uvpspec and pspecdata #119

merged 2 commits into from
May 30, 2018

Conversation

nkern
Copy link
Member

@nkern nkern commented May 23, 2018

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

…comments

including uvp.get_blpairs func, doc string clarify and more informative assert in pspecdata
and inversely averaging nsamp1 and nsamp2 in pspecdata.pspec()
@nkern nkern self-assigned this May 23, 2018
@nkern nkern requested a review from philbull May 23, 2018 06:43
@coveralls
Copy link

coveralls commented May 23, 2018

Coverage Status

Coverage increased (+0.06%) to 96.685% when pulling 85ad164 on pspec_DR_minor_edits into e3b3b15 on master.

Copy link
Collaborator

@philbull philbull left a 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
Copy link
Collaborator

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.

Copy link
Member Author

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.

@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"are" => "is"


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().
Copy link
Collaborator

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):
Copy link
Collaborator

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup

Copy link
Member Author

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.


def get_all_keys(self):
"""
Returns a list of all possible tuple keys in the data_array.
Copy link
Collaborator

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)

@nkern nkern merged commit d211382 into master May 30, 2018
@nkern nkern deleted the pspec_DR_minor_edits branch May 30, 2018 19:20
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.

3 participants