{ "info": { "author": "Akseli Palen", "author_email": "akseli.palen@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Bio-Informatics", "Topic :: Scientific/Engineering :: Human Machine Interfaces", "Topic :: Scientific/Engineering :: Image Recognition", "Topic :: Scientific/Engineering :: Information Analysis" ], "description": "==============\r\ngazeclassifier\r\n==============\r\n\r\nThe Python package *gazeclassifier* provides functions to decide if given gaze points represent a saccade, fixation, or some unknown pattern.\r\n\r\nThe package *gazeclassifier* is developed at `Infant Cognition Laboratory\r\n`_ at University of Tampere.\r\n\r\n\r\n\r\n1. Install\r\n==========\r\n\r\nWith `pip\r\n`_::\r\n\r\n $ pip install gazeclassifier\r\n\r\nCompatible with Python 2.6, 2.7, 3.3, 3.4, and 3.5.\r\n\r\n\r\n\r\n2. Usage\r\n========\r\n\r\nImport the lib::\r\n\r\n >>> import gazeclassifier as gaze\r\n\r\nDefine gaze points as pointlists::\r\n\r\n >>> g1 = [[0,0], [0,0], [1,1], [2,2], [2,2]] # a saccade\r\n >>> g2 = [[1,1], [1,1], [1,1], [1,1], [1,1]] # a fixation\r\n >>> g3 = [[1,1], [2,2], [0,0], [4,4], [1,1]] # an unknown\r\n\r\nCreate a classifier. It is already pretrained and therefore able to ``predict``::\r\n\r\n >>> gc = gaze.GazeClassifier()\r\n >>> gc.predict(g1)\r\n 'saccade'\r\n >>> gc.predict(g2)\r\n 'fixation'\r\n >>> gc.predict(g3)\r\n 'unknown'\r\n\r\nInternally, ``predict`` first extracts features from pointlists before classification. The features can be extracted explicitly with ``extract_features`` and ``extract_raw_features``::\r\n\r\n >>> gaze.extract_features(g1)\r\n {\r\n 'saccade_reaction': 1,\r\n 'saccade_duration': 3,\r\n 'saccade_mse': 0.000623,\r\n 'fixation_mse': 0.232406\r\n }\r\n\r\n >>> gaze.extract_raw_features(g1)\r\n {\r\n 'saccade': {\r\n 'source_points': [[0,0]],\r\n 'saccade_points': [[0,0], [1,1], [2,2]],\r\n 'target_points': [[2,2]],\r\n 'mean_squared_error': 0.000623\r\n },\r\n 'fixation': {\r\n 'centroid': [[1.0,1.0]]\r\n 'mean_squared_error': 0.232406,\r\n }\r\n }\r\n\r\nAs an alternative for using the default pretrained classifier, you can train one::\r\n\r\n >>> training_data = [g1, g2, g3]\r\n >>> classes = ['saccade', 'fixation', 'unknown']\r\n >>> gc = gaze.GazeClassifier()\r\n >>> gc.fit(training_data, classes)\r\n\r\nThe trained classifier has same API as the default::\r\n\r\n >>> gc.predict(g1)\r\n 'saccade'\r\n\r\n\r\n\r\n3. API\r\n======\r\n\r\n3.1. gazeclassifier.predict(pointlist)\r\n--------------------------------------\r\n\r\nParameters:\r\n\r\n- pointlist: a list of [x, y] points i.e. a list of lists\r\n\r\n - OR alternatively the result dict from ``extract_features``.\r\n This is convenient if you need access to the features and want to\r\n prevent ``predict`` to re-extract them.\r\n\r\nReturn a string which can be one of the following:\r\n\r\n- ``'saccade'``: gaze travels from point A to B and otherways stays still\r\n- ``'fixation'``: gaze has mainly stayed still\r\n- ``'unknown'``: gaze cannot be regarded as any of the above\r\n\r\n\r\n3.2. gazeclassifier.extract_features(pointlist)\r\n-----------------------------------------------\r\n\r\nParameters:\r\n\r\n- pointlist: a list of [x, y] points i.e. a list of lists\r\n\r\nReturn a dict that contains mean error and details for each hypothesis. The dict can be fed into ``classify`` for classification.\r\n\r\n\r\n3.3. gazeclassifier.extract_raw_features(pointlist)\r\n---------------------------------------------------\r\n\r\nParameters:\r\n\r\n- pointlist: a list of [x, y] points i.e. a list of lists\r\n\r\nReturn a dict that contains mean error and details for each hypothesis. The dict can be fed into ``predict`` for classification.\r\n\r\n\r\n3.4. gazeclassifier.GazeClassifier()\r\n------------------------------------\r\n\r\nA new untrained classifier.\r\n\r\n3.5. gazeclassifier.GazeClassifier#fit(pointlists, classes)\r\n-----------------------------------------------------------\r\n\r\n3.6. gazeclassifier.GazeClassifier#predict(pointlist_or_features)\r\n-----------------------------------------------------------------\r\n\r\n\r\n3.7. gazeclassifier.version\r\n---------------------------\r\n\r\nThe current version string::\r\n\r\n >>> gazeclassifier.version\r\n '1.2.3'\r\n\r\n\r\n\r\n4. For developers\r\n=================\r\n\r\nTips for the developers of the package.\r\n\r\n\r\n4.1. Use Git\r\n------------\r\n\r\nTo develop, clone the repository from GitHub::\r\n\r\n $ git clone https://github.com/infant-cognition-tampere/gazeclassifier-py\r\n\r\nMake changes to files, add them to commit, and do commit::\r\n\r\n (edit README.rst)\r\n $ git add README.rst\r\n $ git commit -m \"Improved documentation\"\r\n\r\nList files that are not added or not committed::\r\n\r\n $ git status\r\n\r\nPush local commits to GitHub::\r\n\r\n $ git push\r\n\r\nIgnore some files by editing ``.gitignore``::\r\n\r\n $ nano .gitignore\r\n\r\n\r\n4.2. Virtualenv\r\n---------------\r\n\r\nManage python versions and requirements by using virtualenv::\r\n\r\n $ virtualenv -p python3.5 gazeclassifier-py\r\n $ cd gazeclassifier-py\r\n $ source bin/activate\r\n ...\r\n $ deactivate\r\n\r\n\r\n4.3. Testing\r\n------------\r\n\r\nFollow `instructions to install pyenv\r\n`_ and then either run quick tests::\r\n\r\n $ python3.5 setup.py test\r\n\r\nor run comprehensive tests for multiple Python versions listed in ``tox.ini``::\r\n\r\n $ pyenv local 2.6.9 2.7.10 3.3.6 3.4.3 3.5.0\r\n $ eval \"$(pyenv init -)\"\r\n $ pyenv rehash\r\n $ tox\r\n\r\nInstall new pyenv environments for example by::\r\n\r\n $\u00a0pyenv install 3.5.0\r\n\r\nValidate README.rst at `http://rst.ninjs.org/\r\n`_\r\n\r\n\r\n4.4. Publishing to PyPI\r\n-----------------------\r\n\r\nFollow `python packaging instructions\r\n`_:\r\n\r\n1. Create an unpacked sdist: ``$ python setup.py sdist``\r\n2. Create a universal wheel: ``$ python setup.py bdist_wheel --universal``\r\n3. Go to `PyPI and register the project by filling the package form\r\n `_ by uploading\r\n ``gazeclassifier.egg-info/PKG_INFO`` file.\r\n4. Upload the package with twine:\r\n\r\n 1. Sign the dist: ``$ gpg --detach-sign -a dist/gazeclassifier-1.2.3*``\r\n 2. Upload: ``twine upload dist/gazeclassifier-1.2.3*`` (will ask your PyPI password)\r\n\r\n5. Package published!\r\n\r\nUpdating the package takes same steps except the 3rd.\r\n\r\n\r\n4.5 Version release\r\n-------------------\r\n\r\n1. Change version string in ``gazeclassifier/version.py`` and ``setup.py`` to\r\n ``'1.2.3'``\r\n2. Run tox tests. See *4.3. Testing*.\r\n3. Git commit: ``$ git commit --all -m \"v1.2.3 release\"``\r\n4. Create tag: ``$ git tag -a 1.2.3 -m \"v1.2.3 stable\"``\r\n5. Push commits and tags: ``$ git push && git push --tags``\r\n6. Publish to PyPI. See *4.4. Publishing to PyPI*.\r\n\r\n\r\n\r\n5. Versioning\r\n=============\r\n\r\n`Semantic Versioning 2.0.0\r\n`_\r\n\r\n\r\n\r\n6. License\r\n==========\r\n\r\n`MIT License\r\n`_", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/infant-cognition-tampere/gazeclassifier-py", "keywords": "eye-tracking classifier saccade fixation", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "gazeclassifier", "package_url": "https://pypi.org/project/gazeclassifier/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/gazeclassifier/", "project_urls": { "Homepage": "https://github.com/infant-cognition-tampere/gazeclassifier-py" }, "release_url": "https://pypi.org/project/gazeclassifier/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Decides whether given gaze points represent a saccade, fixation, or some unknown pattern", "version": "0.1.0" }, "last_serial": 1857404, "releases": { "0.1.0": [] }, "urls": [] }