def toNum(): for size in ["all"]: iFile = "%s/online_all.csv" % datPath oFile1 = "%s/onlineT_all.csv" % datPath # data for Take.core oFile2 = "%s/onlineO_all.basket" % datPath # data for Orange oFile3 = "%s/onlineM_all.csv" % datPath # data for Take f = None f <<= nm.mcut(f="InvoiceNo,StockCode", i=iFile) f <<= nm.muniq(k="InvoiceNo,StockCode") f <<= nm.mfldname(q=True, o=oFile3) f.run(msg=debug) st = None st <<= nm.mcut(f="StockCode", i=iFile) st <<= nm.muniq(k="StockCode") st <<= nm.mnumber(s="StockCode", a="num") f = None f <<= nm.mjoin(k="StockCode", m=st, f="num", i=iFile) f <<= nm.mcut(f="InvoiceNo,num:StockCode") f <<= nm.mtra(k="InvoiceNo", f="StockCode") f <<= nm.mcut(f="StockCode", nfno=True, o=oFile1) f.run(msg=debug) os.system("tr ' ' ',' <%s >%s" % (oFile1, oFile2))
def __init__(self,db): self.db=db self.eArgs=None self.type =None self.minCnt=None self.minSup=None self.maxCnt=None self.maxSup=None self.minLen=None self.maxLen=None self.top =None self.skipTP=False #self.size =None self.pFile =None self.tFile =None self.msgoff = True self.temp=mtemp.Mtemp() self.db = db # 入力データベース self.file=self.temp.file() items=self.db.items # アイテムをシンボルから番号に変換する。 f = nm.mjoin(k=self.db.itemFN,K=items.itemFN,m=items.file,f=items.idFN,i=self.db.file) f <<= nm.mcut(f=self.db.idFN+","+items.idFN) f <<= nm.mtra(k=self.db.idFN,f=items.idFN) f <<= nm.mcut(f=items.idFN,nfno=True,o=self.file) f.run()
def __mkMap(key, nf, ni, ef1, ef2, ei, oFile): # leaf nodeの構築 infL = [ nm.mcommon(k=ef1, K=key, m=ei, r=True, i=ei).mcut(f="%s:nam" % (ef1)), nm.mcommon(k=ef2, K=key, m=ei, r=True, i=ei).mcut(f="%s:nam" % (ef2)) ] if ni: infL.append( nm.mcommon(k=nf, K=key, m=ei, r=True, i=ni).mcut(f="%s:nam" % (nf))) xleaf = nm.muniq(i=infL, k="nam") xleaf <<= nm.msetstr(v=1, a="leaf") if ni: inp = [ nm.mcut(f="%s:nam" % (nf), i=ni), nm.mcut(f="%s:nam" % (key), i=ni) ] else: inp = [ nm.mcut(f="%s:nam" % (ef1), i=ei), nm.mcut(f="%s:nam" % (ef2), i=ei), nm.mcut(f="%s:nam" % (key), i=ei) ] f = None f <<= nm.muniq(k="nam", i=inp) f <<= nm.mjoin(k="nam", m=xleaf, f="leaf", n=True) # nullは最初に来るはずなので、mcalでなくmnumberでもnullを0に採番できるはずだが念のために f <<= nm.mcal(c='if(isnull($s{nam}),0,line()+1)', a="num") f <<= nm.mnullto(f="nam", v="##NULL##", o=oFile) f.run()
def pair2tra(self, ei, ef1, ef2, traFile, mapFile1, mapFile2): f1 = None f1 <<= nm.mcut(f="{}:node1".format(self.ef1), i=self.ei) f1 <<= nm.mdelnull(f="node1") f1 <<= nm.muniq(k="node1") f1 <<= nm.mnumber(s="node1", a="num1", o=mapFile1) f2 = None f2 <<= nm.mcut(f="{}:node2".format(self.ef2), i=self.ei) f2 <<= nm.mdelnull(f="node2") f2 <<= nm.muniq(k="node2") f2 <<= nm.mnumber(s="node2", a="num2", o=mapFile2) f3 = None f3 <<= nm.mcut(f="{}:node1,{}:node2".format(self.ef1, self.ef2), i=self.ei) f3 <<= nm.mjoin(k="node1", m=f1, f="num1") f3 <<= nm.mjoin(k="node2", m=f2, f="num2") f3 <<= nm.mcut(f="num1,num2") f3 <<= nm.msortf(f="num1,num2%n") f3 <<= nm.mtra(k="num1", s="num2%n", f="num2") f3 <<= nm.msortf(f="num1%n") f3 <<= nm.mcut(f="num2", nfno=True, o=traFile) f3.run() os.system("cat " + traFile)
def edge2mtx(self, ei, itra, map1, map2): p1 = nm.mcut(f=self.ef1, i=ei) p1 <<= nm.muniq(k=self.ef1) p1 <<= nm.mdelnull(f=self.ef1) p1 <<= nm.mnumber(q=True, a="num1", S=1, o=map1) p2 = nm.mcut(f=self.ef2, i=ei) p2 <<= nm.muniq(k=self.ef2) p2 <<= nm.mdelnull(f=self.ef2) p2 <<= nm.mnumber(q=True, a="num2", S=1, o=map2) runp = None runp <<= nm.mcut(f=[self.ef1, self.ef2], i=ei) runp <<= nm.mjoin(k=self.ef1, m=p1, f="num1") runp <<= nm.mjoin(k=self.ef2, m=p2, f="num2") runp <<= nm.mcut(f="num1,num2") runp <<= nm.mtra(k="num1", f="num2") runp <<= nm.msortf(f="num1%n") runp <<= nm.mcut(f="num2", nfno=True) runp <<= nm.cmd("tr ',' ' '") runp <<= nm.mwrite(o=itra) #runp <<= nm.mcut(f="num2",nfno=True,o=wff1) runp.run()
def __init__(self, db, outtf=True): self.size = None self.pFile = None self.tFile = None self.temp = mtemp.Mtemp() self.db = db # 入力データベース self.file = self.temp.file() self.outtf = outtf self.weightFile = {} self.posWeight = {} self.sigma = {} self.msgoff = True items = self.db.items for cName, posSize in db.clsNameRecSize.items(): self.weightFile[cName] = self.temp.file() self.posWeight[cName] = self.calOmega(posSize) f = nm.mcut(nfno=True, f=self.db.clsFN, i=self.db.cFile) f <<= nm.mchgstr(nfn=True, f=0, O=-1, o=self.weightFile[cName], c="%s:%s" % (cName, self.posWeight[cName])) f.run() # アイテムをシンボルから番号に変換する。 f = nm.mjoin(k=self.db.itemFN, K=items.itemFN, i=self.db.file, m=items.file, f=items.idFN) f <<= nm.mcut(f=self.db.idFN + "," + items.idFN) f <<= nm.mtra(k=self.db.idFN, f=items.idFN) f <<= nm.mcut(f=items.idFN, nfno=True, o=self.file) f.run()
def mkIndex(oFile, iFile): f = None f <<= nm.mcat(i=iFile) f <<= nm.mcut(f="date,c") f <<= nm.mavg(k="date", f="c") f <<= nm.mcal(c="round(${c},1)", a="i") f <<= nm.mcut(f="date,i", o="%s" % oFile) f.run()
def mcut(iFile, loop): sec = [] for i in range(loop): st = time.time() nm.mcut(f="id,key1,key2,key3,int1,int2,float1,float2,date,time", i=iFile, o="oFile").run() sec.append(time.time() - st) return sec
def __mkEdge(key, ef1, ef2, el, ec, ed, ev, ei, norm, mapFile, oFile): # mcal cat用のlabel項目の作成 label = [] if el: for nml in el: label.append("$s{" + nml + "}") evcdStr = [] #エッジの拡大率は固定 er = 10 if ev: evcdStr.append(ev + ":ev") if ec: evcdStr.append(ec + ":ec") if ed: evcdStr.append(ed + ":ed") f = None if el: f <<= nm.mcal(c='cat(\"_\",%s)' % (','.join(label)), a="##label", i=ei) else: f <<= nm.msetstr(v="", a="##label", i=ei) if len(evcdStr) == 0: f <<= nm.mcut(f="%s:key,%s:nam1,%s:nam2,##label:el" % (key, ef1, ef2)) else: f <<= nm.mcut(f="%s:key,%s:nam1,%s:nam2,##label:el,%s" % (key, ef1, ef2, ','.join(evcdStr))) if not ev: f <<= nm.msetstr(v="", a="ev") if not ed: f <<= nm.msetstr(v="", a="ed") if not ec: f <<= nm.msetstr(v="", a="ec") f <<= nm.mnullto(f="key", v="##NULL##") f <<= nm.mjoin(k="key", K="nam", m=mapFile, f="num:keyNum") f <<= nm.mjoin(k="nam1", K="nam", m=mapFile, f="num:num1,leaf:leaf1") f <<= nm.mjoin(k="nam2", K="nam", m=mapFile, f="num:num2,leaf:leaf2") if norm: f <<= nm.mnormalize(f="ev:ev2", c="range") f <<= nm.mcal(c='${ev2}*(%s-1)+1' % (er), a="evv") f <<= nm.mcut( f="key,nam1,nam2,keyNum,num1,num2,el,evv:ev,ed,ec,leaf1,leaf2", o=oFile) else: f <<= nm.mcut( f="key,nam1,nam2,keyNum,num1,num2,el,ev,ed,ec,leaf1,leaf2", o=oFile) f.run()
def __readNodeCSV(self, nodeFile=None, title=None): if nodeFile is not None: self.nFileN = nodeFile if title is None: mcmd = nm.mcut(nfni=True, f="0:n", i=self.nFileN) else: self.nodeFN = title mcmd = nm.mcut(f="%s:n" % (self.nodeFN), i=self.nFileN) self.__wfN = self.__tempW.file() mcmd <<= nm.mnumber(q=True, a="no", o=self.__wfN) mcmd.run()
def __readEdgeCSV(self, edgeFile=None, title1=None, title2=None): self.eFileN = edgeFile if title1 is None or title2 is None: mcmd = nm.mcut(nfni=True, f="0:e1,1:e2", i=self.eFileN) else: self.edgeFN1 = title1 self.edgeFN2 = title2 mcmd = nm.mcut(f="%s:e1,%s:e2" % (self.edgeFN1, self.edgeFN2), i=self.eFileN) self.__wfE = self.__tempW.file() mcmd <<= nm.mnumber(q=True, a="no", o=self.__wfE) mcmd.run()
def convSim(self, ifile, ofile, map1, logDir): f = None f <<= nm.mcut(nfni=True, f="0:tra", i=ifile) f <<= nm.msed(f="tra", c=' $', v="") f <<= nm.mnumber(q=True, S=1, a="num1") f <<= nm.mtra(r=True, f="tra:num11") f <<= nm.mnumber(q=True, S=1, a="order") f <<= nm.mcal(c='${num11}+1', a="num1") f <<= nm.mjoin(k="num1", m=map1, f=self.ef1) f <<= nm.mtra(k="num0", s="order%n,num1%n", f=self.ef1) f <<= nm.mcut(f=self.ef1, o="{}/{}".format(logDir, ofile)) f.run()
def calGsize(self, file): edgesize = nu.mrecount(i=file, nfni=True) f = None f <<= nm.mcut(i=file, f="0:tra", nfni=True) f <<= nm.mtra(f="tra") f <<= nm.muniq(k="tra") f <<= nm.mcount(a="cnt") f <<= nm.mcut(f="cnt") f <<= nm.writelist(dtype="cnt:int") nodesize = f.run()[0][0] return nodesize, edgesize
def readCSV(iParams): iFile = iParams["iFile"] sidF = iParams["sid"] eidF = iParams["time"] itemF = iParams["item"] temp = Mtemp() xxdatPath = temp.file() mkDir(xxdatPath) # classファイルの処理 if "cFile" in iParams: cFile = iParams["cFile"] csidF = iParams["csid"] classF = iParams["cNames"] f = None f <<= nm.mcut(f="%s:sid,%s:eid,%s:item" % (sidF, eidF, itemF), i=iFile) f <<= nm.mdelnull(f="sid,eid,item") f <<= nm.muniq(k="sid,eid,item") f <<= nm.mjoin(k="sid", K=csidF, m=cFile, f="%s:class" % (classF)) f <<= nm.msep(s="sid,eid%n,item", d="%s/${class}" % (xxdatPath), p=True) f.run() classNames = glob.glob("%s/*" % (xxdatPath)) classNames = [os.path.basename(path) for path in classNames] else: f = None f <<= nm.mcut(f="%s:sid,%s:eid,%s:item" % (sidF, eidF, itemF), i=iFile) f <<= nm.mdelnull(f="sid,eid,item") f <<= nm.muniq(k="sid,eid,item") f <<= nm.msortf(f="sid,eid%n,item", o="%s/single" % (xxdatPath)) f.run() classNames = ["single"] datas = {} for name in classNames: dataFile = "%s/%s" % (xxdatPath, name) datas[name] = _readCSV_sub(dataFile) return datas
def nm2(iFile): f = None f <<= nm.mcut(f="id,date,c", i=iFile) f <<= nm.mwindow(k="id", wk="date:win", t=3) f <<= nm.mavg(k="id,win", f="c") f <<= nm.writelist(dtype="win:int,date:int,c:float") r = f.run()
def convOrg(self,xxmap,xxout,ofile): xx1 = nm.mnumber(q=True,S=0,a="num",i=xxout) f = nm.mjoin(k="num",f="cls",m=xx1,i=xxmap) f <<= nm.mcut(f="node,cls", o=ofile) f.run()
def conv(self,iFile,idFN,itemFN,oFile,mapFile): temp=nu.Mtemp() xxtra=temp.file() # 入力ファイルのidがnilの場合は連番を生成して新たなid項目を作成する。 f0 = nm.mcut(f=itemFN+":##item",i=iFile) f0 <<= nm.mcount(k="##item",a="##freq") f0 <<= nm.mnumber(s="##freq%nr",a="##num",o=mapFile) f0.run() f1 = nm.mjoin(k=itemFN,K="##item",f="##num",m=mapFile,i=iFile,o=xxtra) f1.run() #f1 <<= nm.mtra(k=idFN,f="##num") #f1 <<= nm.mnumber(q=True,a="##traID") #f1 <<= nm.mcut(f="##num",nfno=True,o=oFile) extTake.mmaketra(i=xxtra,o=oFile,f="##num",k=idFN) #f1.run() # ##item,##freq%0nr,##num # b,4,0 # d,4,1 size=nu.mrecount(i=oFile,nfn=True) return size
def addTaxo(self, taxonomy): self.taxonomy = taxonomy self.items.addTaxo(self.taxonomy) # アイテムクラスにtaxonomyを追加する tFile = taxonomy.file itemFN = taxonomy.itemFN taxoFN = taxonomy.taxoFN tf = nu.Mtemp() xx1 = tf.file() cpara = "%s,%s:%s" % (self.idFN, taxoFN, self.itemFN) f = None f <<= nm.mnjoin(i=self.file, k=self.itemFN, K=itemFN, f=taxoFN, m=tFile) f <<= nm.mcut(f=cpara, o=xx1) f.run() ipara = "%s,%s" % (self.file, xx1) kpara = "%s,%s" % (self.idFN, self.itemFN) xx2 = tf.file() nm.mcat(i=ipara).muniq(k=kpara, o=xx2).run(msg="on") self.file = self.temp.file() shutil.move(xx2, self.file)
def __readEdgeList(self, edgeList=None, title1=None, title2=None): if title1 is not None and title2 is not None: self.edgeFN1 = title1 self.edgeFN2 = title2 mcmd = nm.mcut(nfni=True, f="0:e1,1:e2", i=edgeList) self.__wfE = self.__tempW.file() mcmd <<= nm.mnumber(q=True, a="no", o=self.__wfE) mcmd.run()
def runmain(self,edgeFile): import re baseName = re.sub('\.edge$',"",edgeFile) name = re.sub('^.*\/',"",baseName) if self.ni : nodeFile=self.ni else : nodeFile=re.sub('\.edge$',".node",edgeFile) # convert the original graph to one igraph can handle temp=Mtemp() xxnum = temp.file() xxmap = temp.file() xxout = temp.file() xxscp = temp.file() xxweight=temp.file() nodeSize=self.g2pair( nodeFile,self.nf,edgeFile,self.ef1,self.ef2,self.ew,xxnum,xxmap,xxweight ) # generate R script, and run self.genRscript( self.directed,self.norm,self.mode, xxnum, xxweight, self.ew,nodeSize, xxout, xxscp ) if self.verbose : os.system("R --vanilla -q < %s"%(xxscp)) else: os.system("R --vanilla -q --slave < %s 2>/dev/null "%(xxscp)) f = None f <<= nm.mnumber(q=True,S=0,a="num",i=xxout) f <<= nm.mjoin(k="num",f="node",m=xxmap ) outf = self.oPath + "/" +name + ".csv" if self.nf : f <<= nm.mcut(f="node:%s,degree,cc,components,betweenness,closeness,page_rank"%(self.nf),o=outf) else: f <<= nm.mcut(f="node,degree,cc,components,betweenness,closeness,page_rank",o=outf) f.run()
def g2pair(self,ni,nf,ei,ef1,ef2,ew,numFile,mapFile,weightFile): inobj = [] inobj.append(nm.mcut(f="%s:node"%(ef1),i=ei ).msetstr(a="flag",v=0)) inobj.append(nm.mcut(f="%s:node"%(ef2),i=ei ).msetstr(a="flag",v=0)) if nf : inobj.append(nm.mcut(f="%s:node"%(nf),i=ni ).msetstr(a="flag",v=1)) f = nm.mbest(i=inobj,k="node",s="flag",fr=0,size=1 ) # isolated nodes are set to the end of position in mapping file. # S= must start from 0 (but inside R vertex number will be added one) f <<= nm.mnumber(s="flag,node",a="num",S=0,o=mapFile) f.run() f = None f <<= nm.mcut(f=[ef1,ef2] , i=ei) f <<= nm.mjoin( k=ef1 , K="node" , m=mapFile ,f="num:num1") f <<= nm.mjoin( k=ef2 , K="node" , m=mapFile ,f="num:num2") f <<= nm.mcut(f="num1,num2") f <<= nm.mfsort(f="num1,num2") f <<= nm.msortf(f="num1%n,num2%n",nfno=True) f <<= nm.cmd("tr ',' ' ' " ) f <<= nm.mwrite(o=numFile) f.run() nodeSize=mrecount(i=mapFile) if ew: nm.mcut(f=ew,i=ei,o=weightFile).run() else: ew="weight" nm.msetstr(v=1,a=ew,i=ei).mcut(f=ew,o=weightFile).run() return nodeSize
def mnest2tree(ei, ef, k, ni=None, nf=None, ev=None, no=None, eo=None): # paracheck追加 efs = ef.split(",") ef1 = efs[0] ef2 = efs[1] f = nm.mcut(f="%s:#orgKey,%s:#orgEf1,%s:#orgEf2" % (k, ef1, ef2), i=ei) temp = mtemp.Mtemp() of = temp.file() with _nu.mcsvout(o=of, f="#orgKey,#orgEf1,#orgEf2,#ef1,#ef2") as oCSV: for flds in f: orgKey = flds[0] orgEf1 = flds[1] orgEf2 = flds[2] oCSV.write([orgKey, orgEf1, orgEf2, orgKey, orgEf1]) oCSV.write([orgKey, orgEf1, orgEf2, orgKey, orgEf2]) f = None f <<= nm.mjoin(k="#orgKey,#orgEf1,#orgEf2", K=[k, ef1, ef2], m=ei, i=of) # 全項目join if ev: f <<= nm.mavg(k="#ef1,#ef2", f=ev) else: f <<= nm.muniq(k="#ef1,#ef2") f <<= nm.mcut(r=True, f="#orgKey,#orgEf1,#orgEf2") f <<= nm.mfldname(f="#ef1:%s,#ef2:%s" % (ef1, ef2), o=eo) f.run() if ni: head = nu.mheader(i=ni) fldnames = [s for s in head if s != nf] commas = ',' * (len(fldnames) - 1) f0 = None f0 <<= nm.mcut(f="%s:%s" % (ef1, nf), i=eo) f0 <<= nm.muniq(k=nf) f0 <<= nm.mcommon(k=nf, m=ni, r=True) f0 <<= nm.msetstr(v=commas, a=fldnames) f = nm.mcut(f=k, r=True, i=[ni, f0]) f <<= nm.msetstr(v="", a=k, o=no) f.run()
def calTime(iFile, oFile): f = None f <<= nm.mnumber(q=True, a="id", i=iFile) f <<= nm.mcal(c='$s{mean}+"("+$s{sd}+")"', a="time") f <<= nm.m2cross(k="method", s="dataSize", f="time") f <<= nm.msortf(f="id%n") f <<= nm.mcut(f="method,10000:small,1000000:middle,100000000:large") f <<= nm.mfldname(q=True, o=oFile) f.run()
def replaceFile(self, train): self.file = train # レコード数の計算 self.recCnt = nu.mrecount(i=self.file) xx1 = nm.mcut(f=self.idFN, i=self.file).muniq(k=self.idFN).mcount( a='__cnt').mcut(a='__cnt').run() self.traSize = int(xx1[0][0])
def __init__(self, db, outtf=True): self.size = None self.temp = mtemp.Mtemp() self.db = db # 入力データベース self.file = self.temp.file() items = self.db.items self.outtf = outtf self.top = None self.msgoff = True # アイテムをシンボルから番号に変換する。 f = nm.mjoin(k=self.db.itemFN, K=items.itemFN, m=items.file, f=items.idFN, i=self.db.file) f <<= nm.mcut(f=self.db.idFN + "," + self.db.timeFN + "," + items.idFN) f <<= nm.mtra(k=self.db.idFN, s=self.db.timeFN + "%n", f=items.idFN) f <<= nm.mcut(f=items.idFN, nfno=True, o=self.file) f.run()
def tra2tbl(iFile, oFile, tidFld, itemFld, null=0, dummy=True, aggFld=None, aggStat=None, klassFld=None): klass = None if klassFld is not None and klassFld != "": klass <<= nm.mcut(f=tidFld + "," + klassFld, i=iFile) klass <<= nm.muniq(k=tidFld) f = None # aggFldが指定されていればセル項目を集計 if aggFld is not None and aggFld != "": f <<= nm.mcut(f=tidFld + "," + itemFld + "," + aggFld, i=iFile) f <<= nm.mstats(k=tidFld, f="%s:_cell" % (aggFld), c=aggStat) # aggFldが指定されていなければカウント else: f <<= nm.mcut(f=tidFld + "," + itemFld, i=iFile) # アイテムが出現したかどうか if dummy: f <<= nm.muniq(k=tidFld + "," + itemFld) f <<= nm.msetstr(v=1, a="_cell") # アイテムが何件出現したかどうか else: f <<= nm.mcount(k=tidFld + "," + itemFld, a="_cell") # 横展開 f <<= nm.m2cross(k=tidFld, s=itemFld, f="_cell") # クラス項目が指定されていれば結合する if klassFld is not None and klassFld != "": f <<= nm.mjoin(k=tidFld, m=klass, f=klassFld) # null値を一斉に置換する f <<= nm.mnullto(f="*", v=null, o=oFile) f.run(msg="on")
def __init__(self,iFile,itemFN,taxoFN): # アイテムの項目名(=>String) self.itemFN = None # 分類の項目名(=>String) self.taxoFN = None # アイテムの種類数(=>Fixnum) self.itemSize = None # 分類の種類数(=>Fixnum) self.taxoSize = None # taxonomyデータファイル名(=>String) self.file = None self.temp = mtemp.Mtemp() self.iFile = iFile self.iPath = os.path.abspath(self.iFile) self.itemFN = itemFN self.taxoFN = taxoFN # item順に並べ替えてpathに書き出す self.file = self.temp.file() para_it = self.itemFN +"," + self.taxoFN nm.mcut(f=para_it,i=self.iFile).muniq(k=para_it,o=self.file).run(msg="on") f = nm.mcut(f=self.itemFN,i=self.iFile) f <<= nm.mtrafld(f=self.itemFN,a="__fld",valOnly=True) f <<= nm.mtra(f="__fld",r=True) f <<= nm.muniq(k="__fld") f <<= nm.mcount(a="size") f <<= nm.mcut(f="size") xx1 = f.run() self.itemSize = int(xx1[0][0]) xx2 = nm.mcut(f=self.taxoFN+":item",i=self.file).muniq(k="item").mcount(a="size").mcut(f="size").run() self.taxoSize = int(xx2[0][0])
def stats_h(self,b): field=self.field_w.getValue() self.parent.msg_w.value="\"%s\" 項目の統計量を計算中..."%(field) f=None f<<=nm.mcut(f=field,i=self.iName_w.value) f<<=nm.msummary(f=field,c="min,median,mean,max") f<<=nm.writelist(header=True) rsl=f.run() #print(rsl) self.result_w.value=str(rsl) self.parent.msg_w.value="\"%s\" 項目の統計量を計算中...完了"%(field)
def convRsl(self, ifile, ofile, map1, map2, logDir=None): # 上記iterationで収束したマイクロクラスタグラフを元の節点文字列に直して出力する #MCMD::msgLog("converting the numbered nodes into original name ...") f = None f <<= nm.mcut(nfni=True, f="0:tra", i=ifile) f <<= nm.msed(f="tra", c=' $', v="") f <<= nm.mnumber(q=True, S=1, a="num1") f <<= nm.mtra(r=True, f="tra:num2") f <<= nm.mjoin(k="num2", m=map2, f=self.ef2) f <<= nm.mjoin(k="num1", m=map1, f=self.ef1) f <<= nm.msortf(f="num1%n,num2%n") f <<= nm.mcut(f=[self.ef1, self.ef2]) if logDir: f <<= nm.mfldname(q=True, o="{}/#{ofile}".format(logDir, ofile)) else: f <<= nm.mfldname(q=True, o=ofile) f.run()
def __readNodeList(self, nodeList=None, title=None): if nodeList is not None: if title is not None: self.nodeFN = title self.__wfN = self.__tempW.file() mcmd = nm.m2cross(nfn=True, a="num,node", f="0-%d" % (len(nodeList) - 1), i=[nodeList]) mcmd <<= nm.mcut(nfni=True, f="1:n,0:no", o=self.__wfN) mcmd.run()