readded try-except

This commit is contained in:
Abyss Halley 2025-08-22 13:19:09 -04:00
parent 1f0b6ba5ef
commit 31be71c5ae

View file

@ -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)
#%%