Skip to main content

A Python package to extract signals from MDF4 files.

Project description

mf4-parser

To extract set of signals from a MDF4 (mf4) files

Features

* Create __mdfSubset__ in two ways
	* Instantiate with a list of 'asammdf.Signals'
	* Create a new subset from a larger MDF(.mf4) file with a list of signals in csv 
* Concatinate two mdfSubsets to create a new file (joins the each signals)
* Get timestamps (start,end) of a mdfSubset object
* Get the name of the signals in the mdfSubset
* Get the sample size of a signal in the mdfSubset
* Resample the signals in the mdfSubset to a different timestep
* Create a list of pandas-series objects (timestamps,samples) with the signals in the mdfSubset
* Create a data table with signals in the mdfSubset
* Export signals in the mdfSubset to a csv file 

Requirements

- Python >=3.7

Installation

pip

pip install mf4parser

git

clone the repo [mf4parser](https://github.com/sridhar-eswaran/mf4-parser.git)

Examples

`

#Create a subset from a larger MF4 file
from mf4parser import mdfSubset as ms
#select mf4 file
mf4_file1 = r'C:\users\sridhar\files\measurementFile01.MF4'
mf4_file2 = r'C:\users\sridhar\files\measurementFile02.MF4'
#select the signal list (csv) file containg list of signals to be extracted (sample can be found in repo)
signalList = r'C:\users\sridhar\files\signalList.csv'
# create a subset
subset1 = ms.createSubset(mf4_file1,signalList)

`

#to get the info of a subset
subset1.getTimestamps()

OUTPUT: [0.060000000, 299.900000000]

subset1.getSignalNames()

OUTPUT: ['Vx', 'Vy', 'Ax', 'Ay']

subset1.getSamplesize('Ax')

OUTPUT: 2500

#create another subset
subset2 = ms.createSubset(mf4_file2,signalList)
## to get the info of a subset
subset2.getTimestamps()

OUTPUT: [299.910000000, 600.100000000]

subset2.getSignalNames()

OUTPUT: ['Vx', 'Vy', 'Ax', 'Ay']

subset2.getSamplesize('Ax')

OUTPUT: 2508

# concatinate subset files
subset12 = ms.mdfConcat(subset1,subset2,'newSubsetname')

`

## Concatinated subset info
subset12.getTimestamps()

OUTPUT: [0.060000000, 600.100000000]

subset12.getSignalNames()

OUTPUT: ['Vx', 'Vy', 'Ax', 'Ay']

subset12.getSamplesize('Ax')

OUTPUT: 5008

# create data series from a subset (creates a pandas series of signals (TimeStamps Vs SampleValue)
dataseries = subset12.createDataSeries()

# Create data table from a subset (creates a pandas data frame (Timestamps | signal1 | signal2 | signal3))
timestep_to_resample = 0.02 # 20milliseconds
dataTable = subset12.createDataTable(timestep_to_resample) 

# export subset to a csv
subset12.exportCSV(timestep_to_resample,'csvFile.csv')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mf4parser-1.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mf4parser-1.2-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file mf4parser-1.2.tar.gz.

File metadata

  • Download URL: mf4parser-1.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7

File hashes

Hashes for mf4parser-1.2.tar.gz
Algorithm Hash digest
SHA256 59b9c39128bd9cddb304e06f6582aaedae8449fbdd62f77a32c56a92a37a6e65
MD5 f21de5059f090147196c1a8e75347771
BLAKE2b-256 8018079ab05b20d05b9b8d78c83431c1a5ed99b0295dd054817de1f6a772c7f5

See more details on using hashes here.

File details

Details for the file mf4parser-1.2-py3-none-any.whl.

File metadata

  • Download URL: mf4parser-1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7

File hashes

Hashes for mf4parser-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 52c1e5a61134878c35fa88430641c91898b4553c22baeeafa87ae752198d8ca6
MD5 b81880eefbfbe934769dd18de0467ab6
BLAKE2b-256 fd68b71b417a405a2053246205d27154c7f76bc1edfd2df516bef5e82ae18cd0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page