[SciPy-user] organizing data
Xavier Barthelemy
xavier.barthelemy@cmla.ens-cachan...
Tue Nov 20 05:21:29 CST 2007
Hi everyone!
I'm quite new to python, and I am breaking my mind on this:
I would like to organize data so I can plot them.
My data are the variation of 11 parameters, with 18 values for each. so
you can see them as an hypercube of 11 dimension. My goal is the
possibility to plot with gnuplot in 2D (or 3D). So I have to class my
data by slices of 9 (or 8) parameters constant.
That's my problem: it is not really an "hyper"matrix of data because i
did not discretized the space parameters equally for each parameters.
So i think i have to class and then recursively cut into the mass so I
can have small arrays I can plot with the gnuplot.py
As I said, i am quite new in pythonizing, and I sure can use a little
help. I have spent much time on this, and I can't figure it out how.
so:
from numpy import *
from scipy import *
from operator import itemgetter
import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils
#I read the data
def LireFich(Data):
donnees= io.read_array(Data,columns=(0,-1),lines=(0,-1),atype='d')
return donnees
def Couper(liste,col):
#Then I class the whole array (sorted can class by each and every
columns just add a coma and a new col)
longueur = len(liste)
listeSansDoublon=[]
liste2=array(sorted(liste,key=itemgetter(col)))
#Then i create a list of each values of the parameters so i can cut by
each constant "pieces"
for i in liste2[:,col] :
if listeSansDoublon.count(i) == 0:
listeSansDoublon.append(i)
longueur2=len(listeSansDoublon)
and then... I don't know
I have guessed the array_split function
OuCouper=[]
k=0
for i in listeSansDoublon:
j = array(where(i == liste2[:,col]))
jj= where(i == liste2[:,col])
A=min(j)
B=max(j)
OuCouper[k,1]=A
OuCouper[k,2]=B
# essai=array_split(liste2,min(j)--max(j))
but actually it doesn't work, as i have read the F*M*.
i have also think that I can only manipulate masks ans apply the final
recursively calculated mask on the data and then reduce to have the
correct form for gnuplot.
Thanks for your help if you can help me. I really passed much time on
this, and i still can't figure it out how.
Xavier
More information about the SciPy-user
mailing list