Skip to content

Add a double-precision Phase class - #77

Merged
mhvk merged 15 commits into
masterfrom
phase-as-specific-quantity
Jun 4, 2019
Merged

mhvk merged 15 commits into
masterfrom
phase-as-specific-quantity

Conversation

@mhvk

@mhvk mhvk commented Mar 31, 2019 •

Copy link
Copy Markdown
Owner

With the idea to move this up to PINT, to replace its phase class.

fixes #71

@mhvk
mhvk force-pushed the phase-as-specific-quantity branch 4 times, most recently from 10259e2 to f6a5d92 Compare April 2, 2019 21:19
@mhvk
mhvk force-pushed the phase-as-specific-quantity branch from f6a5d92 to d5794d4 Compare April 13, 2019 02:28
@mhvk
mhvk force-pushed the phase-as-specific-quantity branch 4 times, most recently from 98c0d62 to d9fd67b Compare May 30, 2019 21:54
@mhvk
mhvk force-pushed the phase-as-specific-quantity branch from 37939cb to 18217d0 Compare June 2, 2019 18:18
@mhvk
mhvk requested a review from luojing1211 June 2, 2019 18:23
@mhvk

mhvk commented Jun 2, 2019

Copy link
Copy Markdown
Owner Author

@luojing1211 - there are things that still could be improved, but for our purposes the Phase class should be more than good enough. Could you have a look? For possible implementation in PINT, do note that it requires numpy >=1.13, astropy >=3.1

mhvk added 12 commits June 4, 2019 13:28
This particular branch is a mix of ideas from EarthLocation and Time.
… double.

Aslo add floor division, modulo, and divmod.
This as we need __array_ufunc__, and sufficient Quantity support.

Also update Phase to have its own max, min, ptp, and sort methods.
Since those of Time refer to jd1, jd2, etc., and have links that
will fail.
Allow initialization with Phase, and anything that would initialize an Angle.
Since older astropy may not support that version.
@mhvk
mhvk force-pushed the phase-as-specific-quantity branch from 18217d0 to c73e2f0 Compare June 4, 2019 17:28
@mhvk

mhvk commented Jun 4, 2019

Copy link
Copy Markdown
Owner Author

@luojing1211 - would you have time to have a look at this PR? If not, no problem, then I think I'll just merge it - it should be reasonably fine.

@luojing1211

luojing1211 commented Jun 4, 2019 via email

Copy link
Copy Markdown
Collaborator

@mhvk

mhvk commented Jun 4, 2019

Copy link
Copy Markdown
Owner Author

@luojing1211 - great, let me know if you'd want to put them in-line or rather sit together and adjust.

@@ -199,16 +199,19 @@ def _get_offsets(self, samples, precision=1.e-3, max_iter=10):
return (np.round(samples / self._mean_offset_size +

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this function aiming to solve the non-uniform phase stack problem?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This branch is for the case that one is just integrating by some amount of time.

np.equal, np.not_equal,
np.less, np.less_equal, np.greater, np.greater_equal}


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is useful to have a small function that converts a string number to two doubles. I am not sure if this functionality should be added to this PR.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Do you mean a string `fffffff.fffffffffffffffff'? Ie., decoding it like for DADA times?

It would not be difficult to do. Would a classmethod be OK, or do you think the initializer itself should deal with it? (Slightly prefer the former myself).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, decoding it like DADA times, or a big number of phase. From the point of the user, I think the initializer one would be handy.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I like the idea, but think we should then also allow writing such long strings. So, I made it a separate issue: gh-93

@mhvk

mhvk commented Jun 4, 2019

Copy link
Copy Markdown
Owner Author

Let me merge this one, so we have a basis to work of for future improvements.

@mhvk
mhvk merged commit 8f0260e into master Jun 4, 2019
@mhvk
mhvk deleted the phase-as-specific-quantity branch June 4, 2019 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request phases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make new phase utilities useful for integration

2 participants