pydtk.utils package

Submodules

pydtk.utils.can_decoder module

CAN Decoder.

class pydtk.utils.can_decoder.BitAssign(data_label, data_name, can_id, data_position, data_length, minimum_renewal_time, minimum_renewal_time_comment, unit, resolution, resolution_comment, offset_physical, offset_cpu, signed)

Bases: object

A class for storing assignment information of a single bit.

reformat()

Remove unregular characters from bit assign information.

class pydtk.utils.can_decoder.BitAssignInfo(path_to_assign_list=None)

Bases: object

A class for handling CAN assignment list.

bit_assigns_from_can_id(can_id)

Returns list of bit assign information which corresponds to the given CAN ID.

Parameters

can_id (str) – ID of CAN

load_from_csv(path_to_assign_list)

Load can bit assign from csv.

Parameters

path_to_assign_list (str) – Path to csv

class pydtk.utils.can_decoder.CANData(time_in_nsec, data_label, data)

Bases: object

A class for handling the decoded CAN signals.

class pydtk.utils.can_decoder.CANDecoder(path_to_assign_list=None)

Bases: object

CAN csv file decoder.

analyze_csv(path_to_csv='', start_time=None, end_time=None)

Returns list of CANData.

Parameters
  • path_to_csv (str) – Path to a csv file containing CAN data

  • start_time (datetime) – Start-time to extract data

  • end_time (datetime) – End-time to extract data

Returns

A list of CANData

Return type

(list)

analyze_line()

Returns list of CANData in current line.

Returns

A list of CANData

Return type

(list)

close_csv()

Close the file.

load_bit_assign_list(path_to_assign_list)

Load bit-assign list from a file.

Parameters

path_to_assign_list (str) – Path to the file

open_csv(path_to_csv='')

Open a csv file and prepare file-pointer.

Parameters

path_to_csv (str) – Path to the csv file containing CAN data

static unpack_data(data_string, bit_assign)

Decodes data_string to signal value.

Parameters
  • data_string (str) – Data string

  • bit_assign (BitAssign) – A BitAssign object

Returns

Decoded value

Return type

(str)

class pydtk.utils.can_decoder.CANDeserializer(signal_list=None)

Bases: object

Deserialize CAN data.

deserialize(can_data, start_time=None, end_time=None, fps=5)

Deserializes given CAN data from start_time to end_time with given fps.

Parameters
  • can_data (list) – A list of CANData objects

  • start_time (datetime) – Start-time to deserialize data

  • end_time (datetime) – End-time to deserialize data

  • fps (int) – Fps to deserialize

Returns

Deserialized data

Return type

(dict)

pydtk.utils.can_decoder.main(args)

Main function.

Parameters

args (ArgumentParser) – arguments

pydtk.utils.fileutils module

pydtk.utils.imports module

Import utilities.

pydtk.utils.imports.import_module_from_path(path)

Import a module from a path.

Parameters

path (str) – Path to a module.

Returns

Imported module.

Return type

module

pydtk.utils.utils module

Module contents

pydtk modules.