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

Add support for multi-source messages and signal filtering based on source information #209

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions mdfreader/mdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class MdfSkeleton(dict):

def __init__(self, file_name=None, channel_list=None, convert_after_read=True,
filter_channel_names=False, no_data_loading=False,
compression=False, convert_tables=False, metadata=2):
compression=False, convert_tables=False, metadata=2, source_list=None):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What type is actually expected, List or Set of strings ? From the modifications you propose, I think Set is more suitable as there is no need for ordering. It will allow more performing search than List.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate your insights, and I've taken note of the comment in the code. I've already incorporated the suggested changes. If there's anything more you'd like me to address or if you have further recommendations, please feel free to let me know. I value your input and am open to any additional guidance you may have.

""" mdf_skeleton class constructor.

Parameters
Expand Down Expand Up @@ -123,6 +123,10 @@ def __init__(self, file_name=None, channel_list=None, convert_after_read=True,
convert_tables : bool, optional, default False
flag to convert or not only conversions with tables.
These conversions types take generally long time and memory.

source_list: list, optional, default None
list containing the source messages to identify what device send the
different message.
"""
self.masterChannelList = OrderedDict()
# flag to control multiprocessing, default deactivate,
Expand Down Expand Up @@ -152,7 +156,8 @@ def __init__(self, file_name=None, channel_list=None, convert_after_read=True,
filter_channel_names=filter_channel_names,
no_data_loading=no_data_loading,
compression=compression,
metadata=metadata)
metadata=metadata,
source_list=source_list)

def add_channel(self, channel_name, data, master_channel, master_type=1, unit='', description='', conversion=None,
info=None, compression=False, identifier=None):
Expand Down
Loading