示例#1
0
文件: CFpipe.py 项目: jphcoi/MLMTC
		print couverture
		text = text + couverture + '\n'
		fonctions.ecrire_dico(champs,dico_transition,dico_termes,niveau+1)#ecrit le dictionaire de transition pour la prochaine etape
		scores = label_champs(champs,nb_label,dico_transition,dico_termes,dist_mat,type_score)#on calcule le label des champs		
		#afficher_tous_champs(champs,scores,nb_label,sep_label,dico_termes,dico_transition)#on affiche tout ça.		
		#type_distance='max','moy' ou 'min'
		type_distance='moy'
		distance_champ=fonctions.map_champs(champs,dist_mat,'moy')
		#print distance_champ
		distance_champ_edges_list=edges_list(distance_champ)
		#version des distances sans la limitation degmax.
		fonctions.ecrire_reseau_CF(distance_champ,years_bins,dist_type,seuil_net_champ,niveau+1)		 
		
		#print '\n'
		#print distance_champ_edges_list
		distance_champ_edges_list_seuil=fonctions.seuiller(distance_champ_edges_list,degmax)
		#print '\n'
		#print distance_champ_edges_list_seuil
		distance_champ = edges_list_reverse(distance_champ_edges_list_seuil)
		#print '\n'
		#print distance_champ
		legende_noeuds,legende_noeuds_id=gexf_champ(years_bins,scores,champs,nb_label,dico_termes,sep_label,dist_type,distance_champ,niveau,seuil_net_champ)
		fonctions.dumpingin(champs,'champs_'+str(niveau))
		fonctions.dumpingin(distance_champ,'distance_champ_'+str(niveau))	
		fonctions.ecrire_legende(champs,legende_noeuds,legende_noeuds_id,niveau+1,years_bins)
		fonctions.ecrire_reseau(distance_champ,years_bins,dist_type,seuil_net_champ,niveau+1,legende_noeuds)				
print "niveau vide!"

maps_union.union_map(2,seuil_net_champ)
#print lenchampsfinal.keys()
logfile = open(Cfinderexport_name(0,0,degmax),'a')
示例#2
0
文件: CFpipe.py 项目: jphcoi/MLMTC
def seuil_degmax(niveau,degmax,inter):
	res = read_reseau(niveau,inter)
	res_seuil = fonctions.seuiller(res,degmax)
	fichier_out = write_reseau(res_seuil,niveau,inter)
	return fichier_out
示例#3
0
			fichier_CF=path_req +'reseau/'+'reseauCF_niv_1_'+dist_type+'_'+str(years_bins[inter][0])+'-'+str(years_bins[inter][-1])+'.txt'
			#fichier_cooc=path_req +'reseau/'+'reseauCF_niv_cooc__'+str(years_bins[inter][0])+'-'+str(years_bins[inter][-1])+'.txt'
			fichier_gexf = path_req + 'gexf/' + 'reseau_champ_0_'+'_' + dist_type +'_'+str(years_bins[inter][0])+'-'+str(years_bins[inter][-1])+'.gexf'		

#			if inter>0:
#				dist_mat_temp_old = deepcopy(dist_mat_temp)
			dist_mat_temp = lire_dist_mat_file(fichier_CF)
			dist_mat_temp_res = {}
			for x,y in dist_mat_temp.iteritems():
				if not int(x[0]) in dist_mat_temp_res:
					dic = {}	
				else:
					dic = dist_mat_temp_res[int(x[0])]
				dic[int(x[1])]=float(y)
				dist_mat_temp_res[int(x[0])] = dic
			dist_mat_temp_res_10 = fonctions.seuiller(dist_mat_temp_res,10)
			print 'on construit maintenant dist_mat pour chaque periode ' + str(inter)
			for x,y in dist_mat_temp.iteritems():
				dist_mat[(int(x[0]),int(x[1]),int(inter))]=y
			for x,y in dist_mat_temp_res_10.iteritems():
				for u in y:
					dist_mat_10[(int(x),int(u[0]),int(inter))]=u[1]
			level={}
			for x in dico_termes:
				level[x]=1
			gexf.gexf_builder(dico_termes,dist_mat_temp,fichier_gexf,level)
			
		fonctions.ecrire_dico(dico_termes,dico_termes,dico_termes,1)
		print 'dicos ecrits'
		#fonctions.dumpingin(p_cooccurrences,'p_cooccurrences'+name_date)
		fonctions.dumpingin(dist_mat_10,'dist_mat_10'+name_date)