smash.Model.get_serr_sigma#
- Model.get_serr_sigma()[source]#
Get the structural error sigma value by applying the sigma mapping.
Hint
See the Bayesian Estimation section
- Returns:
- value
numpy.ndarray
An array of shape (ng, ntime_step) representing the values of the structural error sigma for each gauge and each time step.
- value
Examples
>>> from smash.factory import load_dataset >>> setup, mesh = load_dataset("cance") >>> model = smash.Model(setup, mesh)
The structural error sigma mapping is set to
'Linear'
>>> model.setup.serr_sigma_mapping 'Linear'
Therefore, the mapping of sigma parameters to sigma is: \(\sigma(g,t)=\sigma_0(g)+\sigma_1(g)q(g,t)\) with:
\(\sigma\), the standard deviation of structural errors,
\(\sigma_0\) and \(\sigma_1\), the structural error sigma parameters with respect to
'Linear'
mapping,\(q\), the model response (i.e. the discharge),
\(g\) and \(t\), the index refering to the gauge and time step respectively
Run the direct Model to generate discharge responses
>>> model.forward_run()
Retrieve the sigma value with the
get_serr_sigma
method>>> sigma = model.get_serr_sigma() >>> sigma array([[1.0003965, 1. , 1. , ..., 5.55925 , 5.5311885, 5.5034614], [1.0000476, 1. , 1. , ..., 1.965963 , 1.9615871, 1.9572574], [1.000006 , 1. , 1. , ..., 1.2563775, 1.255204 , 1.2540425]], dtype=float32)
This is equivalent to
>>> sg0 = model.get_serr_sigma_parameters("sg0").reshape(-1, 1) >>> sg1 = model.get_serr_sigma_parameters("sg1").reshape(-1, 1) >>> q = model.response.q >>> sigma2 = sg0 + sg1 * q >>> np.allclose(sigma, sigma2) True