Note that there are some explanatory texts on larger screens.

plurals
  1. POsetting an array element with a sequence error
    primarykey
    data
    text
    <p><strong>2nd Edit</strong></p> <p>This is how a "stokes_line" is generated:</p> <pre><code>os.system('pdv -t %s &gt; temp.txt ' % epoch_name) stokes_line = np.genfromtxt('temp.txt', usecols=3, dtype=[('stokesI','float')], skip_header=1) os.system('vap -nc "mjd" %s &gt;&gt; mjd.txt' % new_y[i]) stokes_list[b] = stokes_line </code></pre> <p>"pdv" is a command from another programme which generated some numbers used in the "stokes_line".</p> <p>stokes_list just gets a new stokes_line added too each in a loop each time.</p> <p><strong>EDIT:</strong></p> <p>A stokes_line is created with a numpy.genfromtxt command (and so extracts from a txt file) and is made up of floats and they look like this:</p> <blockquote> <p>[(0.00126596,) (0.000621272,) (0.00058694,) ..., (0.0015368,) (0.000926448,) (7.95851e-05,)]</p> </blockquote> <p>A bunch of them together make up a stokes_list, and each stokes_line is made up of the same number of floats.</p> <p>Is the problem because the genfromtxt is not creating a list which would be all square brackets, but something else (is it called a sequence)??</p> <hr> <p>I wrote a python code which worked find on my laptop (python version 2.7.3), but it doesn't seem to run on my university desktop (python version 2.5.2).</p> <p>I don't think that showing lots of the code here will be useful, but the error message is on the second of these two lines:</p> <pre><code>os.system('vap -nc "mjd" %s &gt;&gt; mjd.txt' % new_y[i]) stokes_list[b] = stokes_line </code></pre> <p>Where "vap" is a command from another programme which returns some values. Anyway, the crux of the matter is that I get the following error message ONLY when I run on the older version of Python:</p> <blockquote> <p>ValueError: setting an array element with a sequence.</p> </blockquote> <p>Now I did a little research, and people say that the problem is due to incompatible lengths of lists of some such - but if that was the case, why does it work fine when I run it on my newer version of Python.</p> <p>Any help would be great, thank you!</p>
    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.
 

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