Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
\#*
.emacs*
old
test
zzz_old
doc/_build
doc/_build
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: python
virtualenv:
system_site_packages: true
python:
- "2.7"
before_install:
- sudo apt-get install python-numpy python-pyside python-matplotlib python-h5py
- export PYTHONPATH=$PYTHONPATH:~/taskontrol

#command to install dependencies
# command to run tests
script: nosetests
15 changes: 6 additions & 9 deletions README.txt → README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
______________

TASKontrol
______________

![](https://travis-ci.org/nickponvert/taskontrol.svg?branch=master)
#TASKontrol

TASKontrol is a framework for developing behavioral experiments.

Expand All @@ -20,10 +17,10 @@ maintained by the Brody Lab) and the state machine for Linux+RTAI,
originally developed at Cold Spring Harbor Laboratory.

TASKontrol provides the following advantages:
- No need for a Windows license, it runs easily on Linux.
- No need for a Matlab license, it is written in Python.
- No need for multiple computers, when used with the Arduino server.
- An appealing graphical interface, it uses Qt.
* No need for a Windows license, it runs easily on Linux.
* No need for a Matlab license, it is written in Python.
* No need for multiple computers, when used with the Arduino server.
* An appealing graphical interface, it uses Qt.

You can find the full documentation at:
http://taskontrol.readthedocs.org
Expand Down
38 changes: 24 additions & 14 deletions core/arraycontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,45 @@
__version__ = '0.1'
__author__ = 'Santiago Jaramillo <sjara@uoregon.edu>'


from taskontrol.core import utils


class Container(dict):
def __init__(self):
super(Container, self).__init__()
super(Container, self).__init__()
self.labels = dict()
###self.currentTrial = 0
def append_to_file(self, h5file,currentTrial):

def append_to_file(self, h5file, currentTrial):
'''Returns True if successful '''
if currentTrial<1:
raise UserWarning('WARNING: No trials have been completed or currentTrial not updated.')
if currentTrial < 1:
raise UserWarning('WARNING: No trials have been completed or\
currentTrial not updated.')
resultsDataGroup = h5file.require_group('resultsData')
resultsLabelsGroup = h5file.require_group('resultsLabels')
for key,item in self.iteritems():
dset = resultsDataGroup.create_dataset(key, data=item[:currentTrial])
for key,item in self.labels.iteritems():
for key, item in self.iteritems():
dset = resultsDataGroup.create_dataset(key,
data=item[:currentTrial])
for key, item in self.labels.iteritems():
# FIXME: Make sure items of self.labels are dictionaries
utils.append_dict_to_HDF5(resultsLabelsGroup,key,item)
utils.append_dict_to_HDF5(resultsLabelsGroup, key, item)


def main():

'''When executed as a script, create test array container and write the
data to an h5 file'''

if __name__ == "__main__":
import h5py
import numpy as np
c = Container()
c['myvar1'] = np.arange(10)
c.labels['myvar2labels'] = {'yes':1,'no':0}
c['myvar2'] = np.array([0,1,1,1,0])
h5file = h5py.File('/tmp/testh5.h5','w')
c.labels['myvar2labels'] = {'yes': 1, 'no': 0}
c['myvar2'] = np.array([0, 1, 1, 1, 0])
h5file = h5py.File('/tmp/testh5.h5', 'w')
h5file.create_group('resultsData')
c.append_to_file(h5file,4)
c.append_to_file(h5file, 4)
h5file.close()

if __name__ == "__main__":
main()
Loading