Skip to content

Commit 789c561

Browse files
committed
whenxuan: create the notebook and upload the data for memd
1 parent 41977c5 commit 789c561

8 files changed

Lines changed: 803 additions & 7 deletions

File tree

‎examples/image/bmemd.ipynb‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
},
6060
{
6161
"cell_type": "code",
62-
"execution_count": 1,
62+
"execution_count": 8,
6363
"id": "37c1435e",
6464
"metadata": {},
6565
"outputs": [
@@ -151,7 +151,7 @@
151151
},
152152
{
153153
"cell_type": "code",
154-
"execution_count": 2,
154+
"execution_count": 9,
155155
"id": "3bbca5cb",
156156
"metadata": {},
157157
"outputs": [
@@ -199,7 +199,7 @@
199199
},
200200
{
201201
"cell_type": "code",
202-
"execution_count": 3,
202+
"execution_count": 10,
203203
"id": "a6387137",
204204
"metadata": {},
205205
"outputs": [
@@ -280,7 +280,7 @@
280280
},
281281
{
282282
"cell_type": "code",
283-
"execution_count": 4,
283+
"execution_count": 11,
284284
"id": "fae64ede",
285285
"metadata": {},
286286
"outputs": [
@@ -338,7 +338,7 @@
338338
},
339339
{
340340
"cell_type": "code",
341-
"execution_count": 5,
341+
"execution_count": 12,
342342
"id": "17e70079",
343343
"metadata": {},
344344
"outputs": [
@@ -402,7 +402,7 @@
402402
},
403403
{
404404
"cell_type": "code",
405-
"execution_count": 6,
405+
"execution_count": 13,
406406
"id": "bf82caba",
407407
"metadata": {},
408408
"outputs": [
@@ -469,7 +469,7 @@
469469
},
470470
{
471471
"cell_type": "code",
472-
"execution_count": 7,
472+
"execution_count": 14,
473473
"id": "0f906ca7",
474474
"metadata": {},
475475
"outputs": [

‎examples/memd/memd.ipynb‎

Lines changed: 738 additions & 0 deletions
Large diffs are not rendered by default.

‎pysdkit/data/__init__.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
"load_single_nsignal",
4040
"load_map2",
4141
"load_wind_demo",
42+
"load_memd_syn_12channel",
43+
"load_memd_syn_16channel",
44+
"load_memd_syn_hex",
45+
"load_memd_taichi_hex",
4246
]
4347

4448
# A series of functions for generating 1D NumPy signals
@@ -117,4 +121,8 @@
117121
load_single_nsignal,
118122
load_map2,
119123
load_wind_demo,
124+
load_memd_syn_12channel,
125+
load_memd_syn_16channel,
126+
load_memd_syn_hex,
127+
load_memd_taichi_hex,
120128
)

‎pysdkit/data/_loaders.py‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,56 @@ def test_fmd() -> Tuple[np.ndarray, np.ndarray, float]:
140140
return t, x, fs
141141

142142

143+
def _load_memd_multichannel(name: str) -> Dict[str, np.ndarray]:
144+
"""Load a packaged MEMD demo array stored as ``(n_channels, n_samples)``."""
145+
signal = np.asarray(np.load(data_file(name)), dtype=np.float64)
146+
if signal.ndim != 2:
147+
raise ValueError("{} must be a 2-D array".format(name))
148+
t = np.arange(signal.shape[1], dtype=float)
149+
return {"signal": signal, "t": t}
150+
151+
152+
def load_memd_syn_12channel() -> Dict[str, np.ndarray]:
153+
"""
154+
Load the packaged MATLAB ``syn_12channel_inp.mat`` demo (``s12``).
155+
156+
Twelve-channel synthetic mixture of five tones plus noise on some
157+
channels, length 1001, from the MEMD toolbox of Rehman & Mandic.
158+
"""
159+
return _load_memd_multichannel("memd_syn_12channel.npy")
160+
161+
162+
def load_memd_syn_16channel() -> Dict[str, np.ndarray]:
163+
"""
164+
Load the packaged MATLAB ``syn_16channel_inp.mat`` demo (``s16``).
165+
166+
Sixteen-channel synthetic mixture of six tones plus noise on some
167+
channels, length 1001, from the MEMD toolbox of Rehman & Mandic.
168+
"""
169+
return _load_memd_multichannel("memd_syn_16channel.npy")
170+
171+
172+
def load_memd_syn_hex() -> Dict[str, np.ndarray]:
173+
"""
174+
Load the packaged MATLAB ``syn_hex_inp.mat`` demo (``s6``).
175+
176+
Hexavariate synthetic series used in Rehman & Mandic, Proc. R. Soc. A
177+
466:1291–1302 (2010), Figure 3 (four sinusoids with a common scale).
178+
"""
179+
return _load_memd_multichannel("memd_syn_hex.npy")
180+
181+
182+
def load_memd_taichi_hex() -> Dict[str, np.ndarray]:
183+
"""
184+
Load the packaged MATLAB ``taichi_hex_inp.mat`` demo (``taichi_final``).
185+
186+
Real-world hexavariate Tai-chi recording: two 3-D inertial body-sensor
187+
streams (left wrist and left ankle) stacked into six channels of length
188+
800. Stored as ``(6, 800)``.
189+
"""
190+
return _load_memd_multichannel("memd_taichi_hex.npy")
191+
192+
143193
def test_vmd() -> Tuple[np.ndarray, np.ndarray, float]:
144194
"""
145195
Load the packaged VMD demo signal (``vmd_example.npy``).
94 KB
Binary file not shown.
125 KB
Binary file not shown.

‎pysdkit/data/memd_syn_hex.npy‎

47 KB
Binary file not shown.

‎pysdkit/data/memd_taichi_hex.npy‎

37.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)