Skip to content

Commit

Permalink
Merge pull request #212 from LaurentBlanc73/master
Browse files Browse the repository at this point in the history
 check for native endianness
  • Loading branch information
ratal committed May 27, 2024
2 parents 2cace6d + 6da974f commit b4f6993
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mdfreader/mdfreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1529,11 +1529,15 @@ def return_pandas_dataframe(self, master_channel_name):
temporary_dataframe = pd.DataFrame(index=self.get_channel_data(master_channel_name))
else: # no master channel
temporary_dataframe = pd.DataFrame()
for channel in self.masterChannelList[master_channel_name]:
data = self.get_channel_data(channel)
channel_dict = {key: None for key in self.masterChannelList[master_channel_name]}
for key, value in channel_dict.items():
data = self.get_channel_data(key)
if data.dtype.byteorder not in ['=', '|']:
data = data.byteswap().newbyteorder()
if data.ndim == 1 and data.shape[0] == temporary_dataframe.shape[0] \
and not data.dtype.char == 'V':
temporary_dataframe[channel] = data
value = data
temporary_dataframe = pd.DataFrame(data=channel_dict, index=temporary_dataframe.index)
return temporary_dataframe
else:
warn('Master channel name not in mdf')
Expand Down

0 comments on commit b4f6993

Please sign in to comment.