From b19770356272772c8c8ba75f351520eca186bd19 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 3 Feb 2013 09:52:11 +0100 Subject: [PATCH] matrice graph classe --- PrintRScript.py | 1 - ProfList.py | 2 +- layout.py | 8 ++++++-- tableau.py | 2 -- tabsimi.py | 21 +++++++++++++++------ 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/PrintRScript.py b/PrintRScript.py index b29f813..25adb52 100644 --- a/PrintRScript.py +++ b/PrintRScript.py @@ -253,7 +253,6 @@ def RchdTxt(DicoPath, RscriptPath, mincl, classif_mode, nbt = 9, svdmethod = 'sv def RPamTxt(corpus, RscriptPath): DicoPath = corpus.pathout param = corpus.parametres - print param txt = """ source("%s") """ % (RscriptPath['pamtxt']) diff --git a/ProfList.py b/ProfList.py index d7d288d..4da21fb 100644 --- a/ProfList.py +++ b/ProfList.py @@ -411,7 +411,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col def quest_simi(self, evt) : tableau = self.Source.tableau tab = tableau.make_table_from_classe(self.cl, self.la) - pathout = ConstructPathOut(os.path.join(self.Source.pathout.dirout, 'simi_classe_%i' %self.cl), 'simi_classe_%i' %self.cl) + pathout = ConstructPathOut(self.Source.pathout.dirout, 'simi_classe_%i' %self.cl) self.filename = os.path.join(pathout,'mat01.csv') tableau.printtable(self.filename, tab) del tab diff --git a/layout.py b/layout.py index 550e73e..310b3ff 100644 --- a/layout.py +++ b/layout.py @@ -341,6 +341,7 @@ class OpenCHDS(): panel.corpus = self.corpus else : panel.tableau = self.corpus + #self.parent.tableau = panel.tableau panel.dictpathout = self.DictPathOut panel.pathout = self.DictPathOut panel.parent = self.parent @@ -535,7 +536,6 @@ class OpenCHDS(): if res == wx.ID_OK : fileout = dial.fbb.GetValue() dial.Destroy() - print fileout self.corpus.get_stat_by_cluster(fileout) msg = u"Fini !" dlg = wx.MessageDialog(self.parent, msg, u"Stat par classe", wx.OK | wx.NO_DEFAULT | wx.ICON_INFORMATION) @@ -1051,7 +1051,11 @@ class SimiMatLayout(DefaultMatLayout) : # with codecs.open(self.pathout['actives.csv'], 'r', self.parametres['encoding']) as f : # self.actives = f.read() # self.actives = self.actives.splitlines()#[act for act in self.actives.splitlines()] - actives = [[val, self.tableau.actives[val][0]] for val in self.tableau.actives] + try : + actives = [[val, self.tableau.actives[val][0]] for val in self.tableau.actives] + except : + actives = [[val, self.tableau.actives[val]] for val in self.tableau.actives] + #self.tableau.make_listactives() actives = dict([[i, val] for i, val in enumerate(actives)]) #dictcol = dict([[i, [act, self.corpus.getlemeff(act)]] for i, act in enumerate(self.actives)]) diff --git a/tableau.py b/tableau.py index 1deaa8e..514c8cf 100644 --- a/tableau.py +++ b/tableau.py @@ -137,7 +137,6 @@ class Tableau() : doc = ooolib.Calc(opendoc=self.parametre['filename']) doc.set_sheet_index(0) (cols, rows) = doc.get_sheet_dimensions() - print cols, rows for row in range(1, rows + 1): ligne = [] for col in range(1, cols + 1): @@ -316,7 +315,6 @@ class Tableau() : def make_table_from_classe(self, cl, la) : ln = [line[0] for line in self.classes if line[1] == cl] out = [['0' for col in la] for line in ln] - print self.actives for i, act in enumerate(la) : for j, line in enumerate(ln) : if line in self.actives[act][1] : diff --git a/tabsimi.py b/tabsimi.py index 081b2fa..b34a107 100644 --- a/tabsimi.py +++ b/tabsimi.py @@ -4,7 +4,7 @@ #Copyright (c) 2009-2010 Pierre Ratinaud #Lisense: GNU/GPL -from chemins import ConstructPathOut, simipath, ffr +from chemins import ConstructPathOut, simipath, ffr, PathOut from functions import print_liste, exec_rcode, read_list_file, check_Rresult, indices_simi, treat_var_mod from dialog import SelectColDial, FreqDialog from guifunct import PrefSimi @@ -33,6 +33,7 @@ class DoSimi(AnalyseMatrix): self.actives = actives self.openfromprof = openfromprof self.cmd = cmd + self.dirout = pathout if param is not None and fromprof: self.paramsimi = param else : @@ -76,7 +77,9 @@ class DoSimi(AnalyseMatrix): #else : self.parent = parent self.Source = None - + if pathout : + self.pathout = PathOut(dirout = pathout) + self.RPath = self.parent.PathPath.get('PATHS', 'rpath') if not isopen : #if not fromprof : @@ -100,6 +103,9 @@ class DoSimi(AnalyseMatrix): actives = self.tableau.getactlistfromselection(self.tableau.selected_col) else : actives = self.actives + if isinstance(actives, dict) : + actives = [[val, actives[val][0]] for val in actives] + self.tableau.actives = dict(actives) self.tableau.make_listactives() actives = dict([[i, val] for i, val in enumerate(actives)]) self.dial = PrefSimi(parent, -1, self.paramsimi, self.indices, wordlist = actives) @@ -118,7 +124,10 @@ class DoSimi(AnalyseMatrix): self.paramsimi = self.make_param() self.parametres = self.paramsimi self.parametres['type'] = 'simimatrix' - self.parametres['pathout'] = ConstructPathOut(self.tableau.parametre['filename'], 'SimiMatrix') + if not pathout : + self.parametres['pathout'] = ConstructPathOut(self.tableau.parametre['filename'], 'SimiMatrix') + else : + self.parametres['pathout'] = self.dirout self.parametres['filename'] = self.tableau.parametres['filename'] self.dial.Destroy() dlg = wx.ProgressDialog("Traitements", @@ -135,7 +144,6 @@ class DoSimi(AnalyseMatrix): dialcol.Destroy() def doanalyse(self) : - self.pathout.basefiles(simipath) with open(self.pathout['selected.csv'], 'w') as f : f.write('\n'.join([`val` for val in self.column])) @@ -151,9 +159,10 @@ class DoSimi(AnalyseMatrix): #if not self.fromprof : #self.pathout = ConstructPathOut(self.tableau.parametre['filename'], 'Simi') #self.DictPathOut = construct_simipath(self.pathout) - self.parent.tableau.dictpathout = self.pathout + self.tableau.dictpathout = self.pathout self.dlg.Update(count, u"passage en O/1") - self.parent.tableau.make_01_from_selection(self.tableau.selected_col) + if not self.fromprof : + self.tableau.make_01_from_selection(self.tableau.selected_col) #self.Linecontent = parent.table #self.ListTo01Form() #else : -- 2.7.4