{ "info": { "author": "Eric Van Albert", "author_email": "eric@van.al", "bugtrack_url": null, "classifiers": [], "description": "Outputting to lights from Radiance\n##################################\n\n`Radiance `_ provides a simple way to output to light displays.\nA python library is provided for easy implementation on your device or middleware.\nAll you have to do is instantiate a LightOutputNode and point it to your device.\n\nExample device\n**************\n\nTo try it out, run it in the background. Then, open Radiance and create a new ``LightOutputNode`` pointing at ``localhost``.\nAdd a full-screen pattern such as ``purple`` before the ``LightOutputNode`` to fill the display with color.\nYou should see a circle of lights that correspond to the edges of the frame.\n\nIf you restart the server and want to reconnect, simply select the ``LightOutputNode`` and hit ``R``.\n\n.. code-block:: python\n\n #!/usr/bin/env python3\n \n import logging\n import math\n import radiance\n \n # This example shows how to interface custom hardware to radiance.\n \n # This basic idea here is to subclasses radiance.LightOutputNode\n # and override callback methods in it\n # with custom functionality.\n \n class Example(radiance.LightOutputNode):\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n \n # This tells Radiance the name of our device, and how big the sampled canvas should be.\n self.description = {\n \"name\": \"Python Example\",\n \"size\": [100, 100]\n }\n \n # This would request 5 pixels at the corners and center.\n #self.lookup_2d([(0, 0), (0, 1), (1, 0), (1, 1), (0.5, 0.5)])\n \n # Instead, lets request 120 pixels around the border.\n N = 30\n self.lookup_2d = [(0, i / N) for i in range(N)]\n self.lookup_2d += [(i / N, 0) for i in range(N)]\n self.lookup_2d += [(1, 1 - i / N) for i in range(N)]\n self.lookup_2d += [(1 - i / N, 1) for i in range(N)]\n \n # If we stopped here, Radiance would visualize this display using the lookup coordinates\n # and show a square.\n # If the physical display looks different, we tell Radiance about it with the\n # \"physical coordinates\" command.\n # Lets tell Radiance to visualize the points as a circle instead.\n \n def moveToCircle(x, y):\n l = math.hypot(x - 0.5, y - 0.5)\n return (0.5 * (x - 0.5) / l + 0.5, 0.5 * (y - 0.5) / l + 0.5)\n self.physical_2d = [moveToCircle(x, y) for (x, y) in self.lookup_2d]\n \n # We can send radiance a PNG file to be used as a background image for visualization.\n # This logo image is not very useful, but perhaps some line-art of your venue would work well.\n \n #with open(\"../resources/library/images/logo.png\", \"rb\") as f:\n # self.geometry_2d = f.read()\n \n # Ask for frames from Radiance every 20 ms (50 FPS).\n # On flaky connections, set this to zero.\n # Doing so will request frames one-by-one in a synchronous manner,\n # which will avoid network congestion.\n self.period = 20\n \n # This gets called every time a frame is received.\n def on_frame(self, frame):\n # This is where you would output to LED strips\n # or whatever hardware you have.\n \n # For now, lets just print out the RGB values for the first few pixels\n # to the console.\n # Print the RGB values for the first few pixels to the console\n print(frame[0:5])\n \n # Turn on logging so we can see debug messages\n logging.basicConfig(level=logging.DEBUG)\n \n # Construct our device\n device = Example()\n \n # Start it going\n device.serve_forever()\n ", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://radiance.video", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "radiance", "package_url": "https://pypi.org/project/radiance/", "platform": "", "project_url": "https://pypi.org/project/radiance/", "project_urls": { "Homepage": "https://radiance.video" }, "release_url": "https://pypi.org/project/radiance/0.1dev5/", "requires_dist": null, "requires_python": "", "summary": "Python tools for the Radiance video art system", "version": "0.1dev5" }, "last_serial": 5227105, "releases": { "0.1dev5": [ { "comment_text": "", "digests": { "md5": "ed9c5dacc1459f53bf323013b1aada36", "sha256": "870d0076f8c4da1803aa3798039a86c65b683c04d722dcd259dffb63176dc0e6" }, "downloads": -1, "filename": "radiance-0.1dev5.tar.gz", "has_sig": false, "md5_digest": "ed9c5dacc1459f53bf323013b1aada36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3392, "upload_time": "2019-05-05T01:09:09", "url": "https://files.pythonhosted.org/packages/fc/66/3f3e2ec1d26b04d0bd0355b02456020f2ba0f1eb13ea69754b5fe7edb88b/radiance-0.1dev5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ed9c5dacc1459f53bf323013b1aada36", "sha256": "870d0076f8c4da1803aa3798039a86c65b683c04d722dcd259dffb63176dc0e6" }, "downloads": -1, "filename": "radiance-0.1dev5.tar.gz", "has_sig": false, "md5_digest": "ed9c5dacc1459f53bf323013b1aada36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3392, "upload_time": "2019-05-05T01:09:09", "url": "https://files.pythonhosted.org/packages/fc/66/3f3e2ec1d26b04d0bd0355b02456020f2ba0f1eb13ea69754b5fe7edb88b/radiance-0.1dev5.tar.gz" } ] }