Reference

Function

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.

add_channel(channel, rename='', inter=False)

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.

Parameters:
  • channel – channel name

  • rename – name to be renamed to

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

Returns:

None

add_directory(pathname)

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

Parameters:

path – path to be added

Returns:

none

add_file(filename, duplicates=True)

Add single file to the list of files to be processed

Parameters:
  • file – file name path to the file

  • duplicates – allow duplicates in the list of files

Returns:

none

evaluate(data)[source]

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.

Returns:

should return the evaluation data

get()

Read the MDF files and retrieved the requested data.

Returns:

list of pandas dataframe contaiing the datas.

get_channel(channel)

Get the data designated by the channel name

Parameters:

channel – channel name

Returns:

pandas dataframe containing the data

get_data()

Read the MDF file and retrieved the requested data

Parameters:

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

Returns:

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.

lab()[source]

Write the labels and parameters in a lab file

Returns:

None

process()[source]

Retrieve the necessary information from the measurment files.

Returns:

list containing files processed results

set_file(filename)

Extract

class pycalibration.extract.Extract[source]

Bases: MDF

Extract class extract channels from single or multiple files

add_channel(channel, rename='', inter=False)

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.

Parameters:
  • channel – channel name

  • rename – name to be renamed to

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

Returns:

None

add_directory(pathname)[source]

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

Parameters:

path – path to be added

Returns:

none

add_file(filename, duplicates=True)[source]

Add single file to the list of files to be processed

Parameters:
  • file – file name path to the file

  • duplicates – allow duplicates in the list of files

Returns:

none

get()[source]

Read the MDF files and retrieved the requested data.

Returns:

list of pandas dataframe contaiing the datas.

get_channel(channel)

Get the data designated by the channel name

Parameters:

channel – channel name

Returns:

pandas dataframe containing the data

get_data()

Read the MDF file and retrieved the requested data

Parameters:

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

Returns:

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.

set_file(filename)

MDF

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.

Parameters:
  • channel – channel name

  • rename – name to be renamed to

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

Returns:

None

get_channel(channel)[source]

Get the data designated by the channel name

Parameters:

channel – channel name

Returns:

pandas dataframe containing the data

get_data()[source]

Read the MDF file and retrieved the requested data

Parameters:

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

Returns:

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.

set_file(filename)[source]

Trigger

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(data)[source]

Process the data and returns the events in a pandas dataframe

Parameters:

data – data to be analysed

Returns:

pandas dataframe with all the signals and events

set_trigger(name, up=True)[source]

Set the name of the trigger signal

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

  • up – True if the event is rising

Returns:

None

Shift

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(data)[source]

Process the data and return the table containing the shifts.

Parameters:

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

Returns:

Pandas dataframe containing the pre and post shifts data.

set_post(post, up=False)[source]

Set the post channel used for trigger

Parameters:
  • 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

Parameters:
  • pre – Channel name to be used as trigger

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