def print_eps(self): for i in self.wave_list: rapport_shape_mfs = MatrixFileSystem.MatrixFileSystem( "validation_data/" + self.cam_name + "/" + i + "/rapport" + str(self.fact)) rapport_intensity_mfs = MatrixFileSystem.MatrixFileSystem( "validation_data/" + self.cam_name + "/" + i + "/rapport" + str(self.fact)) shape_tab = rapport_shape_mfs.load_rapport("eps_shape") intensity_tab = rapport_intensity_mfs.load_rapport("eps_intensity") print("eps shape (" + i + ") = " + str(shape_tab.mean())) print("eps intensity (" + i + ") = " + str(intensity_tab.mean()))
def __init__(self, wavelet_name, fact, cam_name, dir_clean="data/im", dir_sim="data/sig"): cameras = { "dragon": 0, "flash": 10, "nectar": 50, "sct": 100 } #telescope id by name super().__init__(cameras[cam_name]) self.load_telescope() self.clean_mfs = MatrixFileSystem.MatrixFileSystem( dir_clean + "/" + cam_name + "/" + fact + "/" + wavelet_name + "/cleaned_telescope") self.sim_mfs = MatrixFileSystem.MatrixFileSystem(dir_sim + "/" + cam_name + "/" + fact)
def get_width(self): plt.subplot2grid((2, 4), (0, 3)) alpha = 0.66 tab_to_hist = [] for i, c in zip(self.list_fact, self.color): rapport_mfs = MatrixFileSystem.MatrixFileSystem(self.path + str(i)) tab_to_hist = rapport_mfs.load_rapport("width") plt.hist(tab_to_hist, bins=100, alpha=alpha, label=str(i), color=c) plt.legend() #plt.yscale("log") plt.xlabel("width")
def get_width(self): plt.subplot2grid((2, 4), (0, 3)) alpha = 0.66 tab_to_hist = [] for i, c in zip(self.wave_list, self.color): rapport_mfs = MatrixFileSystem.MatrixFileSystem( "validation_data/" + self.cam_name + "/" + i + "/rapport" + str(self.fact)) tab_to_hist = rapport_mfs.load_rapport("width") plt.hist(tab_to_hist, bins=75, alpha=alpha, label=str(i), color=c) plt.legend() #plt.yscale("log") plt.xlabel("width")
def get_skewness (self) : plt.subplot2grid((2, 4), (1, 2)) alpha = 0.66 for i in self.waveL : paramTab, y, err = [], [], [] for j in self.factL : rapport_mfs = MatrixFileSystem.MatrixFileSystem("validation_data/" + self.cam_name + "/" + i + "/rapport" + str(j)) paramTab = rapport_mfs.load_rapport("skewness") y.append (paramTab.mean()) err.append (paramTab.std()) plt.errorbar(self.factL, y, yerr=err, fmt='--o', alpha=alpha, label=str(i), capthick=2, capsize=5) plt.legend() #plt.yscale("log") plt.xlabel("skewness")
def subplot_raw (self) : plt.subplot2grid((2, 3), (1, 0)) raw_mfs = MatrixFileSystem.MatrixFileSystem ("data/raw/" + self.cam_name + "/" + self.fact) raw_sig = raw_mfs.read_vect (self.nbEvent) raw_mat = self.pyGammaSim.sig2matrix(raw_sig) plt.imshow(raw_mat) plt.colorbar() plt.xlabel("raw signal") plt.subplot2grid((2, 3), (0, 0)) self.disp = PyGammaSimulation.CameraDisplay(self.pyGammaSim.get_camera_geometry()) self.disp.cmap = plt.cm.terrain self.disp.add_colorbar() self.disp.image = raw_sig plt.xlabel("raw signal") plt.ylabel("")
def subplot_clean (self) : plt.subplot2grid((2, 3), (0, 1)) clean_mfs = MatrixFileSystem.MatrixFileSystem ("data/im/" + self.cam_name + "/" + self.fact + "/" + self.wavelet_name + "/cleaned_telescope") cleaned_mat = clean_mfs.read_matrix (self.nbEvent) cleaned_sig = self.pyGammaSim.matrix2sig (cleaned_mat) self.disp = PyGammaSimulation.CameraDisplay(self.pyGammaSim.get_camera_geometry()) self.disp.cmap = plt.cm.terrain self.disp.add_colorbar() self.disp.image = cleaned_sig plt.xlabel("cpp cleaned") plt.ylabel("") plt.subplot2grid((2, 3), (1, 1)) plt.imshow(cleaned_mat) plt.xlabel("cpp cleaned") plt.colorbar()
def subplot_sig (self) : plt.subplot2grid((2, 3), (0, 2)) #plt.subplot(232) sig_mfs = MatrixFileSystem.MatrixFileSystem ("data/sig/" + self.cam_name + "/" + self.fact) sig = sig_mfs.read_vect (self.nbEvent) self.disp = PyGammaSimulation.CameraDisplay(self.pyGammaSim.get_camera_geometry()) self.disp.cmap = plt.cm.terrain self.disp.add_colorbar() self.disp.image = sig plt.xlabel("sim clean") plt.ylabel("") plt.subplot2grid((2, 3), (1, 2)) sig_mat = self.pyGammaSim.sig2matrix(sig) plt.imshow(sig_mat) plt.xlabel("sim clean") plt.colorbar()
def save_width(self): width_mfs = MatrixFileSystem.MatrixFileSystem(self.path) width_mfs.store_rapport(self.width_tab, "width")
def save_length(self): length_mfs = MatrixFileSystem.MatrixFileSystem(self.path) length_mfs.store_rapport(self.length_tab, "length")
def save_cen_y(self): cen_y_mfs = MatrixFileSystem.MatrixFileSystem(self.path) cen_y_mfs.store_rapport(self.cen_y_tab, "cen_y")
def save_eps_intensity(self): eps_mfs = MatrixFileSystem.MatrixFileSystem(self.path) eps_mfs.store_rapport(self.eps_calc.get_intensity_err(), "eps_intensity")
def save_eps_shape(self): eps_mfs = MatrixFileSystem.MatrixFileSystem(self.path) eps_mfs.store_rapport(self.eps_calc.get_shape_err(), "eps_shape")
def save_kurtosis(self): kurtosis_mfs = MatrixFileSystem.MatrixFileSystem(self.path) kurtosis_mfs.store_rapport(self.kurtosis_tab, "kurtosis")
def save_skewness(self): skewness_mfs = MatrixFileSystem.MatrixFileSystem(self.path) skewness_mfs.store_rapport(self.skewness_tab, "skewness")
def save_phi(self): phi_mfs = MatrixFileSystem.MatrixFileSystem(self.path) phi_mfs.store_rapport(self.phi_tab, "phi")
def save_psi(self): psi_mfs = MatrixFileSystem.MatrixFileSystem(self.path) psi_mfs.store_rapport(self.psi_tab, "psi")
if len(sys.argv) == 7: wavelet_name = sys.argv[1] keepNei = "--nei" if sys.argv[2] == "--nei" else "--notnei" nb_events = int(sys.argv[3]) fact = sys.argv[4] cam_name = sys.argv[5] path = sys.argv[6] else: print(help_msg) exit() cameras = {"dragon": 0, "flash": 10, "nectar": 50, "sct": 100} path = path + "/" + cam_name + "/" + str(fact) if keepNei == "--notnei": cleaned_sig = MatrixFileSystem.MatrixFileSystem(path + "/" + wavelet_name + "/cleaned_telescope") else: cleaned_sig = MatrixFileSystem.MatrixFileSystem(path + "/" + wavelet_name + "_nei/cleaned_telescope") #dwt_sig = MatrixFileSystem.MatrixFileSystem (path + "/" + wavelet_name + "/dwt") #dwt_shrunk_sig = MatrixFileSystem.MatrixFileSystem (path + "/" + wavelet_name + "/dwt_shrunk") progbar = MyProgressBar.MyProgressBar(nb_events) for i in range(nb_events): os.system("./theCleaner " + keepNei + " " + str(i) + " " + wavelet_name + " " + path) cleaned_sig.save_text2bin(i) #dwt_sig.save_text2bin (i) #dwt_shrunk_sig.save_text2bin (i) progbar.update()
help_msg = "argv :\n\twavelet_name, nb_events, sn_fact, cam_name, image_folder, signal_folder, noise_folder, raw_folder" if len(sys.argv) == 9: wavelet_name = sys.argv[1] nb_events = int(sys.argv[2]) fact = float(sys.argv[3]) cam_name = sys.argv[4] image_folder = sys.argv[5] + "/" + cam_name + "/" + str(fact) signal_folder = sys.argv[6] + "/" + cam_name + "/" + str(fact) noise_folder = sys.argv[7] + "/" + cam_name + "/" + str(fact) raw_folder = sys.argv[8] + "/" + cam_name + "/" + str(fact) else: print(help_msg) exit() mfs_image = MatrixFileSystem.MatrixFileSystem(image_folder) mfs_signal = MatrixFileSystem.MatrixFileSystem(signal_folder) mfs_noise = MatrixFileSystem.MatrixFileSystem(noise_folder) mfs_raw = MatrixFileSystem.MatrixFileSystem(raw_folder) cameras = {"dragon": 0, "flash": 10, "nectar": 50, "sct": 100} pyGammaSim = PyGammaSimulation.PyGammaSimulation(cameras[cam_name]) progbar = MyProgressBar.MyProgressBar(nb_events) for i in range(nb_events): (im, sig, noi) = pyGammaSim.generate_signal(sn=fact, threshold=0.04) #to n-diagonal matrix mat_im = pyGammaSim.sig2matrix(im) #change to : store_cpp_mat(im, i, wavelet_name) #@store_cpp_mat : mat_im.std() ... ==> im.std()