Note that there are some explanatory texts on larger screens.

plurals
  1. POOptimized Averaging of Large Array?
    primarykey
    data
    text
    <p>So i have a .wav file. from this i got the data: as expected from a sound file it is in stereo so the data looks like</p> <h2>List 1 (Original List)</h2> <blockquote> <p>[ [1,2], [2,3], [4,9], [1,5], [1,7], ....]</p> </blockquote> <p>Note: I just made up those numbers, however the point is it's a nested list. The problem here is I'm doing FFT on that and as such want to only use the average of the two channels so i want:</p> <h2>List 2 (Averaged)</h2> <blockquote> <p>[ [1.5], [2.5], [6.5], [3], [4], .... ]</p> </blockquote> <p>so for that I did:</p> <pre><code>averaged_array = [sum(x)/len(x) for x in original_list] </code></pre> <p>I assume len(x) is a constant time operation even though it will always be 2.</p> <p>The problem here is that the length of the original list is >900,000 I believe. On my home computer I can average it in ~46 seconds. At the computer I have to use for the presentation it takes ~121 seconds. This is a sizeable increase and it frankly is bad to have to wait around while it runs. Is there anyway I can optimize this so the time it takes it reduced?</p> <p>Note: I believe this is a double core computer so I cannot run this in parallel (I think?). It is possible for me to ssh into a server (with a few i7's running on it) which I've been given permission to use.. Would it be better if I somehow ssh'ed and did the calculations there? The original computer I'm using I believe is ~2 ghz but is an old dell model relative (the series from a few years ago). Additionally, McAfee and another process eat up ~50% of the processing as well and I have no rights to kill these.</p> <p>If I do that:</p> <ul> <li>How would I do the calculations on this remote computer via SSH? (I'm using python 2.7 and would really prefer not to install any external libraries as this is not my computer but an organization computer)</li> <li>Would I be able to do the calculations in a sort of "order"? I thought that when doing things in parallel, you could not maintain order as it would be done as soon as a core is open to compute it. By order I mean: I want the list to maintain the average at the same index of the original list. Ex. [ [1,2], [3,4]] should give [ [2.5], [3.5]] not [ [3.5], [2.5]] </li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload