X-Git-Url: http://iramuteq.org/git?a=blobdiff_plain;ds=inline;f=tabchi2.py;h=422b44735d1facb7f79f9156cf3068cfea561c47;hb=f24454f5d67c621e94a76410a1e8e9a83c0c138b;hp=6a8cf550460d44717147356c65b3f72c52978625;hpb=8fa853a25a9d62b1446e1bc543e5a3a4d0e03dcf;p=iramuteq
diff --git a/tabchi2.py b/tabchi2.py
index 6a8cf55..422b447 100755
--- a/tabchi2.py
+++ b/tabchi2.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2010 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import HTML
import os
@@ -16,6 +16,7 @@ import wx.lib.sized_controls as sc
from time import sleep
from functions import exec_rcode, check_Rresult
from dialog import ChiDialog, PrefChi
+from analysematrix import AnalyseMatrix
def make_res(line) :
if float(line[5]) <= 0.05 and line[6] != 'warning':
@@ -45,11 +46,21 @@ def make_title(res, text) :
return ['
%s
retour
' % (i, val[-1], text[i], i) for i, val in enumerate(res)]
-
+chioption = { 'valobs' : True,
+ 'valtheo' : True,
+ 'resi' : False,
+ 'contrib' : True,
+ 'pourcent' : False,
+ 'pourcentl' : True,
+ 'pourcentc' : True,
+ 'graph' : True,
+ 'bw' : False,
+ }
class MakeChi2():
- def __init__(self, parent, select1, select2, chioption):
+ def __init__(self, parent, select1, select2, chioption, tableau):
+ self.tableau = tableau
self.OutFrame=tempfile.mktemp(dir=parent.TEMPDIR)
print self.OutFrame
self.parent=parent
@@ -59,7 +70,7 @@ class MakeChi2():
self.TextCroise=[]
for i in select1 :
for j in select2 :
- self.TextCroise.append(parent.tableau.colnames[i] + ' / ' + parent.tableau.colnames[j])
+ self.TextCroise.append(self.tableau.colnames[i] + ' / ' + self.tableau.colnames[j])
rchioption = {}
for val in chioption :
if chioption[val]:
@@ -88,11 +99,11 @@ class MakeChi2():
bw <- %s
""" % (rchioption['valobs'], rchioption['valtheo'], rchioption['contrib'], rchioption['resi'], rchioption['pourcent'], rchioption['pourcentl'], rchioption['pourcentc'], rchioption['graph'], rchioption['bw'])
txt+="""
- datadm <- ReadData("%s", encoding="%s", header = TRUE, sep = "%s",quote = '%s', na.strings = "%s",rownames= 1)
+ datadm <- read.csv2("%s", encoding="%s", header = TRUE, row.names = 1, sep='\\t', quote = '"', na.string = '')
listres<-list()
listcol<-list()
cont<-1
- """%(ffr(parent.tableau.parametre['csvfile']),self.parent.encode, parent.tableau.parametre['colsep'], parent.tableau.parametre['txtsep'], self.parent.nastrings)
+ """%(ffr(self.tableau.parametres['csvfile']), self.tableau.parametres['syscoding'])
if len(select1)==1:
strsel1=str(select1).replace(',','')
else:
@@ -148,9 +159,7 @@ class MakeChi2():
chi$prl <- round((chi$observed/sr)*100,2)
chi$prc <- t(round((t(chi$observed)/sc)*100,2))
}
- fileout<-paste('histo',%i,sep='')
- fileout<-paste(fileout,'_',sep='')
- fileout<-paste(fileout,count,sep='')
+ fileout<-paste('histo_',count,sep='')
fileout<-paste(fileout,'.png',sep='')
count<-count+1
fileout<-file.path("%s",fileout)
@@ -258,7 +267,7 @@ class MakeChi2():
li<-matrix('fin_analyse',1,maxcol)
frameout<-rbind(frameout,li)
write.csv2(frameout,file="%s")
- """%(parent.FreqNum,ffr(parent.TEMPDIR),ffr(self.OutFrame))
+ """ % (ffr(parent.TEMPDIR),ffr(self.OutFrame))
tmpfile=tempfile.mktemp(dir=self.TEMPDIR)
print tmpfile
tmpscript=open(tmpfile,'w')
@@ -350,77 +359,381 @@ class MakeChi2():
txt = '