open-ephys / open-ephys-python-tools

Python code for interacting with the Open Ephys GUI
MIT License
29 stars 18 forks source link

OSError: No available data format detected. #7

Open Aryo-Zare opened 3 years ago

Aryo-Zare commented 3 years ago

Hi

Thanks for creating this tool. I would like to use it for a preliminary analysis (evoked potentials or PSTH from MUA, hence no spike sorting).

I installed it in my anaconda python environment. Yet I have problem using it. When I create a session I get an error message (below). I'm not sure if it's related to how I address to the recording directory. The recorded data is in binary format.

from open_ephys.analysis import Session
directory = 'D:\rec\2021-10-22\3\2021-10-22_12-21-09'
session = Session(directory)

Traceback (most recent call last):

  File "<ipython-input-18-3442c9729491>", line 1, in <module>
    session = Session(directory5)

  File "C:\Users\azare\Anaconda3\lib\site-packages\open_ephys\analysis\session.py", line 59, in __init__
    self._detect_record_nodes()

  File "C:\Users\azare\Anaconda3\lib\site-packages\open_ephys\analysis\session.py", line 73, in _detect_record_nodes
    self.recordings = RecordNode(self.directory).recordings

  File "C:\Users\azare\Anaconda3\lib\site-packages\open_ephys\analysis\recordnode.py", line 57, in __init__
    self._detect_format()

  File "C:\Users\azare\Anaconda3\lib\site-packages\open_ephys\analysis\recordnode.py", line 77, in _detect_format
    raise(IOError('No available data format detected.'))

OSError: No available data format detected.
Aryo-Zare commented 3 years ago

Hello Again

I copied the main directory ('2021-10-22_12-21-09') directly in python's current working directory.

from open_ephys.analysis import Session
directory = '2021-10-22_12-21-09'
session = Session(directory)

And the command was executed successfully. Hence this issue is resolved. But I'm still curious to find out why the previous command is not functional !!

jsiegle commented 3 years ago

Try making the data directory an "r" string, like this:

r'D:\rec\2021-10-22\3\2021-10-22_12-21-09'

Otherwise it will treat the backslashes as escape characters, and won't recognize the directory.