X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=ProfList.py;h=e2a7c84a18cc898256a2adf3c2a0c342a0606a42;hp=600dbcfc693d61b137f280c310444f0eb56d51b6;hb=ad8fe486b34f1cee918ea8564bf909e30cd25328;hpb=8cebf6f5e4531b73d8ba32f834c10cefd1086d80 diff --git a/ProfList.py b/ProfList.py index 600dbcf..e2a7c84 100644 --- a/ProfList.py +++ b/ProfList.py @@ -74,6 +74,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col self.la = [] self.lchi = [] self.lfreq = [] + self.tmpchi = None #adding some art self.il = wx.ImageList(16, 16) @@ -406,7 +407,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(self.Source.pathout+'/', 'simi_classe_%i' %self.cl) + pathout = ConstructPathOut(os.path.join(self.Source.pathout, 'simi_classe_%i' %self.cl)) self.filename = os.path.join(pathout,'mat01.csv') tableau.printtable(self.filename, tab) del tab @@ -459,56 +460,32 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col def onwordgraph(self, evt): word = self.getColumnText(self.GetFirstSelected(), 6) - dlg = progressbar(self, 2) - corpus = self.Source.corpus - uces = corpus.lc[self.cl-1] - dlg.Update(1, u'Tableau...') - #tab = corpus.make_table_with_classe(uces, self.la) - pathout = ConstructPathOut(self.Source.pathout.dirout + '/' , 'simi_%s' % word) - self.filename = os.path.join(pathout,'mat01.csv') - dlg.Update(2, u'Ecriture...') - #corpus.write_tab(tab, self.filename) - #del tab - corpus.make_and_write_sparse_matrix_from_classe(self.la, uces, self.filename) - dlg.Destroy() - paramsimi = {'coeff' : 0, - 'layout' : 2, - 'type' : 1, - 'arbremax' : 0, - 'coeff_tv' : 1, - 'coeff_tv_nb' : 0, - 'tvprop' : 0, - 'tvmin' : 5, - 'tvmax' : 30, - 'coeff_te' : 1, - 'coeff_temin' : 1, - 'coeff_temax' : 10, - 'label_v': 1, - 'label_e': 0, - 'vcex' : 1, - 'vcexmin' : 10, - 'vcexmax' : 25, - 'cex' : 10, - 'seuil_ok' : 1, - 'seuil' : 1, - 'cols' : (255,0,0), - 'cola' : (200,200,200), - 'width' : 600, - 'height' : 600, - 'first' : True, - 'keep_coord' : True, - 'alpha' : 20, - 'film': False, - } - self.tableau = Tableau(self.parent, '') - self.tableau.listactives = self.la - self.tableau.actives = {} - for i, val in enumerate(self.la) : - self.tableau.actives[val] = [self.lfreq[i]] - DoSimi(self, param = paramsimi, fromprof = ffr(self.filename), pathout = pathout, wordgraph = word) + if self.tmpchi is None : + self.tmpchi = tempfile.mktemp(dir=self.Source.parent.TEMPDIR) + with open(self.tmpchi, 'w') as f: + f.write('\n'.join([str(val) for val in self.lchi])) + index = self.la.index(word) + parametres = {'type' : 'clustersimitxt', + 'pathout' : self.Source.parametres['pathout'], + 'word' : index , + 'lem' : self.Source.parametres['lem'], + 'tmpchi' : self.tmpchi} + #try : + self.parent.SimiFromCluster(self.parent, self.Source.corpus, self.la, self.cl - 1, parametres = parametres, dlg = progressbar(self, 4)) + #except : + # print 'not acitve' def on_graph(self, evt): - self.parent.SimiFromCluster(self.parent, self.Source.corpus, self.la, self.cl - 1, parametres = {'type' : 'clustersimitxt', 'pathout' : self.Source.parametres['pathout']}, dlg = progressbar(self, 4)) + if self.tmpchi is None : + self.tmpchi = tempfile.mktemp(dir=self.Source.parent.TEMPDIR) + with open(self.tmpchi, 'w') as f: + f.write('\n'.join([str(val) for val in self.lchi])) + parametres = {'type' : 'clustersimitxt', + 'pathout' : self.Source.parametres['pathout'], + 'lem' : self.Source.parametres['lem'], + 'tmpchi' : self.tmpchi} + + self.parent.SimiFromCluster(self.parent, self.Source.corpus, self.la, self.cl - 1, parametres = parametres, dlg = progressbar(self, 4)) #dlg = progressbar(self, 2) #corpus = self.Source.corpus #uces = corpus.lc[self.cl-1]