caret_analyze.common.clock_converter module

class caret_analyze.common.clock_converter.ClockConverter(a: float, b: float)

Bases: object

Class for time conversion. Converts a time given in linear form (y=ax+b) to another time.

TODO(hsgwa): Migrate into record.

convert(time: float) float

Convert input time.

Parameters

timefloat

Time to convert.

Returns

float

Time after conversion. Conversion are done with y=ax+b.

static create_from_series(times_from: Sequence[float], times_to: Sequence[float]) ClockConverter

Construct an instance from time series data.

Parameters

times_fromSequence[float]

Time before conversion.

times_toSequence[float]

Time after conversion.

Returns

ClockConverter

converter instance.

Raises

InvalidArgumentError

Occurs when calculation failed by the least-squares method.