sot / chandra_time

Convert between various time formats relevant to Chandra.
https://sot.github.io/Chandra.Time
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Support CxoTime in DateTime and modernize #42

Closed taldcroft closed 4 years ago

taldcroft commented 4 years ago

Description

Allow instantiating a DateTime object from a CxoTime object, and conversely getting a CxoTime object from DateTime using tm.cxotime.

One disappointing issue is that I discovered that CxoTime (astropy Time) is quite slow in creating scalar time objects, up to a factor of 15 slower (300 us vs. 20 us). For most applications this won't matter.

Testing

Fixes #

taldcroft commented 4 years ago

With apologies, I ended up migrating the unit tests to pytest in order to get things working. So this ends up making this into a multi-issue PR.

taldcroft commented 4 years ago

I addressed the comments and simplified the implementation so it is much cleaner and more isolated from the original code.