{ "info": { "author": "Guillaume Schworer", "author_email": "guillaume.schworer@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": ".. joystick\n\n.. image:: http://img.shields.io/travis/ceyzeriat/joystick/master.svg?style=flat\n :target: https://travis-ci.org/ceyzeriat/joystick\n.. image:: https://coveralls.io/repos/github/ceyzeriat/joystick/badge.svg?branch=master\n :target: https://coveralls.io/github/ceyzeriat/joystick?branch=master\n.. image:: http://img.shields.io/badge/license-GPLv3-blue.svg?style=flat\n :target: https://github.com/ceyzeriat/joystick/blob/master/LICENSE\n\n:Name: joystick\n:Website: https://github.com/ceyzeriat/joystick\n:Author: Guillaume Schworer\n:Version: 0.3\n\nJoystick provides a light-weight and simple framework to real-time data-plotting and logging, while the console remains accessible to manage the on-going simulation and data acquisition.\n\nIn some ways, this framework can replace a Graphical User Interface (GUI) on many projects, as long as 1) the user is comfortable enough with managing the simulation using command-lines, and 2) the display of the real-time data is not too complex.\n\nAllright. Let's say you have some data-stream (serial port, web scraping, on-going simulation or experiment, etc), and you would like to plot or log in real-time whatever is happening. In addition you would also like to send commands to interact with the mechanisms producing the data... without having to build a GUI (which looks pretty to your boss, but is time-consumming both in initial design and maintenance).\n\nThen, this package is for you.\n\nNote that Joystick is based on Tkinter to display frames of text or graph, and that it is released under the GNU General Public License v3 or later (GPLv3+).\n\nStraight to the point: check-out this example. It generates fake random data (ydata) between 0 and 1.05 every 0.2 second, displayed as a function of time in a graph-frame. Whenever there is a datapoint above 1, it drops a warning in the text-frame.\n\n.. code-block:: python\n\n import joystick as jk\n import numpy as np\n import time\n\n class test(jk.Joystick):\n # initialize the infinite loop and callit decorators so they can auto-\n # register methods they decorate\n _infinite_loop = jk.deco_infinite_loop()\n _callit = jk.deco_callit()\n\n @_callit('before', 'init')\n def _init_data(self, *args, **kwargs):\n # Function automatically called at initialization, thanks to the\n # decorator\n self.xdata = np.array([]) # time x-axis\n self.ydata = np.array([]) # fake data y-axis\n\n @_callit('after', 'init')\n def _build_frames(self, *args, **kwargs):\n # Function automatically called at initialization, thanks to the\n # decorator. It will be called after \"_init_data\" given that it is\n # declared after\n # create a graph frame\n self.mygraph = self.add_frame(\n jk.Graph(name=\"test\", size=(500, 500), pos=(50, 50),\n fmt=\"go-\", xnpts=15, freq_up=7, bgcol=\"y\",\n xylim=(0,10,0,1), xlabel='t', ylabel='random'))\n # create a text frame\n self.mytext = self.add_frame(\n jk.Text(name=\"Y-overflow\", size=(500, 250),\n pos=(600, 50), freq_up=1))\n\n @_callit('before', 'start')\n def _set_t0(self):\n # initialize t0 at start-up\n self._t0 = time.time()\n\n @_infinite_loop(wait_time=0.2)\n def _get_data(self):\n # This method will automatically be called with simulation start\n # (t.start()), and looped every 0.2 in a separate thread as long as\n # the simulation runs (running == True)\n # It gets new data (fake random data) and pushes it to the frames.\n # concatenate data on the time x-axis\n new_x_data = time.time()\n self.xdata = jk.core.add_datapoint(self.xdata,\n new_x_data,\n xnptsmax=self.mygraph.xnptsmax)\n # concatenate data on the fake data y-axis\n new_y_data = np.random.random()*1.05\n # check overflow for the new data point\n if new_y_data > 1:\n # send warning to the text-frame\n self.mytext.add_text('Some data bumped into the ceiling: '\n '{:.3f}'.format(new_y_data))\n self.ydata = jk.core.add_datapoint(self.ydata,\n new_y_data,\n xnptsmax=self.mygraph.xnptsmax)\n # prepare the time axis\n t = np.round(self.xdata-self._t0, 1)\n # push new data to the graph\n self.mygraph.set_xydata(t, self.ydata)\n\n @_callit('before', 'exit')\n def exit_warning(self):\n # Just a warning, automatically called with the exit method, and\n # before the exiting actually takes place (closing frames, etc)\n print(\"You're about to exit, frames will disappear in 1 second\")\n time.sleep(1)\n\n t = test()\n t.start()\n\nHere is what it should look like:\n\n.. image:: https://raw.githubusercontent.com/ceyzeriat/joystick/master/docs/img/view.png\n :align: center\n\nYou should see a 'snake' going through the graph-frame, but after 10 seconds it is gone (that was on purpose, for the sake of the demo!). Type (line by line):\n\n.. code-block:: python\n\n t.mygraph.xnpts = 50\n t.mygraph.freq_up = 2\n t.mygraph.xylim = (None, None, 0, 1)\n\nNow that should be better, displaying the latest 50 points at a slower pace (twice a second), and the x-axis is auto-adjusting. Let's stop and reinitialize the graph with slightly different parameters:\n\n.. code-block:: python\n\n t.stop()\n t.mygraph.reinit(bgcol='w', axrect=(0,0,1,1), xylim=(None, None, 0, 1))\n t.start()\n t.stop()\n t.exit()\n\nToo easy!\n\nNote that this is a quick overview of the main point of this package. Other frames than simple text or graph are available: image, multi-line graph, 2D+color scatter graph, etc. Checkout the example.py for further details.\n\n\nDocumentation\n=============\n\nRefer to this page, http://pythonhosted.org/joystick/joystick.html\n\n\nRequirements\n============\n\nJoystick requires the following Python packages:\n\n* tkinter: for the frames GUI\n* NumPy: for basic numerical routines\n* matplotlib: for plotting\n* threading, time, functools, os: for basic stuff\n\n\nInstallation\n============\n\nThe easiest and fastest way for you to get the package and run is to install joystick through pip::\n\n $ pip install joystick\n\nYou can also download joystick source from GitHub and type::\n\n $ python setup.py install\n\nDependencies will not be installed automatically. Refer to the requirements section. If you have an anaconda distribution, you will be good to go.\n\nContributing\n============\n\nCode writing\n------------\n\nCode contributions are welcome! Just send a pull request on GitHub and we will discuss it. In the `issue tracker`_ you may find pending tasks.\n\nBug reporting\n-------------\n\nIf you think you've found one please refer to the `issue tracker`_ on GitHub.\n\n.. _`issue tracker`: https://github.com/ceyzeriat/joystick/issues\n\nAdditional options\n------------------\n\nYou can either send me an e-mail or add it to the issues/wishes list on GitHub.\n\nCiting\n======\n\nIf you use joystick on your project, please\n`drop me a line `, you will get fixes and additional options earlier.\n\nLicense\n=======\n\nJoystick is released under the GNU General Public License v3 or later (GPLv3+). Please refer to the LICENSE file.\n\n\nChangelog\n---------\n\n0.3.8 (2017-12-23)\n++++++++++++++++++\n\n- Fix AttributeError on set_facecolor for old version of matplotlib\n- Added savefig to graphs, pointing to matplotlib.figure.Figure.savefig\n- Added deprecation warnings\n- Refactored colorbar related code (image and scatter frames)\n\n\n0.3.4 (2017-05-27)\n++++++++++++++++++\n\n- Deprecation warning matplotlib\n- Fixed bug GraphMulti when legend=False\n- Added centerorig argument in Image\n\n\n0.3.2 (2017-05-23)\n++++++++++++++++++\n\n- Removed the usage of \"_init\" and \"_update\"\n- GraphMulti numbering shows labels if lbls is not None\n\n\n0.3.1 (2016-11-29)\n++++++++++++++++++\n\n- fixed bug: increased interactivity on graphs when not running\n- fixed bug on xylim of graph, multigraph and scatter\n\n\n0.3.0 (2016-11-28)\n++++++++++++++++++\n\n- Added multi-lines graph-frames\n- Added scatter grap-frames\n- Deprecated the usage of \"_init\" and \"_update\"\n- Added new decorator \"callit\" to define callback or callfront functions to an existing method\n- Added new decorator \"thread_it\" to launch a function into a separate thread\n- Added the possibility to use ax-related kwargs in all graph-frames\n- Allowed xnpts and xnptsmax = None to apply no limit on the amount data plotted\n\n\n0.1.4 (2016-10-14)\n++++++++++++++++++\n\n- Added image frames\n- Added auto scroll-down on a text-frame when showing text in chronological order (rev=False)\n\n\n0.1.0 (2016-09-26)\n++++++++++++++++++\n\n- Initial release", "description_content_type": null, "docs_url": "https://pythonhosted.org/joystick/", "download_url": "https://github.com/ceyzeriat/joystick/tree/master/dist", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ceyzeriat/joystick/", "keywords": "realtime,real,time,live,stream,figure,data,matplotlib,control,thread,serial,plot", "license": "GNU General Public License v3 or later (GPLv3+)", "maintainer": "", "maintainer_email": "", "name": "joystick", "package_url": "https://pypi.org/project/joystick/", "platform": "", "project_url": "https://pypi.org/project/joystick/", "project_urls": { "Download": "https://github.com/ceyzeriat/joystick/tree/master/dist", "Homepage": "https://github.com/ceyzeriat/joystick/" }, "release_url": "https://pypi.org/project/joystick/0.3.8/", "requires_dist": null, "requires_python": "", "summary": "Real-time plotting and logging while console controlling", "version": "0.3.8" }, "last_serial": 3438474, "releases": { "0.3.2": [ { "comment_text": "", "digests": { "md5": "406dceed5a598b5e62ceb5482b9681de", "sha256": "170fd53a93d7da705e65167f79fe35f2fe8216e5ba583d26db0f07ea93a6017e" }, "downloads": -1, "filename": "joystick-0.3.2.tar.gz", "has_sig": false, "md5_digest": "406dceed5a598b5e62ceb5482b9681de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22243, "upload_time": "2017-05-23T12:59:31", "url": "https://files.pythonhosted.org/packages/31/6f/36a81f05a185ba0acc0507f249f7ca1ee7222f78349dcddbb9c8597187dc/joystick-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "e2edfc0a7b4017b17bab8d16dbabf688", "sha256": "a90e1891953f799a3250ba7e87856d47b18e5e5927e4c772743aa4184ea2d664" }, "downloads": -1, "filename": "joystick-0.3.3.tar.gz", "has_sig": false, "md5_digest": "e2edfc0a7b4017b17bab8d16dbabf688", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22256, "upload_time": "2017-05-24T15:05:08", "url": "https://files.pythonhosted.org/packages/80/03/d6216dcd91c67a2a7fbfcdf06aa541de7b0917b4a7d533e9677ff121bb77/joystick-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "019e3f75298a6aa990301dfa8c2eaddd", "sha256": "57af3ab639324a8cc9947bcc2e10c52aad8eed6bd0649e8cf5ed0a6f3a6d9909" }, "downloads": -1, "filename": "joystick-0.3.4.tar.gz", "has_sig": false, "md5_digest": "019e3f75298a6aa990301dfa8c2eaddd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22430, "upload_time": "2017-05-26T16:13:46", "url": "https://files.pythonhosted.org/packages/3d/45/57ae55e63df4c2c7703657a248fedd8be69fd48709cce1a27fe467ee3bfb/joystick-0.3.4.tar.gz" } ], "0.3.5": [ { "comment_text": "", "digests": { "md5": "d5e02dd3eb82bbbe65bbdac0b9413c6a", "sha256": "c0a2f22c008afcb0e9fbe70e383d6f2141566bc49ed6a76aeef1411275c1c7ce" }, "downloads": -1, "filename": "joystick-0.3.5.tar.gz", "has_sig": false, "md5_digest": "d5e02dd3eb82bbbe65bbdac0b9413c6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21613, "upload_time": "2017-12-20T21:48:52", "url": "https://files.pythonhosted.org/packages/c1/dc/582561160fa4c6c14af91611a12010b374f5a06a4b9fbe0212ffc74e0fb1/joystick-0.3.5.tar.gz" } ], "0.3.6": [ { "comment_text": "", "digests": { "md5": "f927fecf8b15b49489b0303246749023", "sha256": "b7fb425c37364b79b4c325094770c1611c8cc5023546cfa83d2bb37f1c955eb8" }, "downloads": -1, "filename": "joystick-0.3.6.tar.gz", "has_sig": false, "md5_digest": "f927fecf8b15b49489b0303246749023", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21607, "upload_time": "2017-12-20T22:09:39", "url": "https://files.pythonhosted.org/packages/a0/0f/21bff1e784478069844d9fa7caf33b43a81deab2c63c24b240216c7d007c/joystick-0.3.6.tar.gz" } ], "0.3.7": [ { "comment_text": "", "digests": { "md5": "26545963add75c2e92b3d6ad05b415fd", "sha256": "0f6ba92dced6fb157a37aa900baaf22d0cffe4f2862c0a432418a5217d8619f3" }, "downloads": -1, "filename": "joystick-0.3.7.tar.gz", "has_sig": false, "md5_digest": "26545963add75c2e92b3d6ad05b415fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23110, "upload_time": "2017-12-23T04:20:30", "url": "https://files.pythonhosted.org/packages/ed/ec/d5c6479da5d3f901d23e3226ed9f5c1d98d5296c00a3ed2ae34116a6dacc/joystick-0.3.7.tar.gz" } ], "0.3.8": [ { "comment_text": "", "digests": { "md5": "fe4850c405c556e79961f7eb69d16b58", "sha256": "c57ad8888b479723ed28b6952765e5ae03bfe5154680c64dd5f722eb6e240c43" }, "downloads": -1, "filename": "joystick-0.3.8.tar.gz", "has_sig": false, "md5_digest": "fe4850c405c556e79961f7eb69d16b58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23147, "upload_time": "2017-12-23T04:24:35", "url": "https://files.pythonhosted.org/packages/7c/f7/e6ed5c9c6c9b26bfabda5889591fe44fb730247a14d59e94690465194080/joystick-0.3.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fe4850c405c556e79961f7eb69d16b58", "sha256": "c57ad8888b479723ed28b6952765e5ae03bfe5154680c64dd5f722eb6e240c43" }, "downloads": -1, "filename": "joystick-0.3.8.tar.gz", "has_sig": false, "md5_digest": "fe4850c405c556e79961f7eb69d16b58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23147, "upload_time": "2017-12-23T04:24:35", "url": "https://files.pythonhosted.org/packages/7c/f7/e6ed5c9c6c9b26bfabda5889591fe44fb730247a14d59e94690465194080/joystick-0.3.8.tar.gz" } ] }