pycalibration package


pycalibration.curve module

class pycalibration.curve.Curve(x, y)[source]

Bases: object

Curve allow the defintion and extroplation of data of a curve

This class is usually returned by the DCM class after importing a file.

insert(x, y)[source]

Insert a point in the curve

  • x – x value of the point

  • y – y value of the point




return the y value of a curve given the x value.

Values are interpolated between the points given

pycalibration.engine module

class pycalibration.engine.Engine(n=[600, 1000, 2000, 4000, 6000], t=[100, 500, 1000, 800, 100])[source]

Bases: object

Class engine offers support for engine calculation and estimation.

power(speed, limit=100)[source]

Return the Power at a given engine speed and a percentage torque :param speed: engine speed in rpm :param limit: max percentage torque :return: engie power in watts

torque(speed, limit=100)[source]

Return the torque at an engine speed with a max percentage torque ( 100% is full torque) :param speed: engine speed in rpm :param limit: maximum percent torque from curve :return: engine torque in Nm

pycalibration.extract module

class pycalibration.extract.Extract[source]

Bases: MDF

Extract class extract channels from single or multiple files


Add a directory recursively to the files to be processed. Files recognize are mdf and mf4 exensions


path – path to be added




Add single file to the list of files to be processed


file – file name path to the file




Read the MDF files and retrieved the requested data.


list of pandas dataframe contaiing the datas.

pycalibration.function module

class pycalibration.function.Function[source]

Bases: Extract

Base class to define function in module

Based on Extract, it supoprt all the extract method. It is necessary to set the files or directory to process before calling the process method.

Evaluate method should be overwritten for data evaluation related to the function beeing developed.


Using the data retrieved from the measurement file, generate calibration This method should be over writen by the derivative class and returns what ever the evaluation is producing.


should return the evaluation data


Write the labels and parameters in a lab file




Retrieve the necessary information from the measurment files.


list containing files processed results

pycalibration.gearbox module

class pycalibration.gearbox.Gearbox(n=[1, 2, 3, 4, 5], r=[10, 9, 8, 7, 6])[source]

Bases: object

Gearbox class Class provide interface to get the gear ratio on a given gear


Return the gear ratio for a given gear :param gear: gear number :return: gear ratio module

class, y, z)[source]

Bases: object

x(y, z)[source]
y(x, z)[source]
z(x, y)[source]

pycalibration.mdf module

class pycalibration.mdf.MDF(filename=None)[source]

Bases: object

MDF class to handle MDF read operation

add_channel(channel, rename='', inter=False)[source]

Set a channel to be retrieved from the MDF. If a rename name is supplied, the channels will be reneamed. If more than one channel as the same rename name, all channels will be checked until one available is found. Interpolation should not be used on digitial signal. The interpolation is linear and should be used on non digitial signals to improve accuracy lf signal in measurement with multiple time raster.

  • channel – channel name

  • rename – name to be renamed to

  • inter – Set to True to interpolate missing values, default False.




Get the data designated by the channel name


channel – channel name


pandas dataframe containing the data


Read the MDF file and retrieved the requested data


filename – filename ( with full path ) of the MDF file to open


pandas dataframe containing the datas. The time offset for the channels is set to the column offset. The dataframe indes is based on the file timestamp with the measurement time offset. This allows datetime operation on the dataframe.


pycalibration.resistance module

class pycalibration.resistance.Resistance(cx=0, fr=0, ro=0)[source]

Bases: object

This class calculates the vehicle driving resistance


Return the air resisting force :param v: vehicle speed in m/s :return: air resisting force in N

fpitch(m, grade)[source]

Return the pitch resisting force at a specified pitch :param m: total vehicle mass in kg :param pitch: slope in percentage :return: pitch resisting force in N

frolling(m, grade)[source]

Return the rolling resisting force :param m: total vehicle mass in kg :param pitch: slope in percentage :return: rolling resisting force in N

resistance(v, m, grade=0)[source]

Return the sum of air, pitch and rolling resisting force :param v: vehicle speed in m/s :param m: total vehicle mass in kg :param grade: slope in percentage :return: total resisting force in N

pycalibration.shift module

class pycalibration.shift.Shift[source]

Bases: object

Generate Table bevore and after shifting All the columns supplied in the data for process will be used. At the beginning of the shift, the columns will be added ‘_pre’, at the end of the shift ‘_post’.


Process the data and return the table containing the shifts.


data – pandas Dataframe containing the data, inclusive the channel to be used to detect the shift


Pandas dataframe containing the pre and post shifts data.

set_post(post, up=False)[source]

Set the post channel used for trigger

  • pre – Channel name to be used as trigger

  • up – Determine the signal direction ( up/down, up by default )

set_pre(pre, up=True)[source]

Set the pre channel used for trigger

  • pre – Channel name to be used as trigger

  • up – Determine the signal direction ( up/down, up by default )

pycalibration.trigger module

class pycalibration.trigger.Trigger[source]

Bases: object

Generate Table at the time of the event. The event shall be generated from a digital signal


Process the data and returns the events in a pandas dataframe


data – data to be analysed


pandas dataframe with all the signals and events

set_trigger(name, up=True)[source]

Set the name of the trigger signal

  • name – name of the signal to be used as trigger ( digital )

  • up – True if the event is rising



pycalibration.value module

class pycalibration.value.Value(x, y=None, z=None)[source]

Bases: object

Value class represent the informations stored in a parameter. Each value can be a single value, a curve or a map. All points are interpolated


Return the X value at a position ( interpolated from the array) :param pos: position in the array :return: X value


Return the Y value at a X position ( interpolated from the array) :param pos: position in the array :return: Y value

z(x, y)[source]

Return the Z value at a X,Y position ( interpolated from the array) :param pos: position in the array :return: Z value

pycalibration.vbo module

class pycalibration.vbo.VBO[source]

Bases: object


pycalibration.vehicle module

class pycalibration.vehicle.Vehicle[source]

Bases: object

class to represent a vehicle and basic calulation for the vehicle configuration

energy(n, gear, mass)[source]
engine_to_speed(engine, gear)[source]

Returns the vehicle speed from the engine speed and the common powertrain ratio :param engine: engine speed in 1/min :param gear: gear number :return: vehicle speed in m/s

force_to_torque(f, gear)[source]

Returns the engine torque from the traction force and the common powertrain ratio :param f: traction force in N :param ratio: common powertrain ratio :return: engine torque in Nm

fresist(speed, mass, grade=0)[source]

Returns the resistance force by entering the vehicle speed and the ratio (default ratio = 1) :param speed: vehicle speed in m/s :param mass: total vehicle mass in kg :param grade: road grade :return: resistance force in N


return the gear ration from the given gear


gear – gear number


trans ratio (gear and rear axle ratio)

speed_to_engine(speed, gear)[source]

Returns the engine speed from the vehicle speed and the common powertrain ratio :param speed: vehicle speed in m/s :param gear: gear number :return: engine speed in 1/min

torque(n, pedal=100)[source]

By default, this function returns the torque at an engine speed with a max percentage torque (100% is full torque) :param n: engine speed in rpm :param pedal: percentage value of the accelerator pedal; default 100% means full torque :return: engine torque in Nm

torque_to_force(t, gear)[source]

Returns the traction force from the engine torque and the common powertrain ratio :param t: engine torque in Nm :param ratio: common powertrain ratio :return: traction force in N

pycalibration.watchdog module

class pycalibration.watchdog.Watchdog(queue, path='.')[source]

Bases: FileSystemEventHandler


Called when a file or directory is created.


event (DirCreatedEvent or FileCreatedEvent) – Event representing file/directory creation.


Called when a file or a directory is moved or renamed.


event (DirMovedEvent or FileMovedEvent) – Event representing file/directory movement.


Module contents