You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Speasy is compatible with `numpy <https://numpy.org/>`_ and uses it internally to perform various operations. You can also pass Speasy variables to most numpy functions.
7
+
``SpeasyVariable`` objects behave like NumPy arrays: you can use arithmetic operators, pass them to NumPy functions,
8
+
and index them with boolean masks or integer arrays. The result is always a ``SpeasyVariable`` when the shape
9
+
allows it (i.e. when the time axis is preserved), and a scalar or plain array otherwise.
9
10
10
11
Arithmetic operations
11
12
---------------------
12
13
13
-
For example, you can perform arithmetic operations on Speasy variables:
14
+
Standard arithmetic operators (``+``, ``-``, ``*``, ``/``, ``**``) work directly on Speasy variables
15
+
and return a new ``SpeasyVariable`` with the same time axis:
Copy file name to clipboardExpand all lines: docs/user/scipy.rst
+45-6Lines changed: 45 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,21 @@ SciPy compatibility
4
4
.. toctree::
5
5
:maxdepth:1
6
6
7
-
Speasy wraps a few `scipy <https://www.scipy.org/>`_ functions to provide interpolation, filtering, and resampling capabilities for Speasy variables.
7
+
When working with space physics data, you often need to combine measurements from different instruments
8
+
that sample at different rates, or remove low-frequency trends from a signal. Speasy provides
9
+
ready-to-use functions for these common tasks, built on top of `SciPy <https://www.scipy.org/>`_.
10
+
11
+
All functions in ``speasy.signal`` accept one or more ``SpeasyVariable`` objects and return
12
+
``SpeasyVariable`` objects with metadata preserved.
13
+
8
14
9
15
Interpolation
10
16
-------------
11
17
12
-
You can use the :func:`speasy.signal.resampling.interpolate` function to interpolate one or more Speasy variables onto a new time base or another variable's time base.
18
+
Instruments on the same spacecraft often sample at different cadences (e.g. magnetic field at 16 Hz,
19
+
particle moments at 4.5 s). To compare them, you need to bring them onto a common time base.
13
20
14
-
For example, you can interpolate a variable onto a new time base:
21
+
**Interpolate onto a regular time grid:**
15
22
16
23
>>> import speasy as spz
17
24
>>> from speasy.signal import resampling
@@ -26,7 +33,7 @@ For example, you can interpolate a variable onto a new time base:
You can use the :func:`speasy.signal.filtering.apply_sos_filter` function to apply a second-order section (SOS) filter to one or more Speasy variables.
79
+
You can apply any SciPy IIR filter (designed as second-order sections) to a Speasy variable.
80
+
This is useful for removing trends, isolating frequency bands, or smoothing data.
52
81
53
-
For example, you can apply a high-pass filter to a variable:
82
+
**Example: high-pass filter to remove the DC component**
54
83
55
84
>>> import speasy as spz
56
85
>>> from speasy.signal import filtering
@@ -63,3 +92,13 @@ For example, you can apply a high-pass filter to a variable:
0 commit comments