pycartool.io package

Submodules

pycartool.io.montage module

pycartool.io.montage.read_xyz(filename, kind='')[source]

Reads and convert xyz positions to a mne montage type

Parameters

filename (str) – The filename of the xyz file.

Returns

montage – Montage for EEG electrode locations.

Return type

mne.channels.montage.Montage

pycartool.io.sef module

pycartool.io.sef.read_sef(path)[source]

Reads file with format .sef, and returns a mne.io.Raw object containing the data.

Parameters

path (str) – The path of the sef file.

Returns

raw – RawArray containing the EEG signals.

Return type

mne.io.RawArray

pycartool.io.sef.write_sef(path, raw)[source]

Export a raw mne file to a sef file.

Parameters
  • path (str) – Filename of the exported dataset.

  • raw (instance of mne.io.Raw) – The raw data to export.

pycartool.io.roi module

pycartool.io.roi.read_roi(filename)[source]

Read Cartool region of interest (.rois) files.

Parameters

filename (str) – The roi file to read

Returns

Rois

The Rois info info. Keys are:
nameslist of str

the rois names.

elements :list of int

the indices of elements belonging to each rois (indice start to 1).

Return type

dict of str

Warning

Indexes start from 1, not 0 as Cartools does. When using with combination of source space, you way need to tranform to 0 base indices.

pycartool.io.source_space module

pycartool.io.source_space.read_spi(filename)[source]

Read Cartool spi file.

Parameters

filename (str) – The spi file to read.

Returns

  • coord (ndarray, shape (n_sources, 3)) – the source coordinates.

  • names (list, shape (n_sources))

pycartool.io.source_space.write_spi(filename, solution_points)[source]

Write Cartool spi file.

Parameters
  • filename (str) – The spi file to write.

  • solution_points (dict of str) –

    The solution points info. Keys are:
    nameslist of str

    the solutions point names.

    coordinatesnp.array, shape (n_solutions_points, 3)

    the x,y,z coordinates of each solution point.

pycartool.io.inverse_solution module

pycartool.io.inverse_solution.read_is(filename)[source]

Read Cartool inverse solution (.is) file.

Parameters

filename (str) – the is file to read.

Returns

the inverse solution matrices. n_dim=1 if solutions are scalar or n_dim=3 for vectorial solutions.

Return type

ndarray, shape (n_regularizations, n_dim, n_solutionpoints, n_channels)

pycartool.io.inverse_solution.read_ris(filename)[source]

Read Cartool Results of Inverse Solution computation (.ris) file.

Parameters

filename (str) – the ris file to read.

Returns

results_of_is

Keys are:
ris_typestr

magic should always be ‘RI01’.

is_scalarbool

True if solution is scalar, else False (vectorial).

sfreqfloat

sampling frequency (in Hz).

datanp.ndarray, shape(n_timeframes, n_dim, n_solutionpoints)

time course of each solution point.

Return type

dict of str

pycartool.io.inverse_solution.write_ris(path, data, sfreq)[source]

Short summary.

Parameters
  • path (str) – Path of the exported inverse solution computation.

  • data (np.ndarray, shape(n_timeframes, n_dim, n_solutionpoints)) – time course of each solution point.

  • sfreq (float) – sampling frequency (in Hz).

pycartool.io.leadfield module

pycartool.io.leadfield.read_lf(filename)[source]

Read Cartool leadfield matrix.

Parameters

filename (str) – The lf file to read.

Returns

leadfield_matrix – the leadfield matrix.

Return type

ndarray, shape (n_channels, n_sources, 3)

Module contents