ratal / mdfreader

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

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

Open Monicadepucchio opened 7 months ago

Monicadepucchio commented 7 months ago

The purpose of this Pull Request is to enhance our understanding of the source message for different signals in our application. In our application, the source message is closely tied to the device used for signal acquisition. In certain cases, the device used for acquisition aligns with the source of the message. For instance, consider a signal named "speed". In addition to the signal itself, it is important to know the source message, which corresponds to the acquisition device. All the changes made have been carried out in parallel to the normal code flow. The code changes are as follows:

  1. Mdf.py: We have added a new input called "source_list" (default is None). It is a string list with all the sources’ messages. Is not crucial that either it has the same signal list length or the source name has a unique occurrence
  2. Mdfinfo4: We have introduced a boolean variable called "multi-source". This variable is created at runtime. By default, it is set to False, but if there is a source list in the Mdf class, it becomes True. In cases where multi-source is True, the signal name will include the source information only if it is a time channel. Otherwise, only the signal name is considered. This information is appended when the signal is saved. Additionally, for MDF 4.x versions, it is now possible to filter signals based on their source information.
  3. MDF4reader: If the source list is present in the mdf class, the information block from the file is organized based on the different source messages. This allows us to match any signal with its corresponding source message (i.e., the device it comes from). We have excluded the occurrence of the source message in the source list, focusing solely on the time channel. The variable "own_source" describes the source message. If the evaluated channel is not a time channel and the source list is not None, the source message information is concatenated to the signal name string.