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

Time profiling pull request #146

Merged
merged 28 commits into from
May 11, 2017
Merged

Time profiling pull request #146

merged 28 commits into from
May 11, 2017

Conversation

aelanman
Copy link
Contributor

Improvements in speed for read/write operations.

if run_check:
self.check(run_check_acceptability=run_check_acceptability)
# if run_check:
# self.check(run_check_acceptability=run_check_acceptability)
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure you want the check lines to be commented out? That seems like a bad idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops.... Yes, I cut those from mine because it was running slow and didn't want to address it, but I'll put them back and run the profiler again.

I don't think it'll break, since write_miriad also runs the acceptability check.

for ind, jd in enumerate(self.time_array):
# calculate ra/dec of phase center in current epoch
obs.date, obs.epoch = self.juldate2ephem(jd), self.juldate2ephem(jd)
precess_pos.compute(obs)
ra, dec = precess_pos.a_ra, precess_pos.a_dec

# generate rotation matrices
m0 = a.coord.top2eq_m(self.lst_array[ind] - obs.sidereal_time(), latitude)
m0 = a.coord.top2eq_m(self.lst_array[ind] - obs.sidereal_time(), latitude) ##TODO This is a bottleneck because top2eq_m involves a matrix inversion.
Copy link
Member

Choose a reason for hiding this comment

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

Do you have a plan to address this? I think marking it as a bottleneck is usefully informative, but the TODO label gets grabbed by some editors and should only be used if there's a plan to fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if I just remove the TODO label? I haven't found a way to address it yet, but maybe someone can? I have another line marked as a bottleneck in read_miriad().

Copy link
Member

Choose a reason for hiding this comment

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

I think that's perfect.

Copy link
Member

Choose a reason for hiding this comment

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

I don't have time to do it now, but one way to at least reduce the bottleneck, would be to only calculate m0 for unique times, rather than for all blts.

Copy link
Member

Choose a reason for hiding this comment

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

The other thought I have on this is that we should consider using astropy rather than aipy (which uses pyephem under the hood I think).

Copy link
Member

Choose a reason for hiding this comment

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

Aipy doesn't use pyephem for this particular function. In fact, it's a rather simple function which just just inverts eq2top_m, which simply records the matrix using sin and cos. I'd be tempted to write a small util function in pyuvdata to write down the inverse directly, which is equally easy.

@adampbeardsley
Copy link
Member

Note to self: before merging this branch, we need to check the phasing outputs against master - be sure we haven't changed this because we don't have a valid test yet.

@bhazelton
Copy link
Member

I think that when this PR is merged, we should put out a new pip package, which requires bumping the version number. Any opinions on whether it should be v1.2 or v1.1.1?

@adampbeardsley
Copy link
Member

Because this branch is getting close to merging, I went ahead and did a comparison of phasing with master. It's hard to make an actual unit test... so I just used master to read in a couple files, did various phasing and unphasing operations, writing output files throughout. I then used this branch to repeat those, and compare with the save files throughout.

What I learned is that there are a couple places where vectorizing the arithmetic caused intermediate quantities to be cast as float32 instead of float64 (when using uvws, which are float32). This caused small errors in uvws, which were small enough that they passed our tolerance, but translated to unacceptable errors in the data. I was able to make a couple changes locally to make sure everything is cast as float64, and everything works.

This is making me think that we actually want the uvws always stored as float64. I'm going to start a new issue for this, but I don't think it's stopping for the time being. I'll push my local changes, just to match master, but they should go away if we do eventually use float64.

@adampbeardsley adampbeardsley merged commit 910d76b into master May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants