Transfer recording data into an array using Python

Discussion in 'X4M03' started by Kyle, Jul 3, 2018.

  1. Kyle

    Kyle New Member

    Using an X4M03 module, I recorded data using the example XEP_plot_record_playback. It saved an output file as xethru_recording_date_time.dat and a meta file. How can I see use Python to obtain the float data in the .dat file and put it into an array.
    I understand it is supposed to be float data types but I cannot view the data as floats either.

    Thank you
  2. Aksel Johnsby

    Aksel Johnsby Moderator Staff Member

    Hi Kyle,
    To see the data recorded with XEP you can use the playback class. This can be done with the same example you used for recording, There are several ways of storing the data. I would not recomend storing all the data in an array due to the sheer amount of data you will receive in a short time, but writing the data to a .txt file or a .csv file will allow for a easy access and "limitless" storing capacity. For example:

    import numpy as np
    import csv


    d = xep.read_message_data_float()
    frame =np.array( #this is how you put float_datatype in arrays

    Have a great day :)
  3. Kyle

    Kyle New Member

    Thanks for your response.
    I tried running your code but I get an error saying NameError: name 'xep' is undefined
    How so?
  4. Aksel Johnsby

    Aksel Johnsby Moderator Staff Member

    XEP and other classes can be imported through pymoduleconnector:
    import pymoduleconnector

    The code I sent in the previous post is just a crude example on how to store data to csv, not a complete script. I suggest you implement this method(or something similar) in the example to get what you are looking for.

    If you haven't already I suggest you take a look at the "XeThru Sensors Introduction" application note.

    Have a great day!
  5. Ash

    Ash New Member

    @Aksel Johnsby ; Hi, my doubt is related to same thread. I have recorded the data using x4m03 module. I played back the recorded data using python class well. which shows the plot data.
    I wish to read the data matrix usng matlab. Could you please let me know the way to do so or any similar example i can try on my recorded data. Thanks
  6. Charlie Shao

    Charlie Shao Moderator Staff Member