scikit-diveMove 0.3.2.post1__tar.gz → 0.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scikit-diveMove-0.3.2.post1/scikit_diveMove.egg-info → scikit-diveMove-0.3.3}/PKG-INFO +1 -1
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3/scikit_diveMove.egg-info}/PKG-INFO +1 -1
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/__init__.py +43 -31
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/bouts/bouts.py +10 -11
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/bouts/boutsmle.py +3 -2
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/bouts/boutsnls.py +7 -5
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/calibspeed.py +1 -1
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/helpers.py +4 -5
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/imutools/allan.py +2 -2
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/imutools/imu.py +29 -24
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/imutools/imu2body.py +33 -31
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/imutools/imucalibrate.py +34 -33
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/metadata.py +7 -5
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/plotting.py +2 -1
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tdr.py +60 -24
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tdrphases.py +34 -23
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tdrsource.py +8 -4
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/get_sample_data.py +4 -4
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_BoutsMLE.py +6 -6
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_TDR.py +4 -2
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_TDRPhases.py +22 -3
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_TDRSource.py +8 -2
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_ZOC.py +1 -1
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_imucalibrate.py +18 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/zoc.py +6 -2
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/LICENSE +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/MANIFEST.in +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/README.rst +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/pyproject.toml +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/scikit_diveMove.egg-info/SOURCES.txt +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/scikit_diveMove.egg-info/dependency_links.txt +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/scikit_diveMove.egg-info/requires.txt +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/scikit_diveMove.egg-info/top_level.txt +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/setup.cfg +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/__main__.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/bouts/__init__.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/calibconfig.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/config_examples/ag_mk7_2002_022_config.json +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/core.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/imutools/__init__.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/imutools/ellipsoid.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/imutools/vector.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/__init__.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/data/ag_mk7_2002_022.nc +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/data/cats_temperature_calib.nc +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/data/gertrude/gert_imu_frame.nc +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/data/gertrude/gert_long_srfc.csv +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/data/gertrude/magnt_accel_calib.nc +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/data/samsung_galaxy_s5.nc +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_BoutsNLS.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_calibrate.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_imu2body.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_imu_utils.py +0 -0
- {scikit-diveMove-0.3.2.post1 → scikit-diveMove-0.3.3}/skdiveMove/tests/test_vector.py +0 -0
|
@@ -1,25 +1,48 @@
|
|
|
1
1
|
"""Top-level class for interacting with diveMove
|
|
2
2
|
|
|
3
3
|
The :class:`TDR` class aims to be a comprehensive class to encapsulate the
|
|
4
|
-
processing of `TDR` records from a data file.
|
|
4
|
+
processing of `TDR` records from a NetCDF data file.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Processing includes detection and quantification of periods of major
|
|
7
|
+
activities in a TDR record, calibrating depth readings to generate
|
|
8
|
+
summaries of diving behaviour. These procedures include wet/dry phase
|
|
9
|
+
detection, zero-offset correction (ZOC) of depth, detection of dives, as
|
|
10
|
+
well as proper labelling of the latter, among others utilities for the
|
|
11
|
+
analysis of TDR records.
|
|
12
|
+
|
|
13
|
+
All core procedures are encapsulated in :class:`TDR`, and are controlled by
|
|
14
|
+
a set of user-defined variables in a configuration file, and systematically
|
|
15
|
+
executed systematically by function :func:`calibrate`. This function can be
|
|
16
|
+
used as a template for custom processing using different
|
|
17
|
+
sequences. User-defined variables can also be directly specified as a
|
|
18
|
+
dictionary, which is a class attribute. The standard approach follows the
|
|
19
|
+
logical processing sequence described below:
|
|
20
|
+
|
|
21
|
+
1. Zero-offset correction
|
|
22
|
+
2. Detection of wet phases
|
|
23
|
+
3. Detection of dives
|
|
24
|
+
4. Detection of dive phases
|
|
25
|
+
5. Speed calibration (if required)
|
|
26
|
+
6. Calculation of statistics
|
|
27
|
+
|
|
28
|
+
Class :class:`TDR` methods implement these steps. This module instantiates
|
|
29
|
+
an `R` session to interact with low-level functions and methods of package
|
|
30
|
+
`diveMove`.
|
|
8
31
|
|
|
9
32
|
Calibration and phase detection
|
|
10
33
|
-------------------------------
|
|
11
34
|
|
|
12
35
|
.. autosummary::
|
|
13
36
|
|
|
14
|
-
TDR
|
|
37
|
+
TDR.read_netcdf
|
|
15
38
|
TDR.zoc
|
|
16
39
|
TDR.detect_wet
|
|
17
40
|
TDR.detect_dives
|
|
18
41
|
TDR.detect_dive_phases
|
|
19
42
|
TDR.calibrate_speed
|
|
20
43
|
|
|
21
|
-
|
|
22
|
-
|
|
44
|
+
Analysis and summaries
|
|
45
|
+
----------------------
|
|
23
46
|
|
|
24
47
|
.. autosummary::
|
|
25
48
|
|
|
@@ -37,37 +60,26 @@ Plotting
|
|
|
37
60
|
TDR.plot_phases
|
|
38
61
|
TDR.plot_dive_model
|
|
39
62
|
|
|
40
|
-
|
|
63
|
+
Accessors
|
|
41
64
|
---------
|
|
42
65
|
|
|
43
66
|
.. autosummary::
|
|
44
67
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
depth, detection of dives, as well as proper labelling of the latter, among
|
|
53
|
-
others utilities for the analysis of TDR records.
|
|
68
|
+
TDR.extract_dives
|
|
69
|
+
TDR.get_depth
|
|
70
|
+
TDR.get_dive_deriv
|
|
71
|
+
TDR.get_dives_details
|
|
72
|
+
TDR.get_phases_params
|
|
73
|
+
TDR.get_speed
|
|
74
|
+
TDR.get_tdr
|
|
54
75
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
executed systematically by function :func:`calibrate`. This function can be
|
|
58
|
-
used as a template for custom processing using different
|
|
59
|
-
sequences. User-defined variables can also be directly specified as a
|
|
60
|
-
dictionary, which is a class attribute. The standard approach follows the
|
|
61
|
-
logical processing sequence described below:
|
|
76
|
+
Functions
|
|
77
|
+
---------
|
|
62
78
|
|
|
63
|
-
|
|
64
|
-
2. Detection of wet phases
|
|
65
|
-
3. Detection of dives
|
|
66
|
-
4. Detection of dive phases
|
|
67
|
-
5. Speed calibration (if required)
|
|
68
|
-
6. Calculation of statistics
|
|
79
|
+
.. autosummary::
|
|
69
80
|
|
|
70
|
-
|
|
81
|
+
calibrate
|
|
82
|
+
dump_config_template
|
|
71
83
|
|
|
72
84
|
"""
|
|
73
85
|
|
|
@@ -76,5 +88,5 @@ from skdiveMove.calibconfig import dump_config_template
|
|
|
76
88
|
|
|
77
89
|
__author__ = "Sebastian Luque <spluque@gmail.com>"
|
|
78
90
|
__license__ = "AGPLv3"
|
|
79
|
-
__version__ = "0.3.
|
|
91
|
+
__version__ = "0.3.3"
|
|
80
92
|
__all__ = ["TDR", "calibrate", "dump_config_template"]
|
|
@@ -179,7 +179,7 @@ def _plot_bec(bec_x, bec_y, ax, xytext, horizontalalignment="left"):
|
|
|
179
179
|
Argument passed to `matplotlib.annotate`; interpreted with
|
|
180
180
|
textcoords="offset points".
|
|
181
181
|
horizontalalignment : str
|
|
182
|
-
Argument passed to
|
|
182
|
+
Argument passed to :meth:`~matplotlib.axes.Axes.annotate`.
|
|
183
183
|
|
|
184
184
|
"""
|
|
185
185
|
ylims = ax.get_ylim()
|
|
@@ -234,8 +234,6 @@ class Bouts(metaclass=ABCMeta):
|
|
|
234
234
|
Method to use for calculating the frequencies: "standard"
|
|
235
235
|
simply uses `x`, which "seq_diff" uses the sequential
|
|
236
236
|
differences method.
|
|
237
|
-
**kwargs : optional keywords
|
|
238
|
-
Passed to histogram
|
|
239
237
|
|
|
240
238
|
"""
|
|
241
239
|
self.x = x
|
|
@@ -273,7 +271,7 @@ class Bouts(metaclass=ABCMeta):
|
|
|
273
271
|
return objcls + meth_str + lnfreq_str
|
|
274
272
|
|
|
275
273
|
def init_pars(self, x_break, plot=True, ax=None, **kwargs):
|
|
276
|
-
"""Find starting values for mixtures of random Poisson processes
|
|
274
|
+
r"""Find starting values for mixtures of random Poisson processes
|
|
277
275
|
|
|
278
276
|
Starting values are calculated using the "broken stick" method.
|
|
279
277
|
|
|
@@ -281,15 +279,15 @@ class Bouts(metaclass=ABCMeta):
|
|
|
281
279
|
----------
|
|
282
280
|
x_break : array_like
|
|
283
281
|
One- or two-element array with values determining the break(s)
|
|
284
|
-
for broken stick model, such that x <
|
|
285
|
-
process, x >=
|
|
286
|
-
and x >=
|
|
282
|
+
for broken stick model, such that :math:`x < x\_break_0` is
|
|
283
|
+
first process, :math:`x >= x\_break_1` & :math:`x < x\_break_2`
|
|
284
|
+
is second process, and :math:`x >= x\_break_2` is third one.
|
|
287
285
|
plot : bool, optional
|
|
288
286
|
Whether to plot the broken stick model.
|
|
289
287
|
ax : matplotlib.Axes, optional
|
|
290
288
|
An Axes instance to use as target. Default is to create one.
|
|
291
289
|
**kwargs : optional keyword arguments
|
|
292
|
-
Passed to plotting function.
|
|
290
|
+
Passed to plotting function. Ignored currently.
|
|
293
291
|
|
|
294
292
|
Returns
|
|
295
293
|
-------
|
|
@@ -365,8 +363,9 @@ class Bouts(metaclass=ABCMeta):
|
|
|
365
363
|
----------
|
|
366
364
|
start : pandas.DataFrame
|
|
367
365
|
DataFrame with coefficients for each process in columns.
|
|
368
|
-
**kwargs
|
|
369
|
-
|
|
366
|
+
**kwargs
|
|
367
|
+
Optional keyword arguments passed to
|
|
368
|
+
:func:`scipy.optimize.curve_fit`.
|
|
370
369
|
|
|
371
370
|
Returns
|
|
372
371
|
-------
|
|
@@ -411,7 +410,7 @@ class Bouts(metaclass=ABCMeta):
|
|
|
411
410
|
-------
|
|
412
411
|
out : numpy.ndarray, shape (n,)
|
|
413
412
|
1-D array with BECs implied by `coefs`. Length is
|
|
414
|
-
coefs.shape[1]
|
|
413
|
+
``coefs.shape[1]``
|
|
415
414
|
|
|
416
415
|
"""
|
|
417
416
|
# Find bec's per process by pairing columns
|
|
@@ -330,8 +330,9 @@ class BoutsMLE(bouts.Bouts):
|
|
|
330
330
|
with coefficients of the solution.
|
|
331
331
|
ax : matplotlib.axes.Axes instance
|
|
332
332
|
An Axes instance to use as target.
|
|
333
|
-
**kwargs
|
|
334
|
-
|
|
333
|
+
**kwargs
|
|
334
|
+
Optional keyword arguments passed to
|
|
335
|
+
:func:`matplotlib.pyplot.gca`.
|
|
335
336
|
|
|
336
337
|
Returns
|
|
337
338
|
-------
|
|
@@ -66,8 +66,9 @@ class BoutsNLS(bouts.Bouts):
|
|
|
66
66
|
----------
|
|
67
67
|
start : pandas.DataFrame
|
|
68
68
|
DataFrame with coefficients for each process in columns.
|
|
69
|
-
**kwargs
|
|
70
|
-
|
|
69
|
+
**kwargs
|
|
70
|
+
Optional keyword arguments passed to
|
|
71
|
+
:func:`scipy.optimize.curve_fit`.
|
|
71
72
|
|
|
72
73
|
Returns
|
|
73
74
|
-------
|
|
@@ -93,7 +94,7 @@ class BoutsNLS(bouts.Bouts):
|
|
|
93
94
|
-------
|
|
94
95
|
out : numpy.ndarray, shape (n,)
|
|
95
96
|
1-D array with BECs implied by `coefs`. Length is
|
|
96
|
-
coefs.shape[1]
|
|
97
|
+
``coefs.shape[1]``
|
|
97
98
|
|
|
98
99
|
"""
|
|
99
100
|
# The metaclass implements this method
|
|
@@ -108,8 +109,9 @@ class BoutsNLS(bouts.Bouts):
|
|
|
108
109
|
DataFrame with model coefficients in columns.
|
|
109
110
|
ax : matplotlib.axes.Axes instance
|
|
110
111
|
An Axes instance to use as target.
|
|
111
|
-
**kwargs
|
|
112
|
-
|
|
112
|
+
**kwargs
|
|
113
|
+
Optional keyword arguments passed to
|
|
114
|
+
:func:`matplotlib.pyplot.gca`.
|
|
113
115
|
|
|
114
116
|
Returns
|
|
115
117
|
-------
|
|
@@ -19,7 +19,7 @@ def _load_dataset(filename_or_obj, **kwargs):
|
|
|
19
19
|
----------
|
|
20
20
|
filename_or_obj : str, Path or xarray.backends.*DataStore
|
|
21
21
|
String indicating the file where the data comes from.
|
|
22
|
-
**kwargs
|
|
22
|
+
**kwargs
|
|
23
23
|
Keyword arguments passed to :func:`~xarray.load_dataset`.
|
|
24
24
|
|
|
25
25
|
Returns
|
|
@@ -177,10 +177,9 @@ def _one_dive_stats(x, interval, has_speed=False):
|
|
|
177
177
|
onames = onames_nospeed
|
|
178
178
|
|
|
179
179
|
res_df = pd.DataFrame(res, columns=onames)
|
|
180
|
-
for tcol in
|
|
180
|
+
for tcol in onames[:3]:
|
|
181
181
|
# This is per POSIXct convention in R
|
|
182
|
-
res_df
|
|
183
|
-
unit="s")
|
|
182
|
+
res_df[tcol] = pd.to_datetime(res_df[tcol], unit="s")
|
|
184
183
|
|
|
185
184
|
return res_df
|
|
186
185
|
|
|
@@ -252,7 +251,7 @@ def rle_key(x):
|
|
|
252
251
|
2020-01-01 00:02:30+00:00 6
|
|
253
252
|
2020-01-01 00:02:40+00:00 6
|
|
254
253
|
2020-01-01 00:02:50+00:00 6
|
|
255
|
-
Freq:
|
|
254
|
+
Freq: 10s, dtype: int64
|
|
256
255
|
|
|
257
256
|
"""
|
|
258
257
|
xout = x.ne(x.shift()).cumsum()
|
|
@@ -63,8 +63,8 @@ def _line_fun(t, alpha, tau_crit, adev_crit):
|
|
|
63
63
|
def allan_coefs(taus, adevs):
|
|
64
64
|
"""Compute Allan deviation coefficients for each error type
|
|
65
65
|
|
|
66
|
-
Given averaging intervals
|
|
67
|
-
|
|
66
|
+
Given averaging intervals `taus` and corresponding Allan deviation
|
|
67
|
+
`adevs`, compute the Allan deviation coefficient for each error type:
|
|
68
68
|
|
|
69
69
|
- Quantization
|
|
70
70
|
- (Angle, Velocity) Random Walk
|
|
@@ -47,7 +47,7 @@ class IMUBase:
|
|
|
47
47
|
Examples
|
|
48
48
|
--------
|
|
49
49
|
This example illustrates some of the issues encountered while reading
|
|
50
|
-
data files in a real-world scenario.
|
|
50
|
+
data files in a real-world scenario. `scikit-diveMove` includes a
|
|
51
51
|
NetCDF file with IMU signals collected using a Samsung Galaxy S5 mobile
|
|
52
52
|
phone. Set up instance from NetCDF example data:
|
|
53
53
|
|
|
@@ -90,19 +90,22 @@ class IMUBase:
|
|
|
90
90
|
Dataset containing IMU sensor DataArrays, and optionally other
|
|
91
91
|
DataArrays.
|
|
92
92
|
acceleration_name : str, optional
|
|
93
|
-
Name of the acceleration
|
|
93
|
+
Name of the acceleration :class:`~xarray.DataArray` in the
|
|
94
|
+
`dataset`.
|
|
94
95
|
angular_velocity_name : str, optional
|
|
95
|
-
Name of the angular velocity
|
|
96
|
+
Name of the angular velocity :class:`~xarray.DataArray` in the
|
|
97
|
+
`dataset`.
|
|
96
98
|
magnetic_density_name : str, optional
|
|
97
|
-
Name of the magnetic density
|
|
99
|
+
Name of the magnetic density :class:`~xarray.DataArray` in the
|
|
100
|
+
`dataset`.
|
|
98
101
|
time_name : str, optional
|
|
99
|
-
Name of the time dimension in the dataset
|
|
102
|
+
Name of the time dimension in the `dataset`.
|
|
100
103
|
has_depth : bool, optional
|
|
101
104
|
Whether input data include depth measurements.
|
|
102
105
|
depth_name : str, optional
|
|
103
|
-
Name of the depth
|
|
106
|
+
Name of the depth :class:`~xarray.DataArray` in the `dataset`.
|
|
104
107
|
imu_filename : str, optional
|
|
105
|
-
Name of the file from which
|
|
108
|
+
Name of the file from which `dataset` originated.
|
|
106
109
|
|
|
107
110
|
"""
|
|
108
111
|
self.time_name = time_name
|
|
@@ -130,7 +133,7 @@ class IMUBase:
|
|
|
130
133
|
**kwargs):
|
|
131
134
|
"""Instantiate object by loading Dataset from NetCDF file
|
|
132
135
|
|
|
133
|
-
Provided all
|
|
136
|
+
Provided all `DataArrays` in the NetCDF file have the same
|
|
134
137
|
dimensions (N, 3), this is an efficient way to instantiate.
|
|
135
138
|
|
|
136
139
|
Parameters
|
|
@@ -138,17 +141,19 @@ class IMUBase:
|
|
|
138
141
|
imu_file : str
|
|
139
142
|
As first argument for :func:`xarray.load_dataset`.
|
|
140
143
|
acceleration_name : str, optional
|
|
141
|
-
Name of the acceleration
|
|
144
|
+
Name of the acceleration :class:`~xarray.DataArray` in the
|
|
145
|
+
:class:`~xarray.Dataset`.
|
|
142
146
|
angular_velocity_name : str, optional
|
|
143
|
-
Name of the angular velocity
|
|
147
|
+
Name of the angular velocity :class:`~xarray.DataArray` in the
|
|
148
|
+
:class:`~xarray.Dataset`.
|
|
144
149
|
magnetic_density_name : str, optional
|
|
145
|
-
Name of the magnetic density
|
|
146
|
-
|
|
147
|
-
Names of the dimensions of the data in each of the sensors.
|
|
150
|
+
Name of the magnetic density :class:`~xarray.DataArray` in the
|
|
151
|
+
:class:`~xarray.Dataset`.
|
|
148
152
|
has_depth : bool, optional
|
|
149
153
|
Whether input data include depth measurements.
|
|
150
154
|
depth_name : str, optional
|
|
151
|
-
Name of the depth
|
|
155
|
+
Name of the depth :class:`~xarray.DataArray` in the
|
|
156
|
+
:class:`~xarray.Dataset`.
|
|
152
157
|
**kwargs
|
|
153
158
|
Optional keyword arguments passed to
|
|
154
159
|
:func:`xarray.load_dataset`.
|
|
@@ -185,7 +190,7 @@ class IMUBase:
|
|
|
185
190
|
----------
|
|
186
191
|
sensor : str
|
|
187
192
|
Attribute name of the sensor of interest
|
|
188
|
-
taus : float, str
|
|
193
|
+
taus : {float, str}
|
|
189
194
|
Tau value, in seconds, for which to compute statistic. Can be
|
|
190
195
|
one of "octave" or "decade" for automatic generation of the
|
|
191
196
|
value.
|
|
@@ -222,9 +227,9 @@ class IMUBase:
|
|
|
222
227
|
This procedure implements the autonomous regression method for
|
|
223
228
|
Allan variance described in [1]_.
|
|
224
229
|
|
|
225
|
-
Given averaging intervals
|
|
226
|
-
|
|
227
|
-
|
|
230
|
+
Given averaging intervals `taus` and corresponding Allan deviation
|
|
231
|
+
`adevs`, compute the Allan deviation coefficient for each error
|
|
232
|
+
type:
|
|
228
233
|
|
|
229
234
|
- Quantization
|
|
230
235
|
- (Angle, Velocity) Random Walk
|
|
@@ -236,7 +241,7 @@ class IMUBase:
|
|
|
236
241
|
----------
|
|
237
242
|
sensor : str
|
|
238
243
|
Attribute name of the sensor of interest
|
|
239
|
-
taus : float, str
|
|
244
|
+
taus : {float, str}
|
|
240
245
|
Tau value, in seconds, for which to compute statistic. Can be
|
|
241
246
|
one of "octave" or "decade" for automatic generation of the
|
|
242
247
|
value.
|
|
@@ -247,9 +252,9 @@ class IMUBase:
|
|
|
247
252
|
Allan deviation coefficient and corresponding averaging time
|
|
248
253
|
for each sensor axis and error type.
|
|
249
254
|
adevs : pandas.DataFrame
|
|
250
|
-
|
|
251
|
-
averaging time, and fitted ARMAV model estimates
|
|
252
|
-
coefficients for each sensor axis and error type.
|
|
255
|
+
:class:`~pandas.MultiIndex` DataFrame with Allan deviation,
|
|
256
|
+
corresponding averaging time, and fitted ARMAV model estimates
|
|
257
|
+
of the coefficients for each sensor axis and error type.
|
|
253
258
|
|
|
254
259
|
Notes
|
|
255
260
|
-----
|
|
@@ -313,8 +318,8 @@ class IMUBase:
|
|
|
313
318
|
----------
|
|
314
319
|
method : str, optional
|
|
315
320
|
Name of the filtering method to use.
|
|
316
|
-
**kwargs
|
|
317
|
-
|
|
321
|
+
**kwargs
|
|
322
|
+
Optional keyword arguments passed to filtering method.
|
|
318
323
|
|
|
319
324
|
"""
|
|
320
325
|
orienter_cls = getattr(filters, method)
|
|
@@ -71,7 +71,7 @@ def scatterIMU_svd(vectors, svd, R_ctr2i, normalize=False, center=False,
|
|
|
71
71
|
vectors, sigma, right singular vectors).
|
|
72
72
|
R_ctr2i : Rotation
|
|
73
73
|
:class:`~scipy.spatial.transforms.Rotation` object describing the
|
|
74
|
-
rotation from the *centered* body frame to the
|
|
74
|
+
rotation from the *centered* body frame to the `IMU` frame.
|
|
75
75
|
normalize : bool, optional
|
|
76
76
|
Whether to normalize vectors. Default assumes input is normalized.
|
|
77
77
|
center : bool, optional
|
|
@@ -85,7 +85,7 @@ def scatterIMU_svd(vectors, svd, R_ctr2i, normalize=False, center=False,
|
|
|
85
85
|
Output file for the animation.
|
|
86
86
|
**kwargs
|
|
87
87
|
Optional keyword arguments passed to
|
|
88
|
-
:func:`~matplotlib.pyplot.figure` (e.g.
|
|
88
|
+
:func:`~matplotlib.pyplot.figure` (e.g. `figsize`).
|
|
89
89
|
|
|
90
90
|
Returns
|
|
91
91
|
-------
|
|
@@ -178,7 +178,7 @@ def _scatterIMU_svd(vectors, svd, R_b2i, normalize=False, title=None,
|
|
|
178
178
|
Output file for the animation.
|
|
179
179
|
**kwargs
|
|
180
180
|
Optional keyword arguments passed to
|
|
181
|
-
:func:`~matplotlib.pyplot.figure` (e.g.
|
|
181
|
+
:func:`~matplotlib.pyplot.figure` (e.g. `figsize`).
|
|
182
182
|
|
|
183
183
|
Returns
|
|
184
184
|
-------
|
|
@@ -266,7 +266,7 @@ def scatterIMU3D(vectors, col_vector, normalize=True, title=None,
|
|
|
266
266
|
Title for the color bar.
|
|
267
267
|
**kwargs
|
|
268
268
|
Optional keyword arguments passed to
|
|
269
|
-
:func:`~matplotlib.pyplot.figure` (e.g.
|
|
269
|
+
:func:`~matplotlib.pyplot.figure` (e.g. `figsize`).
|
|
270
270
|
|
|
271
271
|
Returns
|
|
272
272
|
-------
|
|
@@ -316,7 +316,7 @@ def tsplotIMU_depth(vectors, depth, time_name=_TIME_NAME, **kwargs):
|
|
|
316
316
|
Array with depth measurements.
|
|
317
317
|
**kwargs : optional keyword arguments
|
|
318
318
|
Arguments passed to :func:`~matplotlib.pyplot.subplots`
|
|
319
|
-
(e.g.
|
|
319
|
+
(e.g. `figsize`).
|
|
320
320
|
|
|
321
321
|
Returns
|
|
322
322
|
-------
|
|
@@ -377,7 +377,7 @@ class IMU2Body(IMUBase):
|
|
|
377
377
|
covariance matrix, rather than the unscaled correlation (outer product)
|
|
378
378
|
of acceleration as the input for Singular Value Decomposition.
|
|
379
379
|
|
|
380
|
-
In addition to attributes in :class:`IMUBase`,
|
|
380
|
+
In addition to attributes in :class:`IMUBase`, `IMU2Body` adds the
|
|
381
381
|
attributes listed below.
|
|
382
382
|
|
|
383
383
|
Attributes
|
|
@@ -411,14 +411,14 @@ class IMU2Body(IMUBase):
|
|
|
411
411
|
... savgol_parms=(99, 2))
|
|
412
412
|
>>> print(imu) # doctest: +ELLIPSIS
|
|
413
413
|
IMU -- Class IMU2Body object
|
|
414
|
-
Source File
|
|
415
|
-
IMU: <xarray.Dataset>
|
|
414
|
+
Source File ...
|
|
415
|
+
IMU: <xarray.Dataset> ...
|
|
416
416
|
Dimensions: ...
|
|
417
417
|
Coordinates:
|
|
418
418
|
* timestamp (timestamp) datetime64[ns] ...
|
|
419
|
-
* accelerometer (accelerometer)
|
|
420
|
-
* magnetometer (magnetometer)
|
|
421
|
-
* gyroscope (gyroscope)
|
|
419
|
+
* accelerometer (accelerometer) <U1 12B 'x' 'y' 'z'
|
|
420
|
+
* magnetometer (magnetometer) <U1 12B 'x' 'y' 'z'
|
|
421
|
+
* gyroscope (gyroscope) <U1 12B 'x' 'y' 'z'
|
|
422
422
|
Data variables:
|
|
423
423
|
depth (timestamp) float64 ...
|
|
424
424
|
acceleration (timestamp, accelerometer) float64 ...
|
|
@@ -466,7 +466,8 @@ class IMU2Body(IMUBase):
|
|
|
466
466
|
diveMove's `diveStats` function.
|
|
467
467
|
savgol_parms : tuple, optional
|
|
468
468
|
A 2-element tuple with the window length and polynomial order
|
|
469
|
-
for the Savitzky-Golay filter
|
|
469
|
+
for the Savitzky-Golay filter
|
|
470
|
+
(:func:`~scipy.signal.savgol_filter`) to smooth acceleration.
|
|
470
471
|
**kwargs : optional keyword arguments
|
|
471
472
|
Arguments passed to the `IMUBase.__init__` for instantiation,
|
|
472
473
|
except `has_depth` because the input `Dataset` is assumed to
|
|
@@ -526,14 +527,15 @@ class IMU2Body(IMUBase):
|
|
|
526
527
|
beginning of the next interval.
|
|
527
528
|
savgol_parms : tuple, optional
|
|
528
529
|
A 2-element tuple with the window length and polynomial order
|
|
529
|
-
for the Savitzky-Golay filter
|
|
530
|
+
for the Savitzky-Golay filter
|
|
531
|
+
(:func:`~scipy.signal.savgol_filter`) to smooth acceleration.
|
|
530
532
|
load_dataset_kwargs : dict, optional
|
|
531
533
|
Dictionary of optional keyword arguments passed to
|
|
532
534
|
:func:`xarray.load_dataset`.
|
|
533
|
-
**kwargs
|
|
534
|
-
|
|
535
|
-
except
|
|
536
|
-
|
|
535
|
+
**kwargs
|
|
536
|
+
Optional keyword arguments passed to :meth:`IMUBase.__init__`
|
|
537
|
+
method, except `has_depth` or `imu_filename`. The input
|
|
538
|
+
`Dataset` is assumed to have a depth `DataArray`.
|
|
537
539
|
|
|
538
540
|
Returns
|
|
539
541
|
-------
|
|
@@ -669,9 +671,9 @@ class IMU2Body(IMUBase):
|
|
|
669
671
|
Index in surface details table to be analyzed.
|
|
670
672
|
plot : bool, optional
|
|
671
673
|
Whether to generate a plot of the estimate
|
|
672
|
-
**kwargs
|
|
673
|
-
|
|
674
|
-
|
|
674
|
+
**kwargs
|
|
675
|
+
Optional keyword arguments passed to :meth:`scatterIMU_svd`.
|
|
676
|
+
Only `title` and `animate` are taken.
|
|
675
677
|
|
|
676
678
|
Returns
|
|
677
679
|
-------
|
|
@@ -749,7 +751,7 @@ class IMU2Body(IMUBase):
|
|
|
749
751
|
def get_orientations(self):
|
|
750
752
|
r"""Obtain orientation for all periods in surface details table
|
|
751
753
|
|
|
752
|
-
A quality index (
|
|
754
|
+
A quality index (:math:`q`) for each estimate is calculated as:
|
|
753
755
|
|
|
754
756
|
.. math::
|
|
755
757
|
|
|
@@ -814,8 +816,8 @@ class IMU2Body(IMUBase):
|
|
|
814
816
|
|
|
815
817
|
Re-orient acceleration and magnetic density of IMU object relative
|
|
816
818
|
to body frame, and return re-oriented IMU object. Note that the
|
|
817
|
-
provided
|
|
818
|
-
|
|
819
|
+
provided `R_b2i` must describe the rotation from the body frame to
|
|
820
|
+
the IMU frame. The opposite rotation is applied to the
|
|
819
821
|
acceleration and magnetic field vectors of the selected surface
|
|
820
822
|
segment to orient the data in the body frame.
|
|
821
823
|
|
|
@@ -851,7 +853,7 @@ class IMU2Body(IMUBase):
|
|
|
851
853
|
def orient_surfacings(self, R_all=None):
|
|
852
854
|
"""Apply orientation to all periods in surface details table
|
|
853
855
|
|
|
854
|
-
If the
|
|
856
|
+
If the `orientations` attribute was filled, use it to build
|
|
855
857
|
multi-index dataframe, othewise, fill it.
|
|
856
858
|
|
|
857
859
|
This method orients each segment independently, as opposed to a
|
|
@@ -871,7 +873,7 @@ class IMU2Body(IMUBase):
|
|
|
871
873
|
Returns
|
|
872
874
|
-------
|
|
873
875
|
xarray.Dataset
|
|
874
|
-
Dataset with the re-oriented surface IMU objects. If
|
|
876
|
+
Dataset with the re-oriented surface IMU objects. If `R_all`
|
|
875
877
|
was not provided, the Dataset contains an additional coordinate
|
|
876
878
|
representing the surfacing period for each segment.
|
|
877
879
|
|
|
@@ -929,7 +931,7 @@ class IMU2Body(IMUBase):
|
|
|
929
931
|
Returns
|
|
930
932
|
-------
|
|
931
933
|
xarray.Dataset
|
|
932
|
-
Dataset with the re-oriented IMU object. If
|
|
934
|
+
Dataset with the re-oriented IMU object. If `R_all` was not
|
|
933
935
|
provided, the Dataset contains an additional coordinate
|
|
934
936
|
representing the surfacing period for each segment.
|
|
935
937
|
|
|
@@ -997,10 +999,10 @@ class IMU2Body(IMUBase):
|
|
|
997
999
|
return imus
|
|
998
1000
|
|
|
999
1001
|
def filter_surfacings(self, qual_thresh):
|
|
1000
|
-
"""Filter records from
|
|
1002
|
+
"""Filter records from `surface_details` and `orientations`
|
|
1001
1003
|
|
|
1002
|
-
Remove records from the
|
|
1003
|
-
attributes, based on
|
|
1004
|
+
Remove records from the `surface_details` and `orientations`
|
|
1005
|
+
attributes, based on `quality` and, optionally, duration of the
|
|
1004
1006
|
surface period. Records with quality higher than the specified
|
|
1005
1007
|
value, and (optionally) duration lower than the specified number of
|
|
1006
1008
|
seconds, are removed.
|
|
@@ -1082,7 +1084,7 @@ class IMU2Body(IMUBase):
|
|
|
1082
1084
|
`vec_name="acceleration"`)
|
|
1083
1085
|
**kwargs
|
|
1084
1086
|
Optional keyword arguments passed to
|
|
1085
|
-
:func:`~matplotlib.pyplot.subplots` (e.g.
|
|
1087
|
+
:func:`~matplotlib.pyplot.subplots` (e.g. `figsize`).
|
|
1086
1088
|
|
|
1087
1089
|
Returns
|
|
1088
1090
|
-------
|
|
@@ -1143,7 +1145,7 @@ class _TagTools(IMU2Body):
|
|
|
1143
1145
|
Whether to generate a plot of the estimate
|
|
1144
1146
|
**kwargs
|
|
1145
1147
|
Optional keyword arguments passed to :meth:`scatterIMU_svd`.
|
|
1146
|
-
Only
|
|
1148
|
+
Only `title` and `animate` are taken.
|
|
1147
1149
|
|
|
1148
1150
|
Returns
|
|
1149
1151
|
-------
|