{ "info": { "author": "Jeff Hetherly", "author_email": "jeffrey.hetherly@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "|Build Status|\n\n`linear\\_binning: linear binning `__\n=================================================================================\n\nPerforms a linear binning technique described in `Wand and\nJones `__\non a regularly-spaced grid in an arbitrary number of dimensions. The\n`asymptotic\nbehavior `__\nof this binning technique performs better than so-called simple binning\n(i.e. as in histograms). Each data point in ``d``-dimensional space must\nhave an associated weight (for equally weighted points just use a weight\nof ``1.0`` for each point).\n\nFor example, within a (segment of a) 2D grid with corners A, B, C, and D\nand a 2D data point P with weight wP:\n\n::\n\n A-----------------------------------B\n | | |\n | |\n | | |\n |- - - - P- - - - - - - - - - - - - |\n | | |\n D-----------------------------------C\n\n- Assign a weight to corner A of the proportion of area between P and C\n (times wP)\n- Assign a weight to corner B of the proportion of area between P and D\n (times wP)\n- Assign a weight to corner C of the proportion of area between P and A\n (times wP)\n- Assign a weight to corner D of the proportion of area between P and B\n (times wP)\n\nNote that the under- and overflow bins need to be accounted for when\nspecifying the numbers of grid points in each dimension (grid points act\nas bin centers). For instance, if you want grid points in steps of 0.1\nin a range of [0,1] (i.e. (0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1)),\nspecify the number of grid points to be 11. Internally, the grid points\nare stored in a contiguous array. This sets a natural restriction on the\nnumber of grid points along each dimension as memory is allocated for\neach potential grid point even if it is never used. To accommodate\narbitrary numbers of dimension, an arbitrary precision numeric library\n(`boost\nmultiprecision `__)\nmay be used internally and will negatively impact performance. If this\ndegradation in performance is unacceptable, consider reducing the number\nof dimensions in such a way that the is less than the maximum number of\nbinary digits in an \"unsigned long long\" on your system.\n\nQuickstart\n----------\n\n- pip install linear\\_binning\n\nor\n\n- git clone https://github.com/jhetherly/linear\\_binning\n- cd linear\\_binning\n- python setup.py install\n\nExample\n-------\n\nThis constructs one million random 2D points in the unit square with\nrandom weights and constructs a grid of ``51`` by ``51`` (can be\ndifferent along different dimensions) linearly binned \"bin centers.\" The\nboundaries of the grid of bin centers are specified by ``extents`` and\ncan be thought of as the under- and overflow bins (i.e. these are the\ncoordinates of the first and last bin centers).\n\n.. code:: python\n\n from linear_binning import linear_binning\n import numpy as np\n\n # generate one million random 2D points and weights\n # (should take less than a second to bin)\n n_samples=1000000\n D=2\n\n # coordinates, weights, and extents must be of type \"double\"\n sample_coords = np.random.random(size=(n_samples, D))\n sample_weights = np.random.random(size=n_samples)\n extents = np.tile([0., 1.], D).reshape((D, 2))\n n_bins = np.full(D, 51)\n\n coords, weights = linear_binning(sample_coords, sample_weights,\n extents, n_bins)\n\n # check that weights on grid match original weights\n print(np.allclose(weights.sum(), sample_weights.sum()))\n\nDependencies\n------------\n\n- numpy\n\n.. |Build Status| image:: https://travis-ci.org/jhetherly/linear_binning.svg?branch=master\n :target: https://travis-ci.org/jhetherly/linear_binning\n\n1.1.0\n\nAdded support for automatically converting Numpy arrays to proper d-types.\nAdded more explicit tests.\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/jhetherly/linear_binning", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "linear_binning", "package_url": "https://pypi.org/project/linear_binning/", "platform": "any", "project_url": "https://pypi.org/project/linear_binning/", "project_urls": { "Homepage": "https://github.com/jhetherly/linear_binning" }, "release_url": "https://pypi.org/project/linear_binning/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "Python function for performing a linear binning", "version": "1.1.0" }, "last_serial": 3223711, "releases": { "1.0.2": [ { "comment_text": "", "digests": { "md5": "608380a637270f3c5f1d3ac7f28dedad", "sha256": "e409d5861ad2d88e13a4ff20d85d9dd6ba9bc5742e7db1e00f24c12202c520b6" }, "downloads": -1, "filename": "linear_binning-1.0.2.tar.gz", "has_sig": false, "md5_digest": "608380a637270f3c5f1d3ac7f28dedad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 881721, "upload_time": "2017-01-26T00:18:28", "url": "https://files.pythonhosted.org/packages/1a/cb/c09ba30410626f878ce7afd94049becd2d1194136d6f8e721a04d90b92b1/linear_binning-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "dbcc8cb320b18f0a38ecd99e030d61b2", "sha256": "d32500caf42912ea0d6f52c087158bfadd251e6467746715ee3bdb2fa529d991" }, "downloads": -1, "filename": "linear_binning-1.1.0.tar.gz", "has_sig": false, "md5_digest": "dbcc8cb320b18f0a38ecd99e030d61b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 883183, "upload_time": "2017-10-04T00:44:17", "url": "https://files.pythonhosted.org/packages/0b/ed/46418fd27bf051dccf35da6816b3c04ecfb9f2a91eb4af4afa2332fc7d50/linear_binning-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dbcc8cb320b18f0a38ecd99e030d61b2", "sha256": "d32500caf42912ea0d6f52c087158bfadd251e6467746715ee3bdb2fa529d991" }, "downloads": -1, "filename": "linear_binning-1.1.0.tar.gz", "has_sig": false, "md5_digest": "dbcc8cb320b18f0a38ecd99e030d61b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 883183, "upload_time": "2017-10-04T00:44:17", "url": "https://files.pythonhosted.org/packages/0b/ed/46418fd27bf051dccf35da6816b3c04ecfb9f2a91eb4af4afa2332fc7d50/linear_binning-1.1.0.tar.gz" } ] }