<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="http://theeyetribe.com/forum/feed.php?f=26" />

<title>The Eye Tribe</title>
<subtitle>Developer Forum</subtitle>
<link href="http://theeyetribe.com/forum/index.php" />
<updated>2016-08-15T14:23:41+02:00</updated>

<author><name><![CDATA[The Eye Tribe]]></name></author>
<id>http://theeyetribe.com/forum/feed.php?f=26</id>
<entry>
<author><name><![CDATA[Anders]]></name></author>
<updated>2016-08-15T14:23:41+02:00</updated>
<published>2016-08-15T14:23:41+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=601&amp;p=2612#p2612</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=601&amp;p=2612#p2612"/>
<title type="html"><![CDATA[Python • Re: Data not recorded properly (PyGaze,EyeTribe)]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=601&amp;p=2612#p2612"><![CDATA[
Based on the pictures you've posted, it seems clear, that the recording software you are using is not taking 'bad frames' into account. It seems that frames are recorded even when there is no tracking.<br /><br />If this is not the functionality you are looking for, then you are free to extend the <a href="https://github.com/esdalmaijer/PyGaze" class="postlink">open source PyGaze</a> repo with the needed functionality. You can also post feature requests on their GitHub page or write the author.<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=120">skataAnders</a> — 15 Aug 2016, 14:23</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Anders]]></name></author>
<updated>2016-08-15T12:46:08+02:00</updated>
<published>2016-08-15T12:46:08+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=627&amp;p=2611#p2611</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=627&amp;p=2611#p2611"/>
<title type="html"><![CDATA[Python • Un-official Python SDKs]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=627&amp;p=2611#p2611"><![CDATA[
The Eye Tribe do not have an official Python SDK implementation. Instead, the community has provided implementations of the open <a href="http://dev.theeyetribe.com/api/" class="postlink">EyeTribe API</a>. Find these (in random order) below:<br /><br /><!-- m --><a class="postlink" href="https://github.com/esdalmaijer/PyTribe">https://github.com/esdalmaijer/PyTribe</a><!-- m --> <br /><br /><!-- m --><a class="postlink" href="https://github.com/sjobeek/pytribe">https://github.com/sjobeek/pytribe</a><!-- m --><br /><br /><!-- m --><a class="postlink" href="https://github.com/baekgaard/peyetribe">https://github.com/baekgaard/peyetribe</a><!-- m --><br /><br /><!-- m --><a class="postlink" href="https://github.com/djsmedes/thepyetribe">https://github.com/djsmedes/thepyetribe</a><!-- m --><p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=120">skataAnders</a> — 15 Aug 2016, 12:46</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[fabien.malassingne@gmail.com]]></name></author>
<updated>2016-04-20T11:25:02+02:00</updated>
<published>2016-04-20T11:25:02+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=601&amp;p=2533#p2533</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=601&amp;p=2533#p2533"/>
<title type="html"><![CDATA[Python • Data not recorded properly (PyGaze,EyeTribe)]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=601&amp;p=2533#p2533"><![CDATA[
Hi everyone,<br /><br />I made an experiment where one has to read a small text in OpenSesame, using PyGaze to record eye movement from the EyeTribe. <br />The problem is: I have a huge loss of data in the resulting .tsv file, as if the eyes were closed (lines of zeroes). Also, if the EyeTribe samplerate is set to 60Hz, the data of almost half the text are not recorded. At 30Hz, this last problem doesn't seem to occur though.<br /><br />I thought it might be an issue with OpenSesame, so I made a script directly in Python using PyGaze. I still have the same problem...<br />If it can help, I made sure that the average calibration error was always smaller than 1, I used multiple computers (but only one EyeTribe).<br /><br />Some images of the scanpaths created with the resulting .tsv:<br /><br />At 30Hz with PyGaze:<br /><img src="http://img.cogsci.nl/uploads/571741e640071.jpg" alt="Image" /><br />And the associated .tsv: <a href="https://drive.google.com/open?id=0BzDY9INkgoAWN1NEa09vQmo3Tmc" class="postlink">https://drive.google.com/open?id=0BzDY9INkgoAWN1NEa09vQmo3Tmc</a><br /><br />At 60Hz with OpenSesame:<br /><img src="http://img.cogsci.nl/uploads/5717415dc5dc7.jpg" alt="Image" /><br />And the asociated .tsv: <a href="https://drive.google.com/open?id=0BzDY9INkgoAWbWtZZW9vS1NpeGs" class="postlink">https://drive.google.com/open?id=0BzDY9INkgoAWbWtZZW9vS1NpeGs</a><br /><br />At 30Hz with OpenSesame:<br /><img src="http://img.cogsci.nl/uploads/571741c60c3e4.jpg" alt="Image" /><br />And the associated .tsv: <a href="https://drive.google.com/open?id=0BzDY9INkgoAWbEIxcWZkRXBBSTQ" class="postlink">https://drive.google.com/open?id=0BzDY9INkgoAWbEIxcWZkRXBBSTQ</a><br /><br />Cheers,<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=8924">skatafabien.malassingne@gmail.com</a> — 20 Apr 2016, 11:25</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Anders]]></name></author>
<updated>2015-02-11T10:05:03+02:00</updated>
<published>2015-02-11T10:05:03+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=405&amp;p=1729#p1729</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=405&amp;p=1729#p1729"/>
<title type="html"><![CDATA[Python • Re: How do I get the 3D head coordinates in Python through t]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=405&amp;p=1729#p1729"><![CDATA[
You should look at fetching pupil coordinates from the frame object as documented by the <a href="http://dev.theeyetribe.com/api/#cat_tracker" class="postlink">API</a><p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=120">skataAnders</a> — 11 Feb 2015, 10:05</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[bdohert]]></name></author>
<updated>2015-01-20T16:32:57+02:00</updated>
<published>2015-01-20T16:32:57+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=405&amp;p=1660#p1660</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=405&amp;p=1660#p1660"/>
<title type="html"><![CDATA[Python • How do I get the 3D head coordinates in Python through the A]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=405&amp;p=1660#p1660"><![CDATA[
I am working with custom software, and I'm attempting to make a &quot;show eyes&quot; function before calibration where you can see if the tracker is picking up on your eyes, and then position yourself correctly with regards to the appropriate distance away from the tracker. This is similar to what the eye tribe UI does, so I'm assuming it can be done? Do you know of an easy way to get these 3D position coordinates (not gaze, but position of the head with regards to the tracker) in Python through the API?<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=6549">skatabdohert</a> — 20 Jan 2015, 16:32</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[pgba@dtu.dk]]></name></author>
<updated>2014-08-14T16:42:09+02:00</updated>
<published>2014-08-14T16:42:09+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=309&amp;p=1278#p1278</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=309&amp;p=1278#p1278"/>
<title type="html"><![CDATA[Python • Updated peyetribe]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=309&amp;p=1278#p1278"><![CDATA[
There now seems to be an abundance of python interfaces to the eye tribe <img src="http://theeyetribe.com/forum/images/smilies/icon_e_smile.gif" alt=":-)" title="Smile" /><br /><br />I have nevertheless updated the peyetribe interface a bit, to make it more robust and maybe also easier to use.<br /><br />It works with both python3 and python2, so you could use it with e.g. the PsychoPy toolbox and others that are not updated to python3 yet. Just copy the peyetribe.py file to the directory where you have your other python files (or install it as a module).<br /><br />It offers a very simple interface, and hides most of the complexity of multiple threads (listener and heartbeat).<br /><br />A very simple use case could be as follows, using the tracker in pull mode:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>from peyetribe import eyetribe<br /><br />tracker = eyetribe()<br />tracker.connect()<br /><br />while True: # or some better condition...<br />    n = tracker.next()<br />    print(str(n))<br /><br />tracker.close()<br /></code></dd></dl><br /><br />Or a more elaborate example, using push mode and relying on multiple synchronised threads and internal queues that ensure you don't loose any data, and only printing the left eye coordinates:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>from peyetribe import eyetribe<br /><br />tracker = eyetribe(host=&quot;your.host&quot;, port=1234)<br />tracker.connect()<br /><br />tracker.pushmode()<br />count = 0<br />while count &lt; 100:<br />    n = tracker.next()<br />    print(&quot;Left: %s&quot; % (str(n.geteye(left=True))))<br />    count += 1<br /><br />tracker.pullmode()<br /><br />tracker.close()</code></dd></dl><br /><br />It can still be found at <!-- m --><a class="postlink" href="https://github.com/baekgaard/peyetribe">https://github.com/baekgaard/peyetribe</a><!-- m --><br /><br />I may still clean up the code a bit; this has evolved some over time and could obviously be made smarter in some places.<br /><br />Comments or ideas for improvement are obviously welcome <img src="http://theeyetribe.com/forum/images/smilies/icon_e_smile.gif" alt=":-)" title="Smile" /><p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=1848">skatapgba@dtu.dk</a> — 14 Aug 2014, 16:42</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MSchulte]]></name></author>
<updated>2014-08-13T16:04:55+02:00</updated>
<published>2014-08-13T16:04:55+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1264#p1264</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1264#p1264"/>
<title type="html"><![CDATA[Python • Re: My take on a Python module]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1264#p1264"><![CDATA[
Enjoy  <img src="http://theeyetribe.com/forum/images/smilies/icon_e_biggrin.gif" alt=":D" title="Very Happy" /><p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=2297">skataMSchulte</a> — 13 Aug 2014, 16:04</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[esdalmaijer]]></name></author>
<updated>2014-08-12T01:56:40+02:00</updated>
<published>2014-08-12T01:56:40+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1256#p1256</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1256#p1256"/>
<title type="html"><![CDATA[Python • Re: Python wrapper]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1256#p1256"><![CDATA[
Thanks for the very good input on the response handling! I've used the tips in the newest version of my wrapper (can be found here: <a href="https://github.com/esdalmaijer/PyTribe" class="postlink">https://github.com/esdalmaijer/PyTribe</a>), which is now integrated in PyGaze (<a href="https://github.com/esdalmaijer/PyGaze" class="postlink">https://github.com/esdalmaijer/PyGaze</a>, see for the specific module: <a href="https://github.com/esdalmaijer/PyGaze/blob/master/pygaze/_eyetracker/libeyetribe.py" class="postlink">https://github.com/esdalmaijer/PyGaze/blob/master/pygaze/_eyetracker/libeyetribe.py</a>).<br /><br />Cheers!<br />Edwin<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=3107">skataesdalmaijer</a> — 12 Aug 2014, 01:56</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[esdalmaijer]]></name></author>
<updated>2014-08-12T01:52:44+02:00</updated>
<published>2014-08-12T01:52:44+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1255#p1255</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1255#p1255"/>
<title type="html"><![CDATA[Python • Re: My take on a Python module]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1255#p1255"><![CDATA[
Looks very good! In return, I'm borrowing that queued responses idea of yours <img src="http://theeyetribe.com/forum/images/smilies/icon_e_wink.gif" alt=";)" title="Wink" /><p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=3107">skataesdalmaijer</a> — 12 Aug 2014, 01:52</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MSchulte]]></name></author>
<updated>2014-08-08T16:18:25+02:00</updated>
<published>2014-08-08T16:18:25+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1242#p1242</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1242#p1242"/>
<title type="html"><![CDATA[Python • Re: My take on a Python module]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1242#p1242"><![CDATA[
Just realized that my code has a sneaky bug in it. Line 211 reads: <dl class="codebox"><dt>Code: </dt><dd><code>self._frame_file.write('{}\n'.format(msg))</code></dd></dl><br /><br />But it should be: <dl class="codebox"><dt>Code: </dt><dd><code>self._frame_file.write('{}\n'.format(raw_msg))</code></dd></dl><br /><br />By recording msg instead of raw_msg to the file, I accidentally made it write a representation of a Python dict, rather than the JSON-formatted string given by the tracker. I will commit a fix in a few hours.<br /><br />I discovered this after trying to parse a bunch of data (that we paid subjects to collect!) and getting repeated JSON errors. I got around it by simply using eval() instead of json.loads() on the saved data.<br /><br />Cheers,<br />Daniel<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=2297">skataMSchulte</a> — 08 Aug 2014, 16:18</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MSchulte]]></name></author>
<updated>2014-08-07T11:57:12+02:00</updated>
<published>2014-08-07T11:57:12+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1234#p1234</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1234#p1234"/>
<title type="html"><![CDATA[Python • My take on a Python module]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=297&amp;p=1234#p1234"><![CDATA[
<!-- m --><a class="postlink" href="https://github.com/djsmedes/thepyetribe">https://github.com/djsmedes/thepyetribe</a><!-- m --><br /><br />I've been working with these trackers for the better part of three months, and after a few different iterations, this is the best way I have come up with for communicating with it.<br /><br />It uses new-style classes, i.e. inheriting from object, and Python's @property and @property.setter decorators to simplify access to the tracker's attributes.<br /><br />It uses a HeartThread to send heartbeats. I specifically don't give the thread access to the socket, but instead pass in an anonymous lambda function that, when called, sends the heartbeat. Not terribly important in this case, but I think in general it's a good idea to compartmentalize, if only so that you are not tempted to write more complex and dangerous code.<br /><br />It uses a ListenerThread to constantly receive data from the socket and put it into a Queue. We split on newlines so that each message the tracker sends is its own item in the Queue, even if they are sent so close together that they pop out of the same socket.recv call. This thread is also passed an anonymous lambda function, lambda: self.socket.recv(BUFSIZE), for reasons similar to the above.<br /><br />It uses a ProcessorThread to take strings from the raw Queue, parse them into dicts, and put them into an appropriate &quot;EyeTribeQueue&quot; or write them to a file. The parsing is achieved in two stages: first, a string.replace call which turns the C error &quot;-1.#IND&quot; into &quot;null&quot; because Python's json module does not know what to do with that C error. If more things like this are observed, more processing will be done in this stage. The second stage is to call json.loads on the string. We then check a few keys in the dict for certain conditions, which determines whether we write the message to a file, put it in one of the EyeTribeQueues, or notify that certain conditions have changed (i.e. display index). Note that when in push mode, frame data will still have a request of &quot;get,&quot; which I am not sure is accurately reflected on the documentation on this website. If that were to change, some changes would need to be made to the logic in this thread.<br /><br />The EyeTribeQueue inherits from LifoQueue, but replaces the normal Queue.get() method with an error message. Instead, you use the new Queue.get_item(request [, values]) method, which will go through the Queue's underlying data structure (a list in this case, which is why we inherited from LifoQueue instead of just Queue) and pull out the message that has the specified request (and values if the request was &quot;get&quot;).<br /><br />There is only one place in the code where socket.send() is called, but multiple threads could conceivably all be trying to do this simultaneously, so we include a threading.Lock object there.<br /><br />I would like to thank Edwin Dalmaijer for sharing his code at <!-- m --><a class="postlink" href="https://github.com/esdalmaijer/PyTribe">https://github.com/esdalmaijer/PyTribe</a><!-- m -->. I got the idea of storing the most recent frame as a &quot;current frame&quot; object from him, and probably a lot of other things were inspired by his code as well.<br /><br />Comments, questions, and critiques welcome!<br /><br />Cheers,<br />Daniel Smedema<br /><br />(MSchulte is not actually me, it's my boss, but he's the one with the account here)<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=2297">skataMSchulte</a> — 07 Aug 2014, 11:57</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MSchulte]]></name></author>
<updated>2014-08-05T10:46:50+02:00</updated>
<published>2014-08-05T10:46:50+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1214#p1214</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1214#p1214"/>
<title type="html"><![CDATA[Python • Re: Python wrapper]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1214#p1214"><![CDATA[
I actually changed the way I was doing things to make use of python's new-style classes and property decorators, which turned out to be quite handy. I also implemented a different way of dealing with command-reply matching: a custom Queue object. It inherits from Queue.LifoQueue, overrides the get() method to return an error, and adds a get_item() method that searches through the Queue and returns an item matching your request (and values if you pass those in as an argument, to distinguish between multiple request: get and request: set commands). <br /><br />I'm not sure that I really NEED the lock anymore because of the changes I have made. I only have one thread ever recv-ing from the socket, but multiple functions that could send. It depends on if socket.send is inherently thread-safe, and I'm not prepared to assume that, so I am leaving in the lock for now.<br /><br />I'll post my whole wrapper some time before next Wednesday <img src="http://theeyetribe.com/forum/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" />.<br /><br />Cheers,<br />Daniel Smedema<br /><br />p.s. MSchulte is actually my boss, if anyone is curious why my name and username are so different.<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=2297">skataMSchulte</a> — 05 Aug 2014, 10:46</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[esdalmaijer]]></name></author>
<updated>2014-07-28T21:16:30+02:00</updated>
<published>2014-07-28T21:16:30+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1174#p1174</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1174#p1174"/>
<title type="html"><![CDATA[Python • Re: Python wrapper]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1174#p1174"><![CDATA[
That's a very good question, and your solution seems more elegant. It's pretty much the result of building on a proof-of-principle script; there was no real design choice behind it.<br /><br />On the Lock: this is something that I still need to implement, but purely due to the hypothetical possibility of receiving the wrong kind of response. I haven't actually had problems with this yet, presumably due to a lower heartbeat frequency.<br /><br />Thanks for the suggestions!<br /><br />EDIT (30-Jul-2014): added the suggested Threading Lock yesterday. Immediately noticed the need for one, as it started raining replies to different commands (currently working on a command-reply matching strategy). Thanks again!<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=3107">skataesdalmaijer</a> — 28 Jul 2014, 21:16</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MSchulte]]></name></author>
<updated>2014-07-04T14:11:36+02:00</updated>
<published>2014-07-04T14:11:36+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1082#p1082</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1082#p1082"/>
<title type="html"><![CDATA[Python • Re: Python wrapper]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1082#p1082"><![CDATA[
Looks quite nice!<br /><br />I've been working on something similar, though I have been focusing more on getting the specific things I need for my project working and not on creating a complete wrapper like you have. I did things a bit differently--I created classes HeartThread and ListenerThread, for example, instead of functions that need to be called as the target of a thread.<br /><br />I've been sort of hacking this code together with no regard for style guidelines, but in the next few weeks I intend to clean it up and post it here.<br /><br />In the mean time, I'm curious--why don't you use the json.dumps function in your connection.create_json method? I have this function, for example:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>def send_message(self, category, request=None, values=None):<br />    '''returns the reply in a dict'''<br />        <br />    to_send = {}<br />    to_send&#91;u'category'&#93; = category<br />    if request is not None: <br />        to_send&#91;u'request'&#93; = request<br />    if values is not None:<br />        to_send&#91;u'values'&#93; = values<br />    to_send = json.dumps(to_send)<br />    with self.lock:<br />        self.socket.send(to_send)<br />        reply = self.socket.recv(BUFSIZE)<br />    return json.loads(reply)<br /></code></dd></dl><br /><br />I'm also using a threading.Lock() object, which is self.lock in the code above, for thread safety. I kept receiving heartbeat replies when I was trying to retrieve frame data before I added that. here's my HeartThread class (excuse the lack of documentation--will add it soon):<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>class HeartThread(threading.Thread):<br />    <br />    <br />    def __init__(self, et_socket, socket_lock):<br />        super(HeartThread, self).__init__()<br />        self._stop = threading.Event()<br />        self.socket = et_socket<br />        self.lock = socket_lock<br />        <br />    def stop(self):<br />        self._stop.set()<br />        <br />    def run(self, interval=0.250):<br />        while not self._stop.is_set():<br />            with self.lock:<br />                self.socket.send('{&quot;category&quot;:&quot;heartbeat&quot;}')<br />                logging.debug('Heartbeat reply: {}'.format(self.socket.recv(BUFSIZE)))<br />            sleep(interval)<br /><br /># example call<br />heart_thr = HeartThread(self.socket, self.lock)<br />heart_thr.run()<br /></code></dd></dl><p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=2297">skataMSchulte</a> — 04 Jul 2014, 14:11</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[esdalmaijer]]></name></author>
<updated>2014-07-01T02:33:44+02:00</updated>
<published>2014-07-01T02:33:44+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1067#p1067</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1067#p1067"/>
<title type="html"><![CDATA[Python • Python wrapper]]></title>

<category term="Python" scheme="http://theeyetribe.com/forum/viewforum.php?f=26" label="Python"/>
<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1067#p1067"><![CDATA[
Hi guys,<br /><br /><!-- m --><a class="postlink" href="https://github.com/esdalmaijer/PyTribe">https://github.com/esdalmaijer/PyTribe</a><!-- m --> is a first attempt at creating a decent Python wrapper. The current classes are for simple communication with the eye tracker by using methods, which saves you from continuously having to send and parse JSON messages.<br /><br />I plan to write an EyeTribe class on top of this soon, with higher level methods (e.g. 'calibrate', 'validate', 'drift_check', 'start_recording', 'stop_recording' etc., much like these: <!-- m --><a class="postlink" href="https://github.com/esdalmaijer/PyGaze/tree/master/pygaze/_eyetracker">https://github.com/esdalmaijer/PyGaze/t ... eyetracker</a><!-- m -->). But please do have a go at testing the current classes; any feedback is welcome!<br /><br />Best,<br />Edwin<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=3107">skataesdalmaijer</a> — 01 Jul 2014, 02:33</p><hr />
]]></content>
</entry>
</feed>