xarray.Dataset.dts.monte_carlo_double_ended

Dataset.dts.monte_carlo_double_ended(result, st_var, ast_var, rst_var, rast_var, conf_ints, mc_sample_size=100, var_only_sections=False, exclude_parameter_uncertainty=False, da_random_state=None, mc_remove_set_flag=True, reduce_memory_usage=False)

Estimation of the confidence intervals for the temperatures measured with a double-ended setup.

Double-ended setups require four additional steps to estimate the confidence intervals for the temperature. First, the variances of the Stokes and anti-Stokes intensity measurements of the forward and backward channels are estimated following the steps in Section 4 [1]_. See variance_stokes_constant(). A Normal distribution is assigned to each intensity measurement that is centered at the measurement and using the estimated variance. Second, a multi-variate Normal distribution is assigned to the estimated parameters using the covariance matrix from the calibration procedure presented in Section 6 [1]_ (p_cov). Third, Normal distributions are assigned for \(A\) (ds.alpha) for each location outside of the reference sections. These distributions are centered around \(A_p\) and have variance \(\sigma^2\left[A_p\right]\) given by Equations 44 and 45. Fourth, the distributions are sampled and \(T_{\mathrm{F},m,n}\) and \(T_{\mathrm{B},m,n}\) are computed with Equations 16 and 17, respectively. Fifth, step four is repeated to compute, e.g., 10,000 realizations (mc_sample_size) of \(T_{\mathrm{F},m,n}\) and \(T_{\mathrm{B},m,n}\) to approximate their probability density functions. Sixth, the standard uncertainties of \(T_{\mathrm{F},m,n}\) and \(T_{\mathrm{B},m,n}\) (\(\sigma\left[T_{\mathrm{F},m,n}\right]\) and \(\sigma\left[T_{\mathrm{B},m,n}\right]\)) are estimated with the standard deviation of their realizations. Seventh, for each realization \(i\) the temperature \(T_{m,n,i}\) is computed as the weighted average of \(T_{\mathrm{F},m,n,i}\) and \(T_{\mathrm{B},m,n,i}\):

\[T_{m,n,i} =\ \sigma^2\left[T_{m,n}\right]\left({\frac{T_{\mathrm{F},m,n,i}}{\ \sigma^2\left[T_{\mathrm{F},m,n}\right]} +\ \frac{T_{\mathrm{B},m,n,i}}{\ \sigma^2\left[T_{\mathrm{B},m,n}\right]}}\right)\]

where

\[\sigma^2\left[T_{m,n}\right] = \frac{1}{1 /\ \sigma^2\left[T_{\mathrm{F},m,n}\right] + 1 /\ \sigma^2\left[T_{\mathrm{B},m,n}\right]}\]

The best estimate of the temperature \(T_{m,n}\) is computed directly from the best estimates of \(T_{\mathrm{F},m,n}\) and \(T_{\mathrm{B},m,n}\) as:

\[T_{m,n} =\ \sigma^2\left[T_{m,n}\right]\left({\frac{T_{\mathrm{F},m,n}}{\ \sigma^2\left[T_{\mathrm{F},m,n}\right]} + \frac{T_{\mathrm{B},m,n}}{\ \sigma^2\left[T_{\mathrm{B},m,n}\right]}}\right)\]

Alternatively, the best estimate of \(T_{m,n}\) can be approximated with the mean of the \(T_{m,n,i}\) values. Finally, the 95% confidence interval for \(T_{m,n}\) are estimated with the 2.5% and 97.5% percentiles of \(T_{m,n,i}\).

Assumes sections are set.

Parameters:
  • p_val (array-like, optional) – Define p_val, p_var, p_cov if you used an external function for calibration. Has size 1 + 2 * nt + nx + 2 * nt * nta. First value is \(\gamma\), then nt times \(D_\mathrm{F}\), then nt times \(D_\mathrm{B}\), then for each location \(D_\mathrm{B}\), then for each connector that introduces directional attenuation two parameters per time step.

  • p_cov (array-like, optional) – The covariances of p_val. Square matrix. If set to False, no uncertainty in the parameters is propagated into the confidence intervals. Similar to the spec sheets of the DTS manufacturers. And similar to passing an array filled with zeros.

  • st_var, ast_var, rst_var, rast_var (float, callable, array-like, optional) – The variance of the measurement noise of the Stokes signals in the forward direction. If float the variance of the noise from the Stokes detector is described with a single value. If callable the variance of the noise from the Stokes detector is a function of the intensity, as defined in the callable function. Or manually define a variance with a DataArray of the shape ds.st.shape, where the variance can be a function of time and/or x. Required if method is wls.

  • conf_ints (iterable object of float) – A list with the confidence boundaries that are calculated. Valid values are between [0, 1].

  • mc_sample_size (int) – Size of the monte carlo parameter set used to calculate the confidence interval

  • var_only_sections (bool) – useful if using the ci_avg_x_flag. Only calculates the var over the sections, so that the values can be compared with accuracy along the reference sections. Where the accuracy is the variance of the residuals between the estimated temperature and temperature of the water baths.

  • da_random_state – For testing purposes. Similar to random seed. The seed for dask. Makes random not so random. To produce reproducable results for testing environments.

  • mc_remove_set_flag (bool) – Remove the monte carlo data set, from which the CI and the variance are calculated.

  • reduce_memory_usage (bool) – Use less memory but at the expense of longer computation time

  • Returns

  • ——–

  • dict

  • References

  • ———–

  • .. [1] des Tombe, B., Schilperoort, B., & Bakker, M. (2020). Estimation – of Temperature and Associated Uncertainty from Fiber-Optic Raman- Spectrum Distributed Temperature Sensing. Sensors, 20(8), 2235. https://doi.org/10.3390/s20082235

  • TODO (Use get_params_from_pval_double_ended() to extract parameter sets from mc)