Update src/seismic_hazard_forecasting.py
correct activity rate to be per time unit before fed to forecasting
This commit is contained in:
@@ -636,24 +636,15 @@ verbose: {verbose}")
|
|||||||
rate_forecast, rate_unc_high, rate_unc_low,
|
rate_forecast, rate_unc_high, rate_unc_low,
|
||||||
datenum_data, mag_data)
|
datenum_data, mag_data)
|
||||||
|
|
||||||
print("\n----------------- Forecast Summary -----------------")
|
logger.info("\n----------------- Forecast Summary -----------------")
|
||||||
print(f"Forecasted activity rate (next {bin_dur} {time_unit}(s)): {rate_forecast:.4f}")
|
logger.info(f"Forecasted activity rate (next {bin_dur} {time_unit}(s)): {rate_forecast:.4f}")
|
||||||
print(f"95% BCa confidence interval: [{rate_unc_low:.4f}, {rate_unc_high:.4f}]")
|
logger.info(f"95% BCa confidence interval: [{rate_unc_low:.4f}, {rate_unc_high:.4f}]")
|
||||||
print("------------------------------------------------------")
|
logger.info("------------------------------------------------------")
|
||||||
|
|
||||||
lambdas = np.array(rate_forecast/bin_dur, dtype='d')
|
lambdas = np.array(rate_forecast/bin_dur, dtype='d')
|
||||||
lambdas_perc = np.array(1.0, dtype='d')
|
lambdas_perc = np.array(1.0, dtype='d')
|
||||||
|
|
||||||
|
np.savetxt('activity_rate.csv', np.vstack((lambdas, lambdas_perc)).T, header=f"Activity Rate (Events per {time_unit})", "percentage",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logger.info(f"Forecasted activity rates: {lambdas} events per {time_unit}")
|
|
||||||
np.savetxt('activity_rate.csv', np.vstack((lambdas, lambdas_perc)).T, header="lambda, percentage",
|
|
||||||
delimiter=',', fmt='%1.4f')
|
delimiter=',', fmt='%1.4f')
|
||||||
|
|
||||||
if forecast_select:
|
if forecast_select:
|
||||||
|
|||||||
Reference in New Issue
Block a user