for j in range(len(dim)): if i == j: continue else: figure() scatter((glitches[:,i]),(glitches[:,j]),s=2) xlabel(dim[i]) ylabel(dim[j]) title(dim[i]+' vs. '+dim[j]) xlim(min(glitches[:,i]),max(glitches[:,i])) ylim(min(glitches[:,j]),max(glitches[:,j])) savefig(snr_path + '/' + dim[i]+'vs'+dim[j]+'.png') close() print 'Working..' labels,max_k,centroids = gMeans(glitches,runs,snr_path) #savetxt(str(ks_crit)+'_saved_labels.txt',saved_labels) # Use the webgen.py python script to generate an .html file for displaying the plots # and various other statistics from ksmeans. ks = 0 num_k = max_k webgen(ks,gps_start,gps_end,mean(num_k),std(num_k),dim,snr_low,snr_high,freq_low,freq_high,sci_time,g_found,new_path,max_k,srvName) colors = rand(max_k+1,3) # Plots the clustered parameters against each other for display on the .html page. print 'Plotting clusters...' q = 0 j = 0
scatter((glitches[:,i]),(glitches[:,j]),s=2) xlabel(dim[i]) ylabel(dim[j]) title(dim[i]+' vs. '+dim[j]) xlim(min(glitches[:,i]) - 0.1*max(glitches[:,i]),max(glitches[:,i]) + 0.1*max(glitches[:,i])) ylim(min(glitches[:,j]) - 0.1*max(glitches[:,j]),max(glitches[:,j]) + 0.1*max(glitches[:,j])) savefig(snr_path + '/' + dim[i]+'vs'+dim[j]+'.png') close() ## Runs ksmeans for n runs, this while loop will continue to for a run ## until all clusters found have more than 2 members, this is to ## prevent ksmeans from diverging to it assigning every glitch its ## own cluster. i.e. N clusters for N glitches labels,ks,centroids = gMeans(glitches,runs) num_k = ks max_k = ks colors = rand(max_k,3) ## Generates the .html page for viewing the glitch parameter and cluster plots webgen(ks,gps_start,gps_end,mean(num_k),std(num_k),dim,snr_low,snr_high,freq_low,freq_high,sci_time,g_found,new_path,max_k) print 'Plotting clusters...' ## Plots the clustered glitch parameters q = 0 j = 0 for l in range(len(dim)): j = q for j in range(len(dim)):