<div dir="ltr"><div>Allan,<br><br></div>I see with a google search on your name that you are in the physics department at Rutgers. I got my BA in Physics there. 1975. Biological physics. A thought: Is there an entropy that can be assigned to the dna in an organism? I don't mean the usual thing, coupled to the heat bath. Evolution blindly explores metabolic and signalling pathways, and tends towards disorder, as long as it functions. Someone working out signaling pathways some years ago wrote that they were senselessly complex, branched and interlocked. I think that is to be expected. Evolution doesn't find minimalist, clear, rational solutions. Look at the amazon rain forest. What are all those beetles and butterflies and frogs for? It is the wrong question. I think some measure of the complexity could be related to the amount of time that ecosystem has existed. Similarly for genomes.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 6, 2015 at 6:55 PM, Allan Haldane <span dir="ltr"><<a href="mailto:allanhaldane@gmail.com" target="_blank">allanhaldane@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I've also often wanted to generate large datasets of random uint8 and uint16. As a workaround, this is something I have used:<br>
<br>
np.ndarray(100, 'u1', np.random.bytes(100))<br>
<br>
It has also crossed my mind that np.random.randint and np.random.rand could use an extra 'dtype' keyword. It didn't look easy to implement though.<br>
<br>
Allan<span class=""><br>
<br>
On 12/06/2015 04:55 PM, DAVID SAROFF (RIT Student) wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
Matthew,<br>
<br>
That looks right. I'm concluding that the .astype(np.uint8) is applied<br>
after the array is constructed, instead of during the process. This<br>
random array is a test case. In the production analysis of radio<br>
telescope data this is how the data comes in, and there is no  problem<br>
with 10GBy files.<br>
linearInputData = np.fromfile(dataFile, dtype = np.uint8, count = -1)<br>
spectrumArray = linearInputData.reshape(nSpectra,sizeSpectrum)<br>
<br>
<br>
On Sun, Dec 6, 2015 at 4:07 PM, Matthew Brett <<a href="mailto:matthew.brett@gmail.com" target="_blank">matthew.brett@gmail.com</a><br></span><span class="">
<mailto:<a href="mailto:matthew.brett@gmail.com" target="_blank">matthew.brett@gmail.com</a>>> wrote:<br>
<br>
    Hi,<br>
<br>
    On Sun, Dec 6, 2015 at 12:39 PM, DAVID SAROFF (RIT Student)<br></span><span class="">
    <<a href="mailto:dps7802@rit.edu" target="_blank">dps7802@rit.edu</a> <mailto:<a href="mailto:dps7802@rit.edu" target="_blank">dps7802@rit.edu</a>>> wrote:<br>
    > This works. A big array of eight bit random numbers is constructed:<br>
    ><br>
    > import numpy as np<br>
    ><br>
    > spectrumArray = np.random.randint(0,255, (2**20,2**12)).astype(np.uint8)<br>
    ><br>
    ><br>
    ><br>
    > This fails. It eats up all 64GBy of RAM:<br>
    ><br>
    > spectrumArray = np.random.randint(0,255, (2**21,2**12)).astype(np.uint8)<br>
    ><br>
    ><br>
    > The difference is a factor of two, 2**21 rather than 2**20, for the extent<br>
    > of the first axis.<br>
<br>
    I think what's happening is that this:<br>
<br>
    np.random.randint(0,255, (2**21,2**12))<br>
<br>
    creates 2**33 random integers, which (on 64-bit) will be of dtype<br>
    int64 = 8 bytes, giving total size 2 ** (21 + 12 + 6) = 2 ** 39 bytes<br>
    = 512 GiB.<br>
<br>
    Cheers,<br>
<br>
    Matthew<br>
    _______________________________________________<br>
    NumPy-Discussion mailing list<br></span>
    <a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a> <mailto:<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a>><span class=""><br>
    <a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br>
<br>
<br>
<br>
--<br>
David P. Saroff<br>
Rochester Institute of Technology<br>
54 Lomb Memorial Dr, Rochester, NY 14623<br>
</span><a href="mailto:david.saroff@mail.rit.edu" target="_blank">david.saroff@mail.rit.edu</a> <mailto:<a href="mailto:david.saroff@mail.rit.edu" target="_blank">david.saroff@mail.rit.edu</a>> | (434)<br>
227-6242<span class=""><br>
<br>
<br>
<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br>
</span></blockquote><div class="HOEnZb"><div class="h5">
<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr">David P. Saroff <br>Rochester Institute of Technology<br>54 Lomb Memorial Dr, Rochester, NY 14623<br><a href="mailto:david.saroff@mail.rit.edu" target="_blank">david.saroff@mail.rit.edu</a> | (434) 227-6242 <br>
<br></div></div>
</div>