txt += """
mat <- as.matrix(stats::as.dist(mat,diag=TRUE,upper=TRUE))
mat[is.na(mat)] <- 0
- mat[is.infinite(mat)] <- 0
+ if (length(which(mat == Inf))) {
+ infp <- which(mat == Inf)
+ mat[infp] <- NA
+ maxmat <- max(mat, na.rm = TRUE)
+ if (maxmat > 0) {
+ maxmat <- maxmat + 1
+ } else {
+ maxmat <- 0
+ }
+ mat[infp] <- maxmat
+ }
+ if (length(which(mat == -Inf))) {
+ infm <- which(mat == -Inf)
+ mat[infm] <- NA
+ minmat <- min(mat, na.rm = TRUE)
+ if (maxmat < 0) {
+ minmat <- minmat - 1
+ } else {
+ minmat <- 0
+ }
+ mat[infm] <- minmat
+ }
"""
if 'word' in self.parametres and not self.parametres['keep_coord'] :
txt += """
if self.parametres['type'] == 'clustersimitxt' and self.parametres.get('sfromchi', False) :
txt += """
vertex.size <- norm.vec(lchi, minmaxeff[1], minmaxeff[2])
+ if (!length(vertex.size)) vertex.size <- 0
"""
else :
txt += """
if (is.null(minmaxeff[1])) {
- vertex.size <- NULL
+ vertex.size <- 0
} else {
vertex.size <- graph.simi$eff
}
"""
- txt += """ vertex.size <- NULL """
+ #txt += """ vertex.size <- NULL """
if self.parametres['svg'] : svg = 'TRUE'
else : svg = 'FALSE'
txt += """
svg <- %s
""" % svg
txt += """
- coords <- plot.simi(graph.simi, p.type='%s',filename="%s", vertex.label = label.v, edge.label = label.e, vertex.col = cols, vertex.label.color = vertex.label.color, vertex.label.cex=label.cex, vertex.size = vertex.size, edge.col = cola, leg=leg, width = width, height = height, alpha = alpha, movie = film, svg = svg)
+ vertex.col <- cols
+ if (!is.null(graph.simi$com)) {
+ com <- graph.simi$com
+ colm <- rainbow(length(com))
+ if (vertex.size != 0 || graph.simi$halo) {
+ vertex.label.color <- 'black'
+ vertex.col <- colm[membership(com)]
+ } else {
+ vertex.label.color <- colm[membership(com)]
+ }
+ }
+ coords <- plot.simi(graph.simi, p.type='%s',filename="%s", vertex.label = label.v, edge.label = label.e, vertex.col = vertex.col, vertex.label.color = vertex.label.color, vertex.label.cex=label.cex, vertex.size = vertex.size, edge.col = cola, leg=leg, width = width, height = height, alpha = alpha, movie = film, svg = svg)
save.image(file="%s")
""" % (type, self.filename, self.pathout['RData'])
if ( what == 0 ) table.in <- afc$colcoord
if ( what == 1 ) table.in <- afc$colcrl
rownames(table.in) <- afc$colnames
+ eff <- afc$colmass
if (typegraph == 0) {
table.in<-table.in[,c(x,y)]
} else {
ry <- range(table.in[,2], na.rm = TRUE)
rz <- range(table.in[,3], na.rm = TRUE)
}
- eff <- rowSums(afctable)
+ if (exists(afctable)) {
+ eff <- rowSums(afctable)
+ } else {
+ eff <- afctable$rowmass
+ }
+
if (!is.null(debsup)) {
if ( qui == 0 ) {
table.in <- table.in[1:(debsup-1),]
weori<-get.edge.attribute(g1,'weight')
if (max.tree) {
if (method == 'cooc') {
- invw<-1/weori
+ invw <- 1 / weori
} else {
-
+ invw <- 1 - weori
}
E(g1)$weight<-invw
g.max<-minimum.spanning.tree(g1)
- E(g.max)$weight<-1/E(g.max)$weight
+ if (method == 'cooc') {
+ E(g.max)$weight<-1 / E(g.max)$weight
+ } else {
+ E(g.max)$weight<-1 - E(g.max)$weight
+ }
g.toplot<-g.max
}
if (is.null(graph.simi$com)) {
plot(g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo)#, rescale = FALSE)
} else {
- com <- graph.simi$com
- colm <- rainbow(length(com))
- if (vertex.size != 0 || graph.simi$halo) {
- vertex.label.color <- 'black'
- vertex.col <- colm[membership(com)]
- } else {
- vertex.label.color <- colm[membership(com)]
- }
if (graph.simi$halo) {
- mark.groups <- communities(com)
+ mark.groups <- communities(graph.simi$com)
} else {
mark.groups <- NULL
}
library('rgl')
#rgl.open()
#par3d(cex=0.8)
- rglplot(g.toplot,vertex.label= vire.nonascii(v.label), edge.width=we.width/10, vertex.size=0.01, vertex.color=vertex.col, vertex.label.color="black", edge.color = edge.col, layout=lo)
- los <- layout.norm(lo, -1, 1, -1, 1, -1, 1)
- rgl.spheres(los, col = vertex.col, radius = vertex.size/100, alpha = alpha)
- rgl.bg(color = c('white','black'))
+ lo <- layout.norm(lo, -10, 10, -10, 10, -10, 10)
+ rglplot(g.toplot,vertex.label='', edge.width=we.width/10, vertex.size=0.01, vertex.color=vertex.col, vertex.label.color="black", edge.color = edge.col, layout=lo, rescale = FALSE)
+ #los <- layout.norm(lo, -1, 1, -1, 1, -1, 1)
+ text3d(lo[,1], lo[,2], lo[,3], vire.nonascii(v.label), col = vertex.label.color, alpha = 1, cex = vertex.label.cex)
+ rgl.spheres(lo, col = vertex.col, radius = vertex.size/100, alpha = alpha)
+ rgl.bg(color = c('white','black'))
if (!is.null(movie)) {
require(tcltk)
ReturnVal <- tkmessageBox(title="RGL 3 D",message="Cliquez pour commencer le film",icon="info",type="ok")
for uci in self.ucis :
get = list(set(uci.etoiles).intersection(etoiles))
if len(get) > 1 :
- return '2 variables sur la meme ligne'
- elif get != [] :
+ log.info('2 variables sur une ligne')
+ if get != [] :
etuces[etoiles.index(get[0])] += [uce.ident for uce in uci.uces]
etuces = [set(val) for val in etuces]
tab = []
log.info(u'Empty text : %i' % linenb)
iduci -= 1
self.corpus.ucis.pop()
- #raise Exception("EmptyText %i" % linenb)
self.corpus.ucis.append(Uci(iduci, line))
if self.dlg is not None :
if not (iduci + 1) % 10 :
idpara += 1
self.corpus.ucis[-1].paras.append(line.split()[0])
else :
- raise Exception('paragrapheOT')
+ raise Exception('paragrapheOT %i' % linenb)
elif line.strip() != '' and iduci != -1 :
txt.append(line)
if txt != [] and iduci != -1 :
iduce, idpara = self.treattxt(txt, iduce, idpara, iduci)
del(txt)
else :
- raise Exception("EmptyText")
+ if iduci != -1 :
+ iduci -= 1
+ self.corpus.ucis.pop()
+ log.info(Exception("Empty text %i" % linenb))
+ else :
+ raise Exception('EmptyText %i' % linenb)
if iduci != -1 and iduce != -1:
self.backup_uce()
else :
log.info(_(u"No Text in corpora. Are you sure of the formatting ?"))
- raise Exception('TextBeforeTextMark')
+ raise Exception('TextBeforeTextMark %i' % linenb)
except UnicodeDecodeError :
raise Exception("CorpusEncoding")
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
kwds["size"] = wx.Size(500, 200)
wx.Dialog.__init__(self, *args, **kwds)
+ self.SetTitle(kwds['title'])
self.text_ctrl_1 = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
+ self.text_ctrl_1.SetBackgroundColour('#DDE8EB')
self.button_1 = wx.Button(self, wx.ID_OK, "")
self.__set_properties()
def __set_properties(self):
# begin wxGlade: MyDialog.__set_properties
- self.SetTitle("Bug")
self.SetMinSize(wx.Size(500, 200))
self.text_ctrl_1.SetMinSize(wx.Size(500, 200))
# si on a rien trouvé
return False, chaine.split(), ''
+
+exceptions = {'paragrapheOT' : u"Un problème de formatage (présence d'un marqueur de paragraphe (-*) en dehors d'un texte) est survenu à la ligne ",
+ 'EmptyText' : u"Texte vide (probablement un problème de formatage du corpus). Le problème est apparu à la ligne ",
+ 'CorpusEncoding' : u"Problème d'encodage.",
+ 'TextBeforeTextMark' : u"Problème de formatage : du texte avant le premier marqueur de texte (****). Le problème est survenu à la ligne ",
+}
+
def BugReport(parent, error = None):
for ch in parent.GetChildren():
if "<class 'wx._windows.ProgressDialog'>" == str(type(ch)):
ch.Destroy()
excName, exc, excTb = formatExceptionInfo()
if excName == 'Exception' :
- txt = 'Message :\n'
+ print exc
+ if len(exc.split()) == 2 :
+ mss, linenb = exc.split()
+ if mss in exceptions :
+ txt = exceptions[mss] + linenb
+ else :
+ txt = exc
+ else :
+ if exc in exceptions :
+ txt = exceptions[mss]
+ else :
+ txt = exc
+ title = "Information"
else :
txt = u' !== BUG ==! \n'
txt += u'*************************************\n'
txt += '\n'.join(excTb).replace(' ', ' ')
txt += excName + '\n'
- txt += exc
+ txt += exc
+ title = "Bug"
- dial = BugDialog(parent)
+ dial = BugDialog(parent, **{'title' : title})
if 'Rerror' in dir(parent) :
txt += parent.Rerror
parent.Rerror = ''