From 31be71c5aee476999ec20c7e32fba93696b2dcd8 Mon Sep 17 00:00:00 2001 From: Abyss Halley Date: Fri, 22 Aug 2025 13:19:09 -0400 Subject: [PATCH] readded try-except --- singlepulse.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/singlepulse.py b/singlepulse.py index 2c90002..92bb06e 100644 --- a/singlepulse.py +++ b/singlepulse.py @@ -336,27 +336,27 @@ for pulsar_dir in pulsar_dir_list: results = [] for filepath in h5_files: - #try: - fluxes_mjy, flux_stds, widths_t, peak_mjds, time_peaks, time_pulse, dm = compute_snr_from_h5(filepath, - detrend_ft=True, - mad_filter=True, - save=True, - show=False, - save_path=save_path) + try: + fluxes_mjy, flux_stds, widths_t, peak_mjds, time_peaks, time_pulse, dm = compute_snr_from_h5(filepath, + detrend_ft=True, + mad_filter=True, + save=True, + show=False, + save_path=save_path) - for i in range(0,(len(fluxes_mjy))): - results.append({ - "mjd": peak_mjds[i], - "flux_std": flux_stds[i], - "flux_mJy": fluxes_mjy[i], - "width_s": widths_t[i], - "Pulse time (ms)": time_peaks[i], - "tcand": time_pulse, - "dm": dm, - "filename": os.path.basename(filepath) - }) - #except Exception as e: - #print(f"Error processing {filepath}: {e}") + for i in range(0,(len(fluxes_mjy))): + results.append({ + "mjd": peak_mjds[i], + "flux_std": flux_stds[i], + "flux_mJy": fluxes_mjy[i], + "width_s": widths_t[i], + "Pulse time (ms)": time_peaks[i], + "tcand": time_pulse, + "dm": dm, + "filename": os.path.basename(filepath) + }) + except Exception as e: + print(f"Error processing {filepath}: {e}") df = pd.DataFrame(results) #%%