xarray.Dataset.dts.calibrate_double_ended

Dataset.dts.calibrate_double_ended(sections, st_var, ast_var, rst_var, rast_var, method='wls', solver='sparse', p_val=None, p_var=None, p_cov=None, trans_att=[], fix_gamma=None, fix_alpha=None, matching_sections=None, verbose=False)

Calibrate the measured data of a double ended setup to temperature.

See example notebook 8 for an explanation on how to use this function. Calibrate the Stokes (ds.st) and anti-Stokes (ds.ast) of the forward channel and from the backward channel (ds.rst, ds.rast) data to temperature using fiber sections with a known temperature (ds.sections) for double-ended setups. The calibrated temperature of the forward channel is stored under ds.tmpf and its variance under ds.tmpf_var, and that of the backward channel under ds.tmpb and ds.tmpb_var. The inverse-variance weighted average of the forward and backward channel is stored under ds.tmpw and ds.tmpw_var. In double-ended setups, Stokes and anti-Stokes intensity is measured in two directions from both ends of the fiber. The forward-channel measurements are denoted with subscript F, and the backward-channel measurements are denoted with subscript B. Both measurement channels start at a different end of the fiber and have opposite directions, and therefore have different spatial coordinates. The first processing step with double-ended measurements is to align the measurements of the two measurement channels so that they have the same spatial coordinates. The spatial coordinate \(x\) (m) is defined here positive in the forward direction, starting at 0 where the fiber is connected to the forward channel of the DTS system; the length of the fiber is \(L\). Consequently, the backward-channel measurements are flipped and shifted to align with the forward-channel measurements. Alignment of the measurements of the two channels is prone to error because it requires the exact fiber length (McDaniel et al., 2018). Depending on the DTS system used, the forward channel and backward channel are measured one after another by making use of an optical switch, so that only a single detector is needed. However, it is assumed in this package that the forward channel and backward channel are measured simultaneously, so that the temperature of both measurements is the same. This assumption holds better for short acquisition times with respect to the timescale of the temperature variation, and when there is no systematic difference in temperature between the two channels. The temperature may be computed from the forward-channel measurements (Equation 10 [1]) with:

\[T_\mathrm{F} (x,t) = \frac{\gamma}{I_\mathrm{F}(x,t) + \\]

C_mathrm{F}(t) + int_0^x{Deltaalpha(x’),mathrm{d}x’}}

and from the backward-channel measurements with:

\[T_\mathrm{B} (x,t) = \frac{\gamma}{I_\mathrm{B}(x,t) + \\]

C_mathrm{B}(t) + int_x^L{Deltaalpha(x’),mathrm{d}x’}} with

\[I(x,t) = \ln{\left(\frac{P_+(x,t)}{P_-(x,t)}\right)}\]
\[C(t) = \ln{\left(\frac{\eta_-(t)K_-/\lambda_-^4}{\eta_+(t)K_+/\lambda_+^4}\right)}\]

where \(C\) is the lumped effect of the difference in gain at :param mc_conf_ints: \(x=0\) between Stokes and anti-Stokes intensity measurements and the dependence of the scattering intensity on the wavelength. The parameters \(P_+\) and \(P_-\) are the Stokes and anti-Stokes intensity measurements, respectively. \(C_\mathrm{F}(t)\) and \(C_\mathrm{B}(t)\) are the parameter \(C(t)\) for the forward-channel and backward-channel measurements, respectively. \(C_\mathrm{B}(t)\) may be different from \(C_\mathrm{F}(t)\) due to differences in gain, and difference in the attenuation between the detectors and the point the fiber end is connected to the DTS system (\(\eta_+\) and \(\eta_-\) in Equation~ref{eqn:c}). \(T\) in the listed equations is in Kelvin, but is converted to Celsius after calibration. The calibration procedure presented in van de Giesen et al. 2012 approximates \(C(t)\) to be the same for the forward and backward-channel measurements, but this approximation is not made here. Parameter \(A(x)\) (ds.alpha) is introduced to simplify the notation of the double-ended calibration procedure and represents the integrated differential attenuation between locations \(x_1\) and \(x\) along the fiber. Location \(x_1\) is the first reference section location (the smallest x-value of all used reference sections).

\[A(x) = \int_{x_1}^x{\Delta\alpha(x')\,\mathrm{d}x'}\]

so that the expressions for temperature may be written as:

\[T_\mathrm{F} (x,t) = \frac{\gamma}{I_\mathrm{F}(x,t) + D_\mathrm{F}(t) + A(x)}, T_\mathrm{B} (x,t) = \frac{\gamma}{I_\mathrm{B}(x,t) + D_\mathrm{B}(t) - A(x)}\]

where

\[D_{\mathrm{F}}(t) = C_{\mathrm{F}}(t) + \int_0^{x_1}{\Delta\alpha(x')\,\mathrm{d}x'}, D_{\mathrm{B}}(t) = C_{\mathrm{B}}(t) + \int_{x_1}^L{\Delta\alpha(x')\,\mathrm{d}x'}\]

Parameters \(D_\mathrm{F}\) (ds.df) and \(D_\mathrm{B}\) (ds.db) must be estimated for each time and are constant along the fiber, and parameter \(A\) must be estimated for each location and is constant over time. The calibration procedure is discussed in Section 6. \(T_\mathrm{F}\) (ds.tmpf) and \(T_\mathrm{B}\) (ds.tmpb) are separate approximations of the same temperature at the same time. The estimated \(T_\mathrm{F}\) is more accurate near \(x=0\) because that is where the signal is strongest. Similarly, the estimated \(T_\mathrm{B}\) is more accurate near \(x=L\). A single best estimate of the temperature is obtained from the weighted average of \(T_\mathrm{F}\) and \(T_\mathrm{B}\) as discussed in Section 7.2 [1] .

p_valarray-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_vararray-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. Is the variance of p_val.

p_covarray-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.

sectionsDict[str, List[slice]], optional

If None is supplied, ds.sections is used. Define calibration sections. Each section requires a reference temperature time series, such as the temperature measured by an external temperature sensor. They should already be part of the DataStore object. sections is defined with a dictionary with its keywords of the names of the reference temperature time series. Its values are lists of slice objects, where each slice object is a fiber stretch that has the reference temperature. Afterwards, sections is stored under ds.sections.

st_var, ast_var, rst_var, rast_varfloat, 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.

mc_sample_sizeint, optional

If set, the variance is also computed using Monte Carlo sampling. The number of Monte Carlo samples drawn used to estimate the variance of the forward and backward channel temperature estimates and estimate the inverse-variance weighted average temperature.

conf_intsiterable object of float

A list with the confidence boundaries that are calculated. Valid values are between [0, 1].

mc_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_flagbool

Remove the monte carlo data set, from which the CI and the variance are calculated.

variance_suffixstr, optional

String appended for storing the variance. Only used when method is wls.

method{‘wls’, ‘external’}

Use ‘wls’ for weighted least squares.

solver{‘sparse’, ‘stats’}

Either use the homemade weighted sparse solver or the weighted dense matrix solver of statsmodels. The sparse solver uses much less memory, is faster, and gives the same result as the statsmodels solver. The statsmodels solver is mostly used to check the sparse solver. ‘stats’ is the default.

trans_attiterable, optional

Splices can cause jumps in differential attenuation. Normal single ended calibration assumes these are not present. An additional loss term is added in the ‘shadow’ of the splice. Each location introduces an additional nt parameters to solve for. Requiring either an additional calibration section or matching sections. If multiple locations are defined, the losses are added.

fix_gammaTuple[float, float], optional

A tuple containing two floats. The first float is the value of gamma, and the second item is the variance of the estimate of gamma. Covariances between gamma and other parameters are not accounted for.

fix_alphaTuple[array-like, array-like], optional

A tuple containing two arrays. The first array contains the values of integrated differential att (\(A\) in paper), and the second array contains the variance of the estimate of alpha. Covariances (in-) between alpha and other parameters are not accounted for.

matching_sectionsList[Tuple[slice, slice, bool]]

Provide a list of tuples. A tuple per matching section. Each tuple has three items. The first two items are the slices of the sections that are matched. The third item is a boolean and is True if the two sections have a reverse direction (“J-configuration”).

matching_indicesarray

Provide an array of x-indices of size (npair, 2), where each pair has the same temperature. Used to improve the estimate of the integrated differential attenuation.

verbosebool

Show additional calibration information

outxarray.Dataset

A Dataset with the calibrated temperature under tmpf and its variance under tmpf_var. The calibrated temperature of the backward channel is stored under tmpb and tmpb_var. The inverse-variance weighted average of the forward and backward channel is stored under tmpw and tmpw_var. The Dataset also contains the calibration parameters under gamma, df, db, alpha, and c. The covariance matrix of the calibration parameters is stored.

dtscalibration/python-dts-calibration/blob/master/examples/notebooks/ 08Calibrate_double_wls.ipynb>`