コード例 #1
0
def plotC(CONFIG):
	from plotting.plot import plot_data
	PLOT_NAME=plot_name(CONFIG.RED_TYPE,CONFIG.CL_TYPE,CONFIG.dict_red,CONFIG.dict_clust,PLOT_EXT)
	os.system('mkdir -p plots')
	plot_data(READ(CONFIG.RED_DATA,CONFIG.MASK).T,READ(CONFIG.CL_DATA).T,READ(CONFIG.LAB_DATA),PLOT_NAME)
	if CONFIG.CL_TYPE =='EXT': CL_PROP='### CLUSTERS USED ###\nfrom external data = '+CONFIG.CL_DATA
	else			 : CL_PROP=open(CONFIG.CLUSTER_INFO,'r').read()
	prt(CONFIG.PLOT_INFO,CL_PROP,'w')
	PRT_FMSG('PLOT generated at','PLOT file not generated',PLOT_NAME)
コード例 #2
0
def plot_specC(CONFIG):
	from plotting.plot_specs import plot_spectra
	PLOT_NAME=plot_name(CONFIG.RED_TYPE,CONFIG.CL_TYPE,CONFIG.dict_red,CONFIG.dict_clust,'_specs'+PLOT_SPEC_EXT)
	os.system('mkdir -p plots')
	plot_spectra(READ(CONFIG.SPEC_DATA,CONFIG.MASK),READ(CONFIG.LAB_DATA),PLOT_NAME)
	if CONFIG.CL_TYPE =='EXT': CL_PROP='### CLUSTERS USED ###\nfrom external data = '+CONFIG.CL_DATA
	else			 : CL_PROP=open(CONFIG.CLUSTER_INFO,'r').read()
	prt(CONFIG.PLOTSPEC_INFO,CL_PROP,'w')
	PRT_FMSG('SPECS PLOT generated at','SPECS PLOT not generated',PLOT_NAME)
コード例 #3
0
def clusterC(CONFIG,case_in='',case_out=''):
	if CONFIG.CL_TYPE =='EXT': print ("CLUSTERS_DATA_EXTERNAL is defined, please check what you realy want to do!"); exit()

	exec('from clustering.'+CONFIG.CLUSTERING_METHOD+' import clustering')
	os.system('mkdir -p cl_data')
	clusters,labels= clustering(READ(CONFIG.RED_DATA+case_in,CONFIG.MASK),CONFIG.dict_clust)
	np.savetxt(CONFIG.CL_DATA+case_out,clusters)
	np.savetxt(CONFIG.LAB_DATA+case_out,labels)

	if CONFIG.RED_TYPE =='EXT': RED_PROP='### REDUCTION USED ###\nfrom external data = '+REDUCED_DATA_EXTERNAL
	else			  : RED_PROP=open(CONFIG.REDUCTION_INFO+case_in,'r').read()

	prt(CONFIG.CLUSTER_INFO+case_out,RED_PROP,'w')
	print_info(CONFIG.CLUSTERING_METHOD,CONFIG.dict_clust,'### CLUSTERING USED ###',CONFIG.RED_DATA,CONFIG.CLUSTER_INFO+case_out,'a')
	prt(CONFIG.CLUSTER_INFO+case_out,'\n\t-outputs:','a')
	prt(CONFIG.CLUSTER_INFO+case_out,'n_clusters = '+str(clusters.shape[0]),'a')
	PRT_FMSG('CLUSTER CENTERS printed to','CLUSTERS CENTERS not printed',CONFIG.CL_DATA+case_out)
	PRT_FMSG('CLUSTER LABELS printed to','CLUSTERS LABELS not printed',CONFIG.LAB_DATA+case_out)
	return clusters,labels