r"""Read annotations from a file. This function reads a ``.fif``, ``.fif.gz``, ``.vmrk``, ``.amrk``, ``.edf``, ``.bdf``, ``.gdf``, ``.txt``, ``.csv``, ``.cnt``, ``.cef``, or ``.set`` file and makes an :class:`mne.Annotations` object. Parameters ---------- fname : path-like
(
fname,
sfreq="auto",
uint16_codec=None,
encoding="utf8",
ignore_marker_types=False,
data_format="auto",
)
| 1796 | |
| 1797 | @fill_doc |
| 1798 | def read_annotations( |
| 1799 | fname, |
| 1800 | sfreq="auto", |
| 1801 | uint16_codec=None, |
| 1802 | encoding="utf8", |
| 1803 | ignore_marker_types=False, |
| 1804 | data_format="auto", |
| 1805 | ) -> Annotations: |
| 1806 | r"""Read annotations from a file. |
| 1807 | |
| 1808 | This function reads a ``.fif``, ``.fif.gz``, ``.vmrk``, ``.amrk``, |
| 1809 | ``.edf``, ``.bdf``, ``.gdf``, ``.txt``, ``.csv``, ``.cnt``, ``.cef``, or |
| 1810 | ``.set`` file and makes an :class:`mne.Annotations` object. |
| 1811 | |
| 1812 | Parameters |
| 1813 | ---------- |
| 1814 | fname : path-like |
| 1815 | The filename. |
| 1816 | sfreq : float | ``'auto'`` |
| 1817 | The sampling frequency in the file. This parameter is necessary for |
| 1818 | \*.vmrk, \*.amrk, and \*.cef files as Annotations are expressed in |
| 1819 | seconds and \*.vmrk/\*.amrk/\*.cef files are in samples. For any other |
| 1820 | file format, ``sfreq`` is omitted. If set to 'auto' then the ``sfreq`` |
| 1821 | is taken from the respective info file of the same name with according |
| 1822 | file extension (\*.vhdr/\*.ahdr for brainvision; \*.dap for Curry 7; |
| 1823 | \*.cdt.dpa for Curry 8). So data.vmrk/amrk looks for sfreq in |
| 1824 | data.vhdr/ahdr, data.cef looks in data.dap and data.cdt.cef looks in |
| 1825 | data.cdt.dpa. |
| 1826 | uint16_codec : str | None |
| 1827 | This parameter is only used in EEGLAB (\*.set) and omitted otherwise. |
| 1828 | If your \*.set file contains non-ascii characters, sometimes reading |
| 1829 | it may fail and give rise to error message stating that "buffer is |
| 1830 | too small". ``uint16_codec`` allows to specify what codec (for example: |
| 1831 | ``'latin1'`` or ``'utf-8'``) should be used when reading character |
| 1832 | arrays and can therefore help you solve this problem. |
| 1833 | %(encoding_edf)s |
| 1834 | Only used when reading EDF annotations. |
| 1835 | ignore_marker_types : bool |
| 1836 | If ``True``, ignore marker types in BrainVision files (and only use their |
| 1837 | descriptions). Defaults to ``False``. |
| 1838 | data_format : str |
| 1839 | Only used by CNT files, see :func:`mne.io.read_raw_cnt` for details. |
| 1840 | |
| 1841 | Returns |
| 1842 | ------- |
| 1843 | annot : instance of Annotations |
| 1844 | The annotations. |
| 1845 | |
| 1846 | Notes |
| 1847 | ----- |
| 1848 | The annotations stored in a ``.csv`` require the onset columns to be |
| 1849 | timestamps. If you have onsets as floats (in seconds), you should use the |
| 1850 | ``.txt`` extension. |
| 1851 | """ |
| 1852 | from .io.brainvision.brainvision import _read_annotations_brainvision |
| 1853 | from .io.cnt.cnt import _read_annotations_cnt |
| 1854 | from .io.ctf.markers import _read_annotations_ctf |
| 1855 | from .io.curry.curry import _read_annotations_curry |