#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 new_data = train_data_nocol.iloc[indices] new_data.reset_index(inplace=True) #Calculate the psf's psf_base = df.point_spread_function(new_data) psf_base_t=psf_base.T psf_matias = df.conditional_matrix_calc(new_data,pdfs=train_BP[indices]) psf_matias_t=psf_matias.T del new_data, indices ###################### for cell in best_cells: indices_single = finished_SOMz.ivals[cell] new_data = train_data_nocol.iloc[indices_single] new_data.reset_index(inplace=True) phi_bin = argmax(phi_tilde_point)+1 if phi_bin in new_data.zmean_bin.values: