Skip to content

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

The wandas.datasets module contains sample-data helpers for tests and demonstrations.

wandas.datasetsはテストとデモで使うサンプルデータのhelperを提供します。

wandas.datasets.sample_data

Attributes

__all__ = ['load_sample_signal'] module-attribute

Functions

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

Generate a sample sine-wave signal.

Parameters:

Name Type Description Default
frequency float

Frequency of the signal in Hz.

5.0
sampling_rate int

Sampling rate in Hz.

100
duration float

Duration of the signal in seconds.

1.0

Returns:

Type Description
NDArrayReal

Signal data as a NumPy array.

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

    Args:
        frequency: Frequency of the signal in Hz.
        sampling_rate: Sampling rate in Hz.
        duration: Duration of the signal in seconds.

    Returns:
        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