@semicolon123 can you share the data? If so someone might be able to take a look. It might just be a case where whoever implemented Persyst support always had a .lay file to get the electrode positions, and we need to make that optional rather than mandatory
Hi @semicolon123,
I think you give wrong file name to the function. According to the docs the fname should be “Path to the Persyst header (.lay) file.” - thats why you get “s01.dat.lay”,does not exist.. If you instead do:
Thank you very much for your suggestions.
I tried both ways that you mentioned. Unfortunately, it still did not work.
Just to let you know my file type is ‘.dat’. I followed their documentation to read a .dat file.
Let me know if you can think of some other solution.
Are you sure this is the persyst data fromat? If you don’t have a .lay file then it might not be persyst (I don’t know, because I never used that format). Maybe you have a brainvision file? Then you would have to use a different reading function.
Can you ask the person/people that you got the data from about how the file was acquired? It’s pretty important to know how the file was made (acquisition machine, processed afterward, etc.). See the FieldTrip docs where they mention .dat in particular as being problematic because it’s used by multiple software packages:
@semicolon123 , I took a look at the data website that you linked. In the data description section they say that the raw data is in bdf format. Only the preprocessed files are in .dat but they provide the following example on how to read them:
import cPickle
x = cPickle.load(open('s01.dat', 'rb'))
Yes, I know that.
But I was wondering if I could use the MNE method to read the .dat file directly so as to create the object.
So, in case I will use the code below to read the files, I believe I will have to use some MNE method to convert the 3d array to mne object for further analysis
import cPickle
x = cPickle.load(open('s01.dat', 'rb'))
Yes, you are right that BioSemi uses BDF to record data. But the patient’s data that has been provided in .dat format is preprocessed & they even re-ordered some readings. Hence, I want to read .dat file instead of reading .bdf & doing the preprocessing myself.
While I can see there is a reader for .bdf files, I cannot seem to get hold of MNE method to read a .dat file.
Can anybody help me to read the output of that EEG signal (.dat) file through python!!!
I am attaching my testing code as well as the output. The desired result or output is completely different than my code’s output. Please any python developer or expert whoever has the knowledge of this kind of reading of datas through .dat file contains EEG signals, please help!!! Really Urgent!!!
My code —>
import numpy as np
import mne
import matplotlib.pyplot as plt
Load EEG data
with open(r"C:\Users\jeetr\Downloads\EEG_template.dat", ‘rb’) as f:
data = f.read()
data_1 = np.frombuffer(data, dtype=np.float32) # convert bytes to float
data_1 = np.reshape(data_1, (1, -1)) # reshape to
The problem is that the need to know more about the file other than that the filename ends in .dat. The .dat stands for just “data” so that doesn’t tell us very much about what is inside the file and how to read it. In the case above, the .dat file was a pickled python file and could be loaded as a numpy array using pickle.load, but I have no idea whether that would be the case for you. So, any details you can provide about where this file came from and how it was made would be helpful.