Skip to content

Datasets Module / データセットモジュール

The wandas.datasets module provides sample data that can be used for testing and demonstrations. wandas.datasets モジュールは、テストやデモに使用できるサンプルデータを提供します。

Sample Data / サンプルデータ

Provides sample audio data that can be used for testing and demonstrations. テストやデモで使用できるサンプルオーディオデータを提供します。

wandas.datasets.sample_data

Attributes

Functions

load_sample_signal(frequency=5.0, sampling_rate=100, duration=1.0)

Generate a sample sine wave signal.

Parameters

frequency : float, default=5.0 Frequency of the signal in Hz. sampling_rate : int, default=100 Sampling rate in Hz. duration : float, default=1.0 Duration of the signal in seconds.

Returns

NDArrayReal Signal data as a NumPy array.

Source code in wandas/datasets/sample_data.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def load_sample_signal(frequency: float = 5.0, sampling_rate: int = 100, duration: float = 1.0) -> NDArrayReal:
    """
    Generate a sample sine wave signal.

    Parameters
    ----------
    frequency : float, default=5.0
        Frequency of the signal in Hz.
    sampling_rate : int, default=100
        Sampling rate in Hz.
    duration : float, default=1.0
        Duration of the signal in seconds.

    Returns
    -------
    NDArrayReal
        Signal data as a NumPy array.
    """
    num_samples = int(sampling_rate * duration)
    t = np.arange(num_samples) / sampling_rate
    signal: NDArrayReal = np.sin(2 * np.pi * frequency * t, dtype=np.float64)
    return signal