data type and logarithm
Hi, I am quite new to python and I am trying to do some simple plots. I am using python Python 2.6.4 and numpy/1.5.1 I have an ASCII data file that I am reading with the following lines of code: import pylab import numpy as np filename='something.dat' file = open(filename) rho = np.array([], dtype = 'float64') entropy = np.array([], dtype = 'float64') for line in file: columns = line.split() rho = np.append(rho,columns[0]) entropy = np.append(entropy,columns[1]) and rho and entropy are apparently read correctly, but when I look to the data type print rho.dtype print entropy.dtype I get |S22 , what's that? Then I want to plot a logarithmic plot and I do pylab.plot(np.log(rho), entropy) and I get NotImplementedError: Not implemented for this type Does anybody has a clue? I do not know how to proceed Many thanks -- http://mail.python.org/mailman/listinfo/python-list
genfromtxt and comment identifier
Hi All, I have a problem with reading data from a file using genfromtxt of numpy module. I have prepared a minimal example similar to the ones presented in http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html#splitting-the-lines-into-columns The script is import numpy as np from StringIO import StringIO file = open('esempio.dat') for line in file.xreadlines() : if not line : break print line np.genfromtxt(StringIO(line), comments="#", delimiter=",") I have a data file - esempio.dat - like the following: # # Skip me ! # Skip me too ! 1, 2 3, 4 5, 6 #This is the third line of the data 7, 8 # And here comes the last line 9, 0 """ The code is breaking at the first line, it looks like it doesn't recognize # like comment identifier. The error in the python interpreter is Traceback (most recent call last): File "", line 1, in File "esempio.py", line 7, in np.genfromtxt(StringIO(line), comments="#", delimiter=",") File "/opt/numpy/1.5.1/lib/python2.6/site-packages/numpy/lib/ npyio.py", line 1174, in genfromtxt raise IOError('End-of-file reached before encountering data.') IOError: End-of-file reached before encountering data. It is clear that I haven't understood something, what am I doing wrong? Cheers -- http://mail.python.org/mailman/listinfo/python-list
best parallelisation strategy on python
I have a code fortran 90 that is parallelised with MPI. I would like to traslate it in python, but I am not sure on the parallelisation strategy and libraries. I work on clusters, with each node with 5GB memory and 12 processors or 24 processors (depending on the cluster I am using). Ideally I would like to split the computation on several nodes. Let me explain what this code does: It read ~100GB data, they are divided in hdf5 files of ~25GB each. The code should read the data, go through it and then select a fraction of the data, ~1GB and then some CPU intensive work on it, and repeat this process many times, say 1000 times, then write the results to a single final file. I was thinking that the CPU intensive part would be written as a shared object in C. Do you have suggestions about which library to use? -- https://mail.python.org/mailman/listinfo/python-list
scientific notation in legend (pylab)
Hi, I I would like to have numbers expressed in scientific notation in legend annotations. Does anybody know how to do that? Cheers, S. -- http://mail.python.org/mailman/listinfo/python-list
Re: scientific notation in legend (pylab)
thank you, I am trying to learn python, but I am having a hard to find a good introduction to it. On Jan 15, 3:27 am, Jason Friedman wrote: > > Not sure why legend annotations makes the problem different, but > perhaps this is a start: -- http://mail.python.org/mailman/listinfo/python-list