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 candidate for merge #332

Merged
merged 54 commits into from Aug 27, 2012
Merged

Time candidate for merge #332

merged 54 commits into from Aug 27, 2012

Conversation

taldcroft
Copy link
Member

This represents a candidate for merging and supercedes PR #294. New features since the last commit 0abdeb7 on the time branch there:

  • Much improved documentation, now written in the package template standard.
  • Get rid of the "opt" mechanism for setting options and replace with attributes (1016f97).
  • Make the time scale and format attributes appear in IPython tab-completion (9214ef8)
  • Some refactoring to improve code clarity.
  • Change set/get_delta_* methods into property attributes (f131694)
  • Rename astropy/time/astrotime.py to astropy/time/core.py.
  • Rebase from astropy/master (09eafa7), hence the new PR.

Of particular note for the API is that the proposed standard for users will be:

>>> from astropy.time import Time, TimeDelta

This provides all "user" functionality for the time package. I think this is clean and looks nice. Developers wishing to write derived classes etc will do:

>>> import astropy.time as atime

Still to do prior to merge:

  • Improve test suite
  • Capture many of the good implementation ideas in the PR Time alternate implementation 2 #294 discussion as issues.
  • Capture some other unexpected / undesired behavior I've noticed as issues. (None of these affect the documented API).

taldcroft and others added 30 commits July 29, 2012 15:30
This options system now provides TimeFormat subclasses with a dict container
to hold options that control behavior.  The only current example is
"precision".  This is implemented as a dict subclass that inherits
from a global options dict at the time of __getitem__.  This class
does key and value validation for the allowed options.
This commit adds the ability to specify and select variations
on a TimeString-based format (e.g. TimeISO).  It also adds the
capability to parse heterogenous input time formats.  The input
values must still all parse within a single TimeFormat class.

These named subformats allow for input parsing of related but different
formats, e.g.  '%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', and '%Y-%m-%d'.  The
allowed subformats can be selected by name using unix globbing of the subformat
names.  The above three are named 'date_hms', 'date_hm', and 'date', so one can
require at least date and hour and minute with 'date_hm*'.

Likewise for output one can select subformats using a glob, though the
first selected subformat is used.
Use a few hardwired attributes/properties instead of 'opt' dict.
This makes things more natural and cleaner for the user.  If
too many more attributes get added then this may get ugly but
for now it is better (and realistically there probably won't
be more than a couple more).
@taldcroft
Copy link
Member Author

@cdeil -

Is there a specific reason why the Time constructor parameter is called val, i.e. singular, but the property is called vals, i.e. plural?

There is a bit of a reason here. The vals attribute exposes the numpy array version of the formatted values, so it is always plural and might not match the input shape. It's there because within the Time machinery it can be convenient to know you have a numpy array. I could probably make this hidden but it breaks stuff...

But your idea is good and in ddd5df0 I added a val attribute that behaves like you would expect.

In [4]: t = Time('B1950.0', scale='utc', precision=3)

In [5]: t.val
Out[5]: 'B1950.000'

In [6]: t.vals
Out[6]: 
array(['B1950.000'], 
      dtype='|S9')

@eteq
Copy link
Member

eteq commented Aug 20, 2012

@taldcroft - I see you put in a bunch of commits a few days ago... Is this ready to merge as far as you are concerned? And I see you generated some issues based on the earlier comments - between that and these changes, has everything brought up so far here been addressed? (Just so we're all on the same page)

@taldcroft
Copy link
Member Author

@eteq - yes all the comments here are either addressed or have been migrated to an issue. So it's ready to merge from my perspective.

@astrofrog
Copy link
Member

This looks good to me. I have a very minor comment, but not an issue if this gets merged first - there are a couple of instances where @taldcroft used XXX or XXX To do - could you change these to TODO to make them easier to find in future?

@taldcroft
Copy link
Member Author

@astrofrog and @eteq - fixed the XXX issue and found a couple more little problems after looking at the documentation once more. I'm sure there are some lurking issues but they have not surfaced yet...

@astrofrog
Copy link
Member

I think we should merge this pretty soon, and if you find any issues with the code/docs, just submit a PR. In the end, we should get people to try using this once merged to see if they run into any issues. As far as I'm concerned, this can be merged. @eteq?

@astrofrog
Copy link
Member

@taldcroft - given that this is a large PR could you push this to your staging branch for testing?

@taldcroft
Copy link
Member Author

@mdboom and @astrofrog - I just started jenkins builds on debian and macosx for this PR. A few days ago I pushed a different branch to staging and waited about an hour for builds to automatically start, but no go. So I started builds manually. Is that the expected behavior now? Just want to make sure I'm doing things right.

@astrofrog
Copy link
Member

@taldcroft - just for the record, you should never start the MacOS X build manually. It will just try and build it with a debian environment and we sometimes need to go and clean out the workspace manually. Same goes for the Windows builds. The debian ones are the only ones that can/should be started from Shining Panda.

On another note, my Jenkins machine is refusing to boot (it crashed) so I'm not able to run the MacOS X tests at the moment.

@taldcroft
Copy link
Member Author

I think the last time I wait on MacOS for at least an hour before kicking off manually.

@taldcroft
Copy link
Member Author

Rats, there are a bunch of Python 3 fails that I need to investigate and resolve.

@astrofrog
Copy link
Member

@taldcroft - the MacOS X machine was down, hence why there were no results after 30 minutes. It's back up now, and should publish tests soon. What I meant was, the button to start the MacOS X and Windows builds does not actually work, and at best will do nothing, at worst will prevent builds from being published. The publishing only goes one way, the 'build' button never communicates with my mac.

@astrofrog
Copy link
Member

The MacOS X results are online, and there are indeed Python 3 failures. You might want to check in case there are any failures that aren't in the Linux one. Once you push changes, it should take 30-40 minutes to publish, so be patient :-)

https://jenkins.shiningpanda-ci.com/astropy/view/MacOS%20X/job/astropy-staging-taldcroft-osx-10.7-multiconfig/

- Encode string/unicode to UTF8 before passing to sofa_time routines.
- Fix test fail because python3 repr of float has more digits.
original object and then converting the internal time values in the copy to the
new time scale. The new |Time| object is returned by the attribute access.

Transformation deltas
Copy link
Member

Choose a reason for hiding this comment

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

Maybe avoid calling these "deltas" to avoid confusion with the "Time Deltas" section title? Instead perhaps "Time scale transformation offsets"?

@eteq
Copy link
Member

eteq commented Aug 23, 2012

@taldcroft - now that all the tests are passing on @taldcroft's staging, this looks great to me aside from the very minor bits below (and the one comment I just left inline). Thanks for all the hard work!

  • You might put the doc pages for time second (after astropy.nddata) - I think it probably should be high in the list given that it's a building block.)
  • The delta_ut1_utc attribute is not set by default because you're deferring it to issue Use table interpolation to provide default UT1 to UTC offset #351, correct? That's quite reasonable, but I'm not sure from the docs if delta_ut1_utc is UT1-UTC or UTC-UT1. So maybe just state explicitly which it is in the "Convert time scale" section.

@taldcroft
Copy link
Member Author

@eteq - your last three points should be addressed in 2abccad.

@eteq
Copy link
Member

eteq commented Aug 25, 2012

@taldcroft - looks great to me... are we all ready to merge now?

@taldcroft
Copy link
Member Author

As far as I know we are ready to merge. I don't have anything outstanding.

astrofrog added a commit that referenced this pull request Aug 27, 2012
@astrofrog astrofrog merged commit 871747a into astropy:master Aug 27, 2012
@astrofrog
Copy link
Member

Ok, I've merged this PR. @taldcroft - thanks for the great contribution!

keflavich pushed a commit to keflavich/astropy that referenced this pull request Oct 9, 2013
astrofrog added a commit to astrofrog/astropy that referenced this pull request Jun 12, 2019
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

7 participants