[Numpy-discussion] NumPy date/time types and the resolution concept

Anne Archibald peridot.faceted at gmail.com
Mon Jul 14 10:21:32 EDT 2008


2008/7/14 Francesc Alted <faltet at pytables.org>:

> After pondering about the opinions about the first proposal, the idea we
> are incubating is to complement the ``datetime64`` with a 'resolution'
> metainfo.  The ``datetime64`` will still be based on a int64 type, but
> the meaning of the 'ticks' would depend on a 'resolution' property.

This is an interesting idea. To be useful, though, you would also need
a flexible "offset" defining the zero of time. After all, the reason
not to just always use (say) femtosecond accuracy is that 2**64
femtoseconds is only about five hours. So if you're going to use
femtosecond steps, you really want to choose your start point
carefully. (It's also worth noting that there is little need for more
time accuracy than atomic clocks can provide, since anyone looking for
more than that is going to be doing some tricky metrology anyway.)

One might take guidance from the FITS format, which represents (arrays
of) quantities as (usually) fixed-point numbers, but has a global
"scale" and "offset" parameter for each array. This allows one to
accurately represent many common arrays with relatively few bits. The
FITS libraries transparently convert these quantities. Of course, this
isn't so convenient if you don't have basic machine datatypes with
enough precision to handle all the quantities of interest.

Anne



More information about the NumPy-Discussion mailing list