From efebc2ab05b091399b8b1ba3978b2f91df8afaa3 Mon Sep 17 00:00:00 2001 From: Claudio Satriano Date: Thu, 21 Jul 2022 11:46:21 +0200 Subject: [PATCH] Warn if radiated energy is computed from P waves --- sourcespec/ssp_radiated_energy.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sourcespec/ssp_radiated_energy.py b/sourcespec/ssp_radiated_energy.py index 3d57ef61..c8e52422 100644 --- a/sourcespec/ssp_radiated_energy.py +++ b/sourcespec/ssp_radiated_energy.py @@ -15,7 +15,9 @@ CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html) """ +import logging import numpy as np +logger = logging.getLogger(__name__.split('.')[-1]) def _spectral_integral(spec, t_star, fmax): @@ -73,6 +75,11 @@ def _finite_bandwidth_correction(spec, fc, fmax): def radiated_energy(config, spec_st, specnoise_st, sourcepar): """Compute radiated energy, using eq. (3) in Lancieri et al. (2012).""" + logger.info('Computing radiated energy...') + if config.wave_type == 'P': + logger.warning( + 'Warning: computing radiated energy from P waves might lead to ' + 'an underestimation') # Select specids with channel code: '??H' spec_ids = [spec.id for spec in spec_st if spec.id[-1] == 'H'] for spec_id in spec_ids: @@ -106,3 +113,4 @@ def radiated_energy(config, spec_st, specnoise_st, sourcepar): # Store in the parameter dictionary par['Er'] = Er + logger.info('Computing radiated energy: done')