<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.bci2000.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=User_Reference%3APython_FileLoader</id>
	<title>User Reference:Python FileLoader - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.bci2000.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=User_Reference%3APython_FileLoader"/>
	<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=User_Reference:Python_FileLoader&amp;action=history"/>
	<updated>2026-06-27T12:45:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=User_Reference:Python_FileLoader&amp;diff=8117&amp;oldid=prev</id>
		<title>Madamek: Created page with &quot;== Introduction == The [https://github.com/markusadamek/BCI2kReader BCI2kReader] package allows to read BCI2000 .dat files in Python. The reader is written completely in pytho...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=User_Reference:Python_FileLoader&amp;diff=8117&amp;oldid=prev"/>
		<updated>2019-01-15T21:59:42Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Introduction == The [https://github.com/markusadamek/BCI2kReader BCI2kReader] package allows to read BCI2000 .dat files in Python. The reader is written completely in pytho...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Introduction ==&lt;br /&gt;
The [https://github.com/markusadamek/BCI2kReader BCI2kReader] package allows to read BCI2000 .dat files in Python. The reader is written completely in python and works with python 2 and python 3. &lt;br /&gt;
&lt;br /&gt;
== Installing the package==&lt;br /&gt;
&lt;br /&gt;
The package can either be installed with the python package manager (pip) or you can download the latest version from [https://github.com/markusadamek/BCI2kReader GitHub].&lt;br /&gt;
&lt;br /&gt;
To install the package via pip:&lt;br /&gt;
&lt;br /&gt;
 pip install BCI2kReader&lt;br /&gt;
&lt;br /&gt;
To get the latest (development) version from GitHub&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/markusadamek/BCI2kReader&lt;br /&gt;
&lt;br /&gt;
To Install the development version move to the cloned directory and run:&lt;br /&gt;
 pip install .&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
To use the reader you have to create a BCI2kReader object, which inherits from [https://docs.python.org/3/library/io.html#io.IOBase io.IOBase]. The reader has two basic modes, caching and non-caching. In caching mode, the BCI2kReader object will retain the data in memory as soon as a full readout of the file has taken place. If you need to save memory, the BCI2kReader object also supports that all read operations are done directly from the file. &lt;br /&gt;
&lt;br /&gt;
=== Reading a File ===&lt;br /&gt;
The simplest way to open a file is with pythons with command (see https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects for more information about file IO and the with statement).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 from BCI2kReader import BCI2kReader as b2k&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 with b2k.BCI2kReader(&amp;#039;yourbci2000testfile.dat&amp;#039;) as file:&lt;br /&gt;
&lt;br /&gt;
if you want to open the file without caching enabled:&lt;br /&gt;
&lt;br /&gt;
 with b2k.BCI2kReader(&amp;#039;yourbci2000testfile.dat&amp;#039;, False) as file:&lt;br /&gt;
&lt;br /&gt;
It is also possible to clear the cache to free memory:&lt;br /&gt;
       file.purge()&lt;br /&gt;
&lt;br /&gt;
=== Getting Data from the object ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to get the data is to use the properties for signals and states. The signals are provided as a [https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.ndarray.html numpy ndarray] with the dimensions (channels, samples). The states are provided as a StateDictionary which inherits from [https://docs.python.org/3/tutorial/datastructures.html#dictionaries dict] with the state name as key.&lt;br /&gt;
&lt;br /&gt;
    eeg_data = file.signals&lt;br /&gt;
    states = file.states&lt;br /&gt;
&lt;br /&gt;
=== Working with random access ===&lt;/div&gt;</summary>
		<author><name>Madamek</name></author>
	</entry>
</feed>