writegdf#

writegdf(filename, data, sampling_rate, *, labels=None, events=None, subject='', recording='')#

Write finite continuous channel-major data as GDF 1.25.

Floating-point GDF samples preserve the input values without integer quantization. Numeric event types retain their codes. Non-numeric event labels receive deterministic file-local codes in the private range and are returned so callers can record that mapping.

Parameters:
  • filename (str | Path) – Destination ending in .gdf.

  • data (Any) – Channels by samples matrix.

  • sampling_rate (float) – Samples per second.

  • labels (list[str] | tuple[str, ...] | None) – Optional channel labels; defaults to Ch1, Ch2, etc.

  • events (Any) – Optional event dictionaries with 1-based sample latency.

  • subject (str) – Optional subject identifier.

  • recording (str) – Optional recording identifier.

Returns:

Mapping from non-numeric event labels to their stored uint16 codes.

Return type:

dict[str, int]