Silence error for log10(0) when expected

This commit is contained in:
2025-09-30 00:33:01 +02:00
parent 3431bc8a4d
commit ae2a0731c1

View File

@@ -227,9 +227,15 @@ def calibrate_single_particle(
calibrate_particle_data, config=run_config, meta=meta_cal
)
ddf_cal["time_lag"] = ddf_cal["Incand Peak Time"] - ddf_cal["Scatter Peak Time"]
ddf_cal["ratio_inc_scatt"] = np.log10(ddf_cal["Incand relPeak"]) / np.log10(
ddf_cal["Scatter relPeak"]
)
# Suppress divide by zero warning for log10(0) - expected for particles with no signal
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="divide by zero encountered in log10")
ddf_cal["ratio_inc_scatt"] = np.log10(ddf_cal["Incand relPeak"]) / np.log10(
ddf_cal["Scatter relPeak"]
)
ddf_cal = define_flags(ddf_cal, instr_config, run_config)