ratal / mdfreader

Read Measurement Data Format (MDF) versions 3.x and 4.x file formats in python
Other
169 stars 74 forks source link

Export/split part of the mdf file #87

Closed TJ072175 closed 6 years ago

TJ072175 commented 7 years ago

eg: I have a mdf file of 1 hours of data and I want to export the first 10 mins of the data and save it in a new file. Is it possible to do that?

ratal commented 7 years ago

Hi, I am afraid there is no turn key solution for that, you will have to script a bit for it. Depending what format you want to export to, but if matlab or hdf5 is ok, I think most easy and convienient way would be to convert in pandas and apply pandas.DataFrame.between_time() and then .to_hdf() for each raster/datagroup. Otherwise if you want to stick to mdf, you will have to iterate in all channels to change data array according to your new time (channels are group by time in attribute .masterChannelList) and then write in mdf. You can get inspired of code by looking at resample method in mdfreader.py

ratal commented 7 years ago

Hi, I made a quick implementation of cutting method in latest commit. You could try it the following: import mdfreader yop=mdfreader.mdf(fileName) yop.cut(25, 75) yop.write()