コード例 #1
0
#Code to check for empty cells in the SOMz, if a cell is empty
#Then the weights are changed to 0 so that no observations get assigned to that cell
#Need a better (smarter) fix in the future..another paper!?!?!?!?
num_pixels = finished_SOMz.npix
for i in xrange(num_pixels):
    try:
        temp = finished_SOMz.ivals[i]
    except KeyError:
        finished_SOMz.weights[:,i] = zeros(finished_SOMz.nDim)

file_id_raw = 0        
sample_size = 100000     
max_iters = 50
num_cut = zeros(5)

training_psf = df.point_spread_function(train_data_nocol)
training_psf_t = training_psf.T

#Actually run the methods and save their outputs
for obs_num in xrange(L0,L1):
    
    
    #Get the phi_tilde term
    phi_tilde_point = histogram(Mean_test[obs_num],bins=bins,normed=True)[0]
    phi_tilde_pdf = test_BP[obs_num]
    
    best_cells = finished_SOMz.som_best_cell(X_Test[obs_num],20)[0]
    
    #######
    indices = finished_SOMz.ivals[best_cells[0]]
    #Pull the relevant galaxies from the full data-set