[Numpy-discussion] Datetime again

Scott Ransom sransom at nrao.edu
Thu Jan 29 17:39:27 EST 2015


On 01/29/2015 09:58 AM, Chris Barker wrote:
>     > I was thinking elapsed time. Nanoseconds can be rather crude for that
>     > depending on the measurement.
>
>       Wouldn't the user just keep elapsed time as a
>     count, or floating point number, in whatever units the instrument spits
>     out?  Why does it need to be treated in a different way from any other
>     numeric data?  We don't have special types for length.
>
>
> I've wondered about this since np.datetime was first introduced. I know
> I have no need for better than second precision. Not that other's don't
> have that need, but is there even a single use-case of someone wanting
> nano, or sub-nanosecond precision and dates and calendar functionality
> in one array?
>
> -Chris

Millisecond pulsar timing does have need of absolute and relative time 
at the (single) nanosecond-precision level over time-spans of several 
decades.  You are correct that doing that kind of work, though, requires 
*very* special consideration of the various time scales and their 
idiosyncrasies (like leap seconds).  So I don't think we would use a 
numpy datetime array or object.

We have recently started using the very nice Time object in the AstroPy 
package.  That can (and does) do all of this stuff correctly. 
Internally, times are treated as pairs of 64-bit floats.

Cheers,

Scott

-- 
Scott M. Ransom            Address:  NRAO
Phone:  (434) 296-0320               520 Edgemont Rd.
email:  sransom at nrao.edu             Charlottesville, VA 22903 USA
GPG Fingerprint: 06A9 9553 78BE 16DB 407B  FFCA 9BFA B6FF FFD3 2989



More information about the NumPy-Discussion mailing list