Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asammdf cut function modifying signal values #1084

Open
gauravnaik001 opened this issue Oct 1, 2024 · 3 comments
Open

Asammdf cut function modifying signal values #1084

gauravnaik001 opened this issue Oct 1, 2024 · 3 comments

Comments

@gauravnaik001
Copy link

Python version

'python=3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]'
'os=Linux-5.15.0-1071-azure-x86_64-with-glibc2.35'
'numpy=1.23.5'
'asammdf=8.0.0'

MDF version

4.10

Code snippet

Cannot share the code unfortunately.

Traceback

No code error observed.

Description

We are using the asammdf cut function to cut the mf4 file based on the timestamps, once the file is cut we use the asammdf save function to save the cut files. When we read both the cut files, we observed that few of the signal values in one of the cut file were modified.

For example, given a mf4 file (containing a mixture of 10 hz and 1 hz signal data) containing multiple signals and timestamps from 0.0588730000000000 till 16906.0588730000017677.
Using asammdf cut function, the file was cut from timestamp - 0.0588730000000000 to 8447.8588720000007015 to create the first file and timestamp - 8447.7500000000000000 to 16905.9588729999995849 to create the second file. We observed in the first cut file, for around 4-5 signals, the values were changed/modified. Ex, the float signal values which were previously 7.0 is changed to 0.0, the string values are changed to null.
We checked this for different version of asammdf, the result is the same. For different mf4 file, the signals which get modified are different, but always the file which is cut where the start = None and end = random timestamp(which is not None) is the file where the signals are modified.

This does not happen if the file is cut and both the start and stop timestamp is None, here the signal values are not modified, but the channel object containing the lower_limit and upper_limit values are reset to 0.

Please let me know if you need any more information.

@danielhrisca
Copy link
Owner

please send a demo file, the cut arguments and the signal name

@gauravnaik001
Copy link
Author

Hi, thanks for the quick response. Regarding the demo file and the signal names, I would have to check with my team if it can be shared, meanwhile I have attached a snippet of the cut function which we are using.

Code

for idx, signal_time_slice in enumerate(split_timestamp):
signal_start = None if idx == 0 else float(signal_time_slice[0])
signal_stop = None if idx+1 == split_len else float(signal_time_slice[-1])
mdf_new_file = mdf_original_file.cut(start=signal_start, stop=signal_stop, include_ends = True)
mdf_new_file.save(file_location, overwrite = True, compression = 2)

Here split_timestamp contains a nested list, inside which, each list contains a subset of the timestamp values which we use in signal_start and signal_end to cut the mf4 file and then save it using the save function. For example, given a set of timestamp such as 0.0588730000000000 till 16906.0588730000017677, the first mdf object will be created by using cut function from 0.0588730000000000 to 8447.6588720000007015 and second mdf object will be created by using cut function from 8447.7500000000000000 to 16905.9588729999995849, and then both the files are saved. The split_timestamp list is separately calculated.

I have also shared the screenshots of the signal values(signal names have been masked) as seen in the original file, the first split file (where the signal values are modified), the second split file(where the signal values are not modified) via mail to you.

Thanks again, and please let me know if you need any more information.

@gauravnaik001
Copy link
Author

Hi Daniel, just wanted to check if you got a chance to review the code, screenshots and the demo mf4 file I shared ? Do let me know if you need any additional information. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants