Welcome to timedata’s documentation!

Contents:

timedata.Color

alias of ColorRGB

class timedata.ColorHSV(*args)

A ColorHSV is an immutable RGB floating point color.

A ColorHSV looks like a Python tuple with $size floating point numbers, with the big exception that operators like + and * perform arithmetic, not list-style operations.

The constructor for ColorHSV takes a triple of numbers but also strings representing human-readable color names like “red” and “green”.

ColorHSV supports the operations +, -, *, /, %, pow, and ~ (which means “take the complementary color”).

ColorHSVs are very lightweight - about half the size of a corresponding Python tuple and more than twice as fast to create and copy. ColorHSVs are also immutable - all operations on ColorHSVs have to create a new ColorHSV.

The expected range of components in the color is from 0 to 1.0 but it’s perfectly acceptable to have any value in intermediate calculations, even infinity.

copy(self) → ColorHSV

Return a new copy of self.

distance(self, x) → float

FIXME

distance2(self, x) → float

FIXME

static from_hex(uint32_t arg)

Create a $classname from a hex integer

limit_max(self, x)

FIXME

limit_min(self, x)

FIXME

rotated(self, int index) → ColorHSV

FIXME

to_hex(self) → uint32_t

Return the nearest hex for this color

timedata.ColorList

alias of ColorListRGB

class timedata.ColorListHSV(items=None)

A list of RGB floating point Colors, with many mutating functions.

A ColorList looks quite like a Python list of Colors (which look like tuples) with the big interface difference that operations like + and * perform arithmetic and not list construction.

Written in C++, this class should consume significantly fewer memory and CPU resources than a corresponding Python list, as well as providing a range of useful facilities.

While ColorList provides a full set of functions and operations that create new ColorLists, in each case there is a corresponding mutating function or operation that works “in-place” with no heap allocations at all, for best performance.

abs(self) → ColorListHSV

FIXME that mutates self.

abs_to(self, ColorListHSV out) → ColorListHSV

FIXME that writes to another ColorListHSV.

add(self, c) → ColorListHSV

FIXME into this ColorListHSV.

add_to(self, c, ColorListHSV x) → ColorListHSV

FIXME onto another ColorListHSV.

append(self, ColorHSV c) → ColorListHSV

Append to the list of samples.

ceil(self) → ColorListHSV

FIXME that mutates self.

ceil_to(self, ColorListHSV out) → ColorListHSV

FIXME that writes to another ColorListHSV.

clear(self) → ColorListHSV

FIXME.

copy(self) → ColorListHSV

Return a new copy of self.

count(self, ColorHSV sample) → size_t

Return the number of times a sample appears in this list.

distance(self, x) → float

FIXME

distance2(self, x) → float

FIXME

div(self, c) → ColorListHSV

FIXME into this ColorListHSV.

div_to(self, c, ColorListHSV x) → ColorListHSV

FIXME onto another ColorListHSV.

extend(self, values) → ColorListHSV

Extend the samples from an iterator.

floor(self) → ColorListHSV

FIXME that mutates self.

floor_to(self, ColorListHSV out) → ColorListHSV

FIXME that writes to another ColorListHSV.

index(self, ColorHSV sample)

Returns an index to the first occurance of that Sample, or raises a ValueError if that Sample isn’t there.

insert(self, int key, ColorHSV sample) → ColorListHSV

Insert a sample before key.

invert(self) → ColorListHSV

FIXME that mutates self.

invert_to(self, ColorListHSV out) → ColorListHSV

FIXME that writes to another ColorListHSV.

max(self) → ColorHSV

Return the maximum values of each component.

max_limit(self, c) → ColorListHSV

FIXME into this ColorListHSV.

max_limit_to(self, c, ColorListHSV x) → ColorListHSV

FIXME onto another ColorListHSV.

min(self) → ColorHSV

Return the minimum values of each component/

min_limit(self, c) → ColorListHSV

FIXME into this ColorListHSV.

min_limit_to(self, c, ColorListHSV x) → ColorListHSV

FIXME onto another ColorListHSV.

mul(self, c) → ColorListHSV

FIXME into this ColorListHSV.

mul_to(self, c, ColorListHSV x) → ColorListHSV

FIXME onto another ColorListHSV.

neg(self) → ColorListHSV

FIXME that mutates self.

neg_to(self, ColorListHSV out) → ColorListHSV

FIXME that writes to another ColorListHSV.

pop(self, int key=-1) → ColorHSV

Pop the sample at key.

pow(self, c) → ColorListHSV

FIXME into this ColorListHSV.

pow_to(self, c, ColorListHSV x) → ColorListHSV

FIXME onto another ColorListHSV.

rdiv(self, c) → ColorListHSV

FIXME into this ColorListHSV.

rdiv_to(self, c, ColorListHSV x) → ColorListHSV

FIXME onto another ColorListHSV.

remove(self, ColorHSV sample) → ColorListHSV

Find and remove a specific sample.

resize(self, size_t size) → ColorListHSV

Set the size of the SampleList, filling with black if needed.

reverse(self) → ColorListHSV

FIXME that mutates self.

reverse_to(self, ColorListHSV out) → ColorListHSV

FIXME that writes to another ColorListHSV.

rotate(self, int pos) → ColorListHSV

In-place rotation of the samples forward by pos positions.

rotate_to(self, int pos, ColorListHSV out) → ColorListHSV

In-place rotation of the samples forward by pos positions.

round(self, uint digits=0) → ColorListHSV

Round each element in each sample to the nearest integer.

round_to(self, ColorListHSV out, uint digits=0) → ColorListHSV

Round each element in each sample to the nearest integer.

rpow(self, c) → ColorListHSV

FIXME into this ColorListHSV.

rpow_to(self, c, ColorListHSV x) → ColorListHSV

FIXME onto another ColorListHSV.

rsub(self, c) → ColorListHSV

FIXME into this ColorListHSV.

rsub_to(self, c, ColorListHSV x) → ColorListHSV

FIXME onto another ColorListHSV.

sort(self, key=None, bool reverse=False)

Sort.

sort_to(self, ColorListHSV out, key=None, bool reverse=False)

Sort to another vector.

static spread(*args)

Spreads!

sub(self, c) → ColorListHSV

FIXME into this ColorListHSV.

sub_to(self, c, ColorListHSV x) → ColorListHSV

FIXME onto another ColorListHSV.

trunc(self) → ColorListHSV

FIXME that mutates self.

trunc_to(self, ColorListHSV out) → ColorListHSV

FIXME that writes to another ColorListHSV.

zero(self) → ColorListHSV

FIXME.

class timedata.ColorListRGB(items=None)

A list of RGB floating point Colors, with many mutating functions.

A ColorList looks quite like a Python list of Colors (which look like tuples) with the big interface difference that operations like + and * perform arithmetic and not list construction.

Written in C++, this class should consume significantly fewer memory and CPU resources than a corresponding Python list, as well as providing a range of useful facilities.

While ColorList provides a full set of functions and operations that create new ColorLists, in each case there is a corresponding mutating function or operation that works “in-place” with no heap allocations at all, for best performance.

abs(self) → ColorListRGB

FIXME that mutates self.

abs_to(self, ColorListRGB out) → ColorListRGB

FIXME that writes to another ColorListRGB.

add(self, c) → ColorListRGB

FIXME into this ColorListRGB.

add_to(self, c, ColorListRGB x) → ColorListRGB

FIXME onto another ColorListRGB.

append(self, ColorRGB c) → ColorListRGB

Append to the list of samples.

ceil(self) → ColorListRGB

FIXME that mutates self.

ceil_to(self, ColorListRGB out) → ColorListRGB

FIXME that writes to another ColorListRGB.

clear(self) → ColorListRGB

FIXME.

copy(self) → ColorListRGB

Return a new copy of self.

count(self, ColorRGB sample) → size_t

Return the number of times a sample appears in this list.

distance(self, x) → float

FIXME

distance2(self, x) → float

FIXME

div(self, c) → ColorListRGB

FIXME into this ColorListRGB.

div_to(self, c, ColorListRGB x) → ColorListRGB

FIXME onto another ColorListRGB.

extend(self, values) → ColorListRGB

Extend the samples from an iterator.

floor(self) → ColorListRGB

FIXME that mutates self.

floor_to(self, ColorListRGB out) → ColorListRGB

FIXME that writes to another ColorListRGB.

index(self, ColorRGB sample)

Returns an index to the first occurance of that Sample, or raises a ValueError if that Sample isn’t there.

insert(self, int key, ColorRGB sample) → ColorListRGB

Insert a sample before key.

invert(self) → ColorListRGB

FIXME that mutates self.

invert_to(self, ColorListRGB out) → ColorListRGB

FIXME that writes to another ColorListRGB.

max(self) → ColorRGB

Return the maximum values of each component.

max_limit(self, c) → ColorListRGB

FIXME into this ColorListRGB.

max_limit_to(self, c, ColorListRGB x) → ColorListRGB

FIXME onto another ColorListRGB.

min(self) → ColorRGB

Return the minimum values of each component/

min_limit(self, c) → ColorListRGB

FIXME into this ColorListRGB.

min_limit_to(self, c, ColorListRGB x) → ColorListRGB

FIXME onto another ColorListRGB.

mul(self, c) → ColorListRGB

FIXME into this ColorListRGB.

mul_to(self, c, ColorListRGB x) → ColorListRGB

FIXME onto another ColorListRGB.

neg(self) → ColorListRGB

FIXME that mutates self.

neg_to(self, ColorListRGB out) → ColorListRGB

FIXME that writes to another ColorListRGB.

pop(self, int key=-1) → ColorRGB

Pop the sample at key.

pow(self, c) → ColorListRGB

FIXME into this ColorListRGB.

pow_to(self, c, ColorListRGB x) → ColorListRGB

FIXME onto another ColorListRGB.

rdiv(self, c) → ColorListRGB

FIXME into this ColorListRGB.

rdiv_to(self, c, ColorListRGB x) → ColorListRGB

FIXME onto another ColorListRGB.

remove(self, ColorRGB sample) → ColorListRGB

Find and remove a specific sample.

resize(self, size_t size) → ColorListRGB

Set the size of the SampleList, filling with black if needed.

reverse(self) → ColorListRGB

FIXME that mutates self.

reverse_to(self, ColorListRGB out) → ColorListRGB

FIXME that writes to another ColorListRGB.

rotate(self, int pos) → ColorListRGB

In-place rotation of the samples forward by pos positions.

rotate_to(self, int pos, ColorListRGB out) → ColorListRGB

In-place rotation of the samples forward by pos positions.

round(self, uint digits=0) → ColorListRGB

Round each element in each sample to the nearest integer.

round_to(self, ColorListRGB out, uint digits=0) → ColorListRGB

Round each element in each sample to the nearest integer.

rpow(self, c) → ColorListRGB

FIXME into this ColorListRGB.

rpow_to(self, c, ColorListRGB x) → ColorListRGB

FIXME onto another ColorListRGB.

rsub(self, c) → ColorListRGB

FIXME into this ColorListRGB.

rsub_to(self, c, ColorListRGB x) → ColorListRGB

FIXME onto another ColorListRGB.

sort(self, key=None, bool reverse=False)

Sort.

sort_to(self, ColorListRGB out, key=None, bool reverse=False)

Sort to another vector.

static spread(*args)

Spreads!

sub(self, c) → ColorListRGB

FIXME into this ColorListRGB.

sub_to(self, c, ColorListRGB x) → ColorListRGB

FIXME onto another ColorListRGB.

trunc(self) → ColorListRGB

FIXME that mutates self.

trunc_to(self, ColorListRGB out) → ColorListRGB

FIXME that writes to another ColorListRGB.

zero(self) → ColorListRGB

FIXME.

class timedata.ColorRGB(*args)

A ColorRGB is an immutable RGB floating point color.

A ColorRGB looks like a Python tuple with $size floating point numbers, with the big exception that operators like + and * perform arithmetic, not list-style operations.

The constructor for ColorRGB takes a triple of numbers but also strings representing human-readable color names like “red” and “green”.

ColorRGB supports the operations +, -, *, /, %, pow, and ~ (which means “take the complementary color”).

ColorRGBs are very lightweight - about half the size of a corresponding Python tuple and more than twice as fast to create and copy. ColorRGBs are also immutable - all operations on ColorRGBs have to create a new ColorRGB.

The expected range of components in the color is from 0 to 1.0 but it’s perfectly acceptable to have any value in intermediate calculations, even infinity.

copy(self) → ColorRGB

Return a new copy of self.

distance(self, x) → float

FIXME

distance2(self, x) → float

FIXME

static from_hex(uint32_t arg)

Create a $classname from a hex integer

limit_max(self, x)

FIXME

limit_min(self, x)

FIXME

rotated(self, int index) → ColorRGB

FIXME

to_hex(self) → uint32_t

Return the nearest hex for this color

class timedata.Renderer(level=1.0, *, **kwds)
render(self, colors, bytearray output=None)
timedata.compile_timestamp()

Return a string with the compilation time of this module in UTC.

timedata.git_tags()

Return a string representing the git branch and commit ID that this release of timedata was compiled with.

timedata.optimization_flags()

Return a string with the optimization flags passed to the compiler and linker.

Useful for benchmarks so you can experiment with different optimization flags and automatically record the results.

timedata.print_startup_message()

Print a string with the startup message.

To silence the printing of this message at startup, set the environment variable TIMEDATA_SILENT_STARTUP.

Indices and tables