watex.utils.fittensor#
- watex.utils.fittensor(refreq, compfreq, z, fill_value=nan)[source]#
Fit each tensor component to the complete frequency range.
The complete frequency is the frequency with clean data. It contain all the frequency range on the site. During the survey, the missing frequencies lead to missing tensor data. So the function will indicate where the tensor data is missing and fit to the prior frequencies.
- Parameters:
refreq (ArrayLike) – Reference frequency - Should be the complete frequency collected in the field.
comfreq (array-like,) – The specific frequency collect in the site. Sometimes due to the interferences, the frequency at individual site could be different from the complete. However, the frequency values at the individual site must be included in the complete frequency refreq.
z (array-like,) – should be the tensor value (real or imaginary part ) at the component xx, xy, yx, yy.
fill_value (float . default='NaN') – Value to replace the missing data in tensors.
- Returns:
Z – new Z filled by invalid value NaN where the frequency is missing in the data.
- Return type:
Arraylike
Examples
>>> import numpy as np >>> from watex.utils.exmath import fittensor >>> refreq = np.linspace(7e7, 1e0, 20) # 20 frequencies as reference >>> freq_ = np.hstack ((refreq.copy()[:7], refreq.copy()[12:] )) >>> z = np.random.randn(len(freq_)) *10 # assume length of freq as ... # the same like the tensor Z value >>> zn = fittensor (refreq, freq_, z) >>> z # some frequency values are missing but not visible. ...array([-23.23448367, 2.93185982, 10.81194723, -12.46326732, 1.57312908, 7.23926576, -14.65645799, 9.85956253, 3.96269863, -10.38325124, -4.29739755, -8.2591703 , 21.7930423 , 0.21709129, 4.07815217]) >>> # zn show where the frequencies are missing >>> # the NaN value means in a missing value in tensor Z at specific frequency >>> zn ... array([-23.23448367, 2.93185982, 10.81194723, -12.46326732, 1.57312908, 7.23926576, -14.65645799, nan, nan, nan, nan, nan, 9.85956253, 3.96269863, -10.38325124, -4.29739755, -8.2591703 , 21.7930423 , 0.21709129, 4.07815217]) >>> # let visualize where the missing frequency value in tensor Z >>> refreq ... array([7.00000000e+07, 6.63157895e+07, 6.26315791e+07, 5.89473686e+07, 5.52631581e+07, 5.15789476e+07, 4.78947372e+07, 4.42105267e+07*, 4.05263162e+07*, 3.68421057e+07*, 3.31578953e+07*, 2.94736848e+07*, 2.57894743e+07, 2.21052638e+07, 1.84210534e+07, 1.47368429e+07, 1.10526324e+07, 7.36842195e+06, 3.68421147e+06, 1.00000000e+00]) >>> refreq[np.isnan(zn)] #we can see the missing value between [7:12](*) in refreq ... array([44210526.68421052, 40526316.21052632, 36842105.73684211, 33157895.2631579 , 29473684.78947368])