-
Notifications
You must be signed in to change notification settings - Fork 101
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
Added mul and rmul to Phase.py and created test file for Phase.py #701
Conversation
This is great! Thanks Chloe! It has also made me think, and I've been looking at how
Of course, residuals are not phases, but phase differences. This reminds me of
|
@champagne-cmd, @paulray - seeing this, I think you should definitely consider just using my phase class in #695 - it has all this already included (I now wish I had pushed it up earlier, as it obviously would have saved work). |
One of the major problems is how do we handle the tow-double type. the reason we use np.float128 is that we don't have a good two double computation support (i.e. APIs and speed). If we can have a two double type in NumPy, like the complex numbers, it could be a lot easier. @mhvk Is there any two-double data type in numpy? |
No, there isn't anything in numpy - I think judicious using of int/frac for |
It would be useful to have a standard two-double type in Numpy. But it is out of our scope. I think if we have the mul, rmul, etc functions setup, we can compute from a two-double time object directly to a two-double phase. One thing I am not sure of is speed. Evaluating a Taylor series using two-double could be time-consuming. |
Agreed. Note that #695 does do multiplication and division, ensuring that precision is preserved (like |
I agree @luojing1211 . We can experiment with that. One thing I think @champagne-cmd will work on is a benchmarking code that will help us evaluate the performance effects of such changes. |
@paulray and @champagne-cmd, that's great to hear about the benchmarking. Are there plans to do some full-fledged profiling of the code as well (for pulsars with small, med, and large numbers of TOAs)? I think that would be incredibly valuable to help clean up some low-hanging fruit optimization-wise. The other thing to remember for the residuals class, for instance, is that while we are computing phase differences, those residuals used by an external optimization program (almost always demanding double precision) for the fits. And we aren't always dealing with just fractional parts of phase for this as we need to handle PHASE terms and known pulse rotation numbers that mean that the phase differences might be huge (which is exactly why there is that |
@scottransom we don't have full fledged plans yet, so suggestions on what to do for performance testing are most welcome! I recall a previous discussion of how Quantity and Units can be done in ways that are more or less efficient. Is there a reference for that somewhere that has best practices for performance? And I agree that residuals are typically required to be normal double precision numbers. So, I think that having some code in |
Astropy unit tips https://docs.astropy.org/en/stable/units/ in the Performance Tips section. The biggest thing is to avoid making copies. By the way, there is a simple script to do the profiling in the PINT profiling directory. It may be not the best but help me quite a bit. |
ooh... that's a useful page. I had completely forgotten about the << operator..... |
No description provided.