Skip to content

3. API Reference

Reads XDF files (*.xdf) recorded with TMSi amplifiers.

Parameters:

Name Type Description Default
xdf_fname str | os.PathLike

Path to the XDF file.

required
stream_picks int | str

Streams to load. Can be either an int corresponding to the "stream_id", or a str corresponding to the "name" of the stream. Note that "stream_id" indexing starts at 1 and NOT at 0.

1
scale int | float

Scaling factor for data. Default scaling factor is 1e-6.

1e-06
verbose VerbosityLevel

Verbosity level.

True

Returns:

Name Type Description
raw instance of RawXDF

A Raw object containing XDF data.

Examples:

Loading a recording and using only the stream with 'stream_id' = 1.

>>> fname = "my_recording.xdf"
>>> raw = pte_xdf.read_raw_xdf(fname=fname, stream_picks=1, verbose=True)
Reading file:
my_recording.xdf
Number of streams in file: 1.
Streams being loaded: 1.

Loading a recording and using only the stream with 'name' = 'SAGA'.

>>> raw = pte_xdf.read_raw_xdf(fname, stream_picks='SAGA', verbose=True)
Reading file:
my_recording.xdf
Number of streams in file: 1.
Streams being loaded: SAGA.

See Also

mne.io.Raw : Documentation of attributes and methods.

Source code in pte_xdf\xdf.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
def read_raw_xdf(
    xdf_fname: PathLike,
    stream_picks: int | str = 1,
    scale: int | float = 1e-6,
    verbose: VerbosityLevel = True,
):
    """Reads XDF files (*.xdf) recorded with TMSi amplifiers.

    Parameters
    ----------
    xdf_fname : str | os.PathLike
        Path to the XDF file.
    stream_picks : int | str
        Streams to load. Can be either an int corresponding to the "stream_id",
         or a str corresponding to the "name" of the stream. Note that
         "stream_id" indexing starts at 1 and NOT at 0.
    scale : int | float
        Scaling factor for data. Default scaling factor is 1e-6.
    verbose: bool | None
        Verbosity level.

    Returns
    -------
    raw : instance of RawXDF
        A Raw object containing XDF data.

    Examples
    --------

    Loading a recording and using only the stream with 'stream_id' = 1.

    >>> fname = "my_recording.xdf"
    >>> raw = pte_xdf.read_raw_xdf(fname=fname, stream_picks=1, verbose=True)
    Reading file:
    my_recording.xdf
    Number of streams in file: 1.
    Streams being loaded: 1.

    Loading a recording and using only the stream with 'name' = 'SAGA'.

    >>> raw = pte_xdf.read_raw_xdf(fname, stream_picks='SAGA', verbose=True)
    Reading file:
    my_recording.xdf
    Number of streams in file: 1.
    Streams being loaded: SAGA.

    See Also
    --------
    mne.io.Raw : Documentation of attributes and methods.
    """
    return RawXDF(
        xdf_fname=xdf_fname,
        stream_picks=stream_picks,
        scale=scale,
        verbose=verbose,
    )