Re: [matplotlib-devel] Quantization of normalized float to uint8
On 9/18/2011 2:30 PM, Eric Firing wrote: > On 09/18/2011 09:30 AM, Christoph Gohlke wrote: >> Hello, >> >> matplotlib uses int(x*255) or np.array(x*255, np.uint8) to quantize >> normalized floating point numbers x in the range [0.0 to 1.0] to >> integers in the range [0 to 255]. This way only 1.0 is mapped to 255, >> not for example 0.999. Is this really intended or would not the largest >> floating point number below 256.0 be a better scale factor than 255? The >> exact factor depends on the floating point precision (~255.92 for >> np.float32, ~255.93 for np.float16). >> >> Christoph > > Christoph, > > It's a reasonable question; but do you have use cases in mind where it > actually makes a difference? > > The simple scaling with truncation is used in many places, both in the > python and the c++ code. > > Eric > Hi Eric, visually it will be hardly noticeable in most cases. However, I'd expect the histogram of normalized intensity data to be the same as the histogram of a linear grayscale image of that data (neglecting gamma correction, image scaling/interpolation for now). Consider this code for example: import numpy as np a = np.random.rand(1024*1024) a[0], a[-1] = 0.0, 1.0 h0 = np.histogram(a, bins=256, range=(0, 1))[0] h1 = np.bincount(np.uint8(a * 255)) h2 = np.bincount(np.uint8(a * 255.9)) print (h0 - h1) print (h0 - h2) Christoph -- BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA Learn about the latest advances in developing for the BlackBerry® mobile platform with sessions, labs & more. See new tools and technologies. Register for BlackBerry® DevCon today! http://p.sf.net/sfu/rim-devcon-copy1 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] [Basemap] Make doc build-process more self-contained
Hello, the doc build process is a lot of hand-crafting work and it also requires the full source of matplotlib just to get a couple of directory. I know that code duplication sucks, but I'd suggest to include directly into the basemap dir all the files (sphinxext & _static at the very least) needed for the doc compilation. This would help a lot the distributions (Debian of course :) ). Thanks for considering, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA Learn about the latest advances in developing for the BlackBerry® mobile platform with sessions, labs & more. See new tools and technologies. Register for BlackBerry® DevCon today! http://p.sf.net/sfu/rim-devcon-copy1 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] [Basemap] nad2bin is not installed?
Hello, it seems nad2bin is not installed, but only compiled. Is that expected? Should it be installed by hand instead of by setup.py install? Cheers, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] [Basemap] Preferred form of modification for data files
Hello, To be available from the Debian main archive, we need to provide a tarball containing all source code, something that later generates a "binary" content or in a form that's what called "the preferred form of modification" (f.e. in a sphinx doc, it's the rst files, not the html files resulting from the building process, since the preferred form of modification of that documentation is thru the rst files). The question comes directly to the datafile: is the file format datafiles are shipped the preferred form of modification? if yes, what are the ways/tools to modify those files? Moreover, what are the sources of those files (i.e. where are they downloaded from)? I know that it might seem a bit picky, from a Debian POV, these information are really important. Thanks & Cheers, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel