pydtk.statistics package

Submodules

pydtk.statistics.calculator module

Base Statistic Calculation module.

class pydtk.statistics.calculator.BaseCalculator(target_span=60.0, sync_timestamps=False)

Bases: object

Base Calculator.

count(timestamps, data)

Divide and return count of True in divided data.

divide(timestamps, data)

Divide data with target span.

Parameters
  • timestamps (ndarray) – timestamps [sec]

  • data (ndarray) – signal to downsample

Returns

timestamps [sec] divided_data (list): divided data list

Return type

divided_timestamps (ndarray)

max(timestamps, data)

Divide and return maximum of divided data.

mean(timestamps, data)

Divide and return means of divided data.

min(timestamps, data)

Divide and return minimum of divided data.

class pydtk.statistics.calculator.BoolCalculator(target_span=60.0, **kwargs)

Bases: pydtk.statistics.calculator.BaseCalculator

Calculator for data of float.

count(timestamps, data)

Count True.

Parameters
  • timestamps (ndarray) – timestamps [sec]

  • data (ndarray) – input data

Returns

timestamps [sec] stat_data (ndarray): count of true data

Return type

index_timestamps (ndarray)

max(timestamps, data)

Calculate max.

Parameters
  • timestamps (ndarray) – timestamps [sec]

  • data (ndarray) – input data

Returns

timestamps [sec] stat_data (ndarray): max of input data

Return type

index_timestamps (ndarray)

mean(timestamps, data)

Average of true counts during the span.

Parameters
  • timestamps (ndarray) – timestamps [sec]

  • data (ndarray) – input data

Returns

timestamps [sec] stat_data (ndarray): count of true data

Return type

index_timestamps (ndarray)

min(timestamps, data)

Calculate minimum.

Parameters
  • timestamps (ndarray) – timestamps [sec]

  • data (ndarray) – input data

Returns

timestamps [sec] stat_data (ndarray): min of input data

Return type

index_timestamps (ndarray)

class pydtk.statistics.calculator.FloatCalculator(target_span=60.0, **kwargs)

Bases: pydtk.statistics.calculator.BaseCalculator

Calculator for data of float.

max(timestamps, data)

Calculate max.

Parameters
  • timestamps (ndarray) – timestamps [sec]

  • data (ndarray) – input data

Returns

timestamps [sec] stat_data (ndarray): max of input data

Return type

index_timestamps (ndarray)

mean(timestamps, data)

Calculate mean.

Parameters
  • timestamps (ndarray) – timestamps [sec]

  • data (ndarray) – input data

Returns

timestamps [sec] stat_data (ndarray): mean of input data

Return type

index_timestamps (ndarray)

min(timestamps, data)

Calculate minimum.

Parameters
  • timestamps (ndarray) – timestamps [sec]

  • data (ndarray) – input data

Returns

timestamps [sec] stat_data (ndarray): min of input data

Return type

index_timestamps (ndarray)

exception pydtk.statistics.calculator.UnsupportedOperationError

Bases: BaseException

Error for unsupported file.

Module contents

Base Statistic Calculation module.

class pydtk.statistics.BaseStatisticCalculation(target_span=60.0, sync_timestamps=False)

Bases: object

Base Statistic Calculation.

calculate(timestamps, data, operation)

Divide and calculate statistics of divided data.

Parameters
  • timestamps (ndarray) – timestamps [sec]

  • data (ndarray) – input data

  • operation (str) – operation

Returns

timestamps [sec] stat_data (ndarray): mean of input data

Return type

index_timestamps (ndarray)

count(timestamps, data)

Divide and return count of True in divided data.

max(timestamps, data)

Divide and return maximum of divided data.

mean(timestamps, data)

Divide and return means of divided data.

min(timestamps, data)

Divide and return minimum of divided data.

statistic_tables(timestamps, data, columns)

Make statistic tables.

Parameters
  • timestamps (ndarray) – timestamps [sec]

  • data (ndarray) – input data

  • columns (str) – columns of table

Returns

dict includes statistic DataFrames

Return type

df_dict (dict)